public abstract class BaseSessionHandlingStrategy extends Object implements SessionHandlingStrategy
It provides useful methods to initialize a client and a session. It provides a method to connect (bind) to the SMSC with retry handling. It also provides method to cleanup. The implementations can then use this methods as they wish.
Modifier and Type | Field and Description |
---|---|
protected SmppClientSupplier |
clientSupplier |
protected ExtendedSmppSessionConfiguration |
configuration |
protected com.cloudhopper.smpp.SmppClient |
currentClient |
protected com.cloudhopper.smpp.SmppSession |
currentSession |
protected org.slf4j.Logger |
logger |
protected RetryExecutor |
retry |
protected SmppSessionHandlerSupplier |
smppSessionHandlerSupplier |
Constructor and Description |
---|
BaseSessionHandlingStrategy(org.slf4j.Logger logger,
ExtendedSmppSessionConfiguration configuration,
SmppClientSupplier clientSupplier,
SmppSessionHandlerSupplier smppSessionHandlerSupplier,
RetryExecutor retry) |
Modifier and Type | Method and Description |
---|---|
protected com.cloudhopper.smpp.SmppSession |
connect(com.cloudhopper.smpp.SmppClient client)
Connect the client to the SMSC using a
SmppClient.bind(com.cloudhopper.smpp.SmppSessionConfiguration, com.cloudhopper.smpp.SmppSessionHandler)
request. |
protected void |
destroyClient()
Destroy (cleanup everything) the client.
|
protected void |
destroySession()
Send an unbind command to the server to properly close the session, close
the session and cleanup everything related to the session.
|
protected void |
initClient()
Create a
SmppClient instance of not existing (is null ). |
protected void |
initSession()
Initializes a new session only if session doesn't exist (is
null ). |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSession, messageNotSent, messageProcessed, messageSent
protected final org.slf4j.Logger logger
protected final ExtendedSmppSessionConfiguration configuration
protected final SmppClientSupplier clientSupplier
protected final SmppSessionHandlerSupplier smppSessionHandlerSupplier
protected final RetryExecutor retry
protected com.cloudhopper.smpp.SmppClient currentClient
protected com.cloudhopper.smpp.SmppSession currentSession
public BaseSessionHandlingStrategy(org.slf4j.Logger logger, ExtendedSmppSessionConfiguration configuration, SmppClientSupplier clientSupplier, SmppSessionHandlerSupplier smppSessionHandlerSupplier, RetryExecutor retry)
protected void initSession() throws SmppException
null
).
A SmppClient
instance must exist (either using
initClient()
or by manually creating it). The same
SmppClient
may be used several times for different sessions.
The creation of a session is done by calling
connect(SmppClient)
.
SmppException
- when session couldn't be createdprotected com.cloudhopper.smpp.SmppSession connect(com.cloudhopper.smpp.SmppClient client) throws SmppException
SmppClient.bind(com.cloudhopper.smpp.SmppSessionConfiguration, com.cloudhopper.smpp.SmppSessionHandler)
request.
The configured retry strategy is used to send the bind request to the server i.e. several attempts may be done.
client
- the client used to send to bind commandSmppException
- when the session couldn't be boundprotected void initClient()
SmppClient
instance of not existing (is null
).protected void destroySession()
null
.protected void destroyClient()
null
.Copyright © 2021. All rights reserved.