Package ch.rswk.meta.engine
Class GatewayService
java.lang.Object
com.google.common.util.concurrent.AbstractIdleService
ch.rswk.meta.engine.AbstractEngineIdleService<GatewayService.GatewayServiceConfig>
ch.rswk.meta.engine.GatewayService
- All Implemented Interfaces:
EngineServices.ConfigurableService<GatewayService.GatewayServiceConfig>,EngineServices.InfoProvidingService,com.google.common.util.concurrent.Service
- Direct Known Subclasses:
GatewayMockService
@Singleton
public class GatewayService
extends AbstractEngineIdleService<GatewayService.GatewayServiceConfig>
GatewayService for sending SMS, email and invoking webhooks.
SMS delivery depends on iNetWorx SMS-Gateway.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic interfacestatic final recordstatic final recordstatic final recordstatic final recordstatic final recordNested classes/interfaces inherited from interface com.google.common.util.concurrent.Service
com.google.common.util.concurrent.Service.Listener, com.google.common.util.concurrent.Service.State -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate com.codahale.metrics.Meterprivate com.codahale.metrics.Meterprivate final org.eclipse.jetty.client.HttpClientprivate static final org.slf4j.Loggerprivate Propertiesprivate static final URIprivate static final URIprivate static final Stringstatic final intprivate static final Stringprivate static final intprivate static final Stringprivate com.codahale.metrics.Meterprivate com.codahale.metrics.MeterFields inherited from class ch.rswk.meta.engine.AbstractEngineIdleService
runtime -
Constructor Summary
ConstructorsConstructorDescriptionGatewayService(GatewayService.GatewayServiceConfig config, EngineRuntime runtime) -
Method Summary
Modifier and TypeMethodDescriptionintorg.eclipse.jetty.client.HttpClientcom.google.common.util.concurrent.ListenableFuture<GatewayService.DeliveryReply> sendEmail(GatewayService.EmailRequest request) com.google.common.util.concurrent.ListenableFuture<GatewayService.DeliveryReply> sendEmail(@Nullable String emailReplyTo, String emailSender, GatewayService.EmailRequest request) com.google.common.util.concurrent.ListenableFuture<GatewayService.DeliveryReply> sendSms(GatewayService.SmsRequest request) protected voidshutDown()protected voidstartUp()Methods inherited from class ch.rswk.meta.engine.AbstractEngineIdleService
configClass, configReference, onConfigWatcherNotification, serviceId, serviceNameMethods inherited from class com.google.common.util.concurrent.AbstractIdleService
addListener, awaitRunning, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, awaitTerminated, executor, failureCause, isRunning, startAsync, state, stopAsync, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ch.rswk.meta.engine.EngineServices.ConfigurableService
config, handleConfigWatcherNotification, onConfigChangedMethods inherited from interface ch.rswk.meta.engine.EngineServices.InfoProvidingService
getServiceInfo
-
Field Details
-
LOG
private static final org.slf4j.Logger LOG -
SMS_MESSAGE_MAX_LENGTH
public static final int SMS_MESSAGE_MAX_LENGTH- See Also:
-
SMS_GATEWAY_URI
- See Also:
-
SMS_GATEWAY_SEND_URI
-
SMS_GATEWAY_OPTIONS_URI
-
SMS_OPTION_OK_RESPONSE
- See Also:
-
SMS_REMAINING_ALERT
private static final int SMS_REMAINING_ALERT- See Also:
-
SMS_SEND_OK_RESPONSE
- See Also:
-
httpClient
private final org.eclipse.jetty.client.HttpClient httpClient -
emailErrorMeter
private com.codahale.metrics.Meter emailErrorMeter -
emailMeter
private com.codahale.metrics.Meter emailMeter -
mailProperties
-
smsErrorMeter
private com.codahale.metrics.Meter smsErrorMeter -
smsMeter
private com.codahale.metrics.Meter smsMeter
-
-
Constructor Details
-
GatewayService
-
-
Method Details
-
sendEmail
public com.google.common.util.concurrent.ListenableFuture<GatewayService.DeliveryReply> sendEmail(GatewayService.EmailRequest request) -
sendEmail
public com.google.common.util.concurrent.ListenableFuture<GatewayService.DeliveryReply> sendEmail(@Nullable String emailReplyTo, String emailSender, GatewayService.EmailRequest request) -
sendSms
public com.google.common.util.concurrent.ListenableFuture<GatewayService.DeliveryReply> sendSms(GatewayService.SmsRequest request) -
startUp
- Overrides:
startUpin classAbstractEngineIdleService<GatewayService.GatewayServiceConfig>- Throws:
Exception
-
shutDown
- Overrides:
shutDownin classAbstractEngineIdleService<GatewayService.GatewayServiceConfig>- Throws:
Exception
-
checkRemainingSms
public int checkRemainingSms() -
httpClient
public org.eclipse.jetty.client.HttpClient httpClient()
-