SmppSessionImpl
public class SmppSessionImpl
Extends: java.lang.Object
Implements: SmppServerSession, SmppSession, SmppSessionChannelListener
SmppSessionImpl is the default implementation of an SMPP session in the Mobius library. It handles the full session lifecycle, including binding, state transitions, PDU encoding/decoding, request/response matching, and communication with client or server handlers.
Fields:
Modifier and Type | Field and Description |
static org.apache.logging.log4j.Logger | logger |
static org.apache.logging.log4j.Logger | networkLogger |
Fields inherited from interface com.mobius.software.protocols.smpp.channel.SmppSession
STATE_BINDING, STATE_BOUND, STATE_CLOSED, STATE_INITIAL, STATE_OPEN, STATE_UNBINDING, STATES
Constructor:
public SmppSessionImpl(
SmppSession.Type localType,
SmppSessionConfiguration configuration,
Channel channel,
SmppServerHandler server,
BaseBindResp preparedBindResponse,
SmppVersion interfaceVersion,
PeriodicQueuedTasks<Timer> timersQueue
)
Used for server-accepted sessions. Includes pre-prepared bind response.
public SmppSessionImpl(
SmppSession.Type localType,
SmppSessionConfiguration configuration,
Channel channel,
SmppSessionHandler sessionHandler,
PeriodicQueuedTasks<Timer> timersQueue
)
Used for client-initiated sessions. Includes direct handler reference.
Methods:
Session Lifecycle & State |
|
public String getId() | Returns unique session ID. |
public SmppBindType getBindType() | Returns bind type (receiver, transmitter, etc.). |
public SmppSession.Type getLocalType() / public SmppSession.Type getRemoteType() | Returns local/remote session types. |
public long getBoundTime() | Returns timestamp of successful binding. |
public String getStateName() | Returns current session state as a string. |
public boolean isOpen() / public boolean isClosed()/ public boolean isBinding() / public boolean isBound() / public boolean isUnbinding() | State check helpers. |
public void close() / passiveClose() / destroy() | Graceful or forced shutdown. |
Communication |
|
public void bind(BaseBind request, long timeoutInMillis) |
Sends bind and waits for response. throws RecoverablePduException, UnrecoverablePduException, SmppTimeoutException, SmppChannelException, InterruptedException |
public void unbind(long timeoutInMillis) | Sends unbind command. |
public void sendRequestPdu(PduRequest<?> request) |
Sends request to remote peer. throws RecoverablePduException, UnrecoverablePduException, SmppTimeoutException, SmppChannelException, InterruptedException |
public void sendResponsePdu(PduResponse response) |
Sends a response to a received request. throws RecoverablePduException, UnrecoverablePduException, SmppChannelException, InterruptedException |
public void sendRequest(PduRequest request, long timeoutInMillis) |
Sends request and handles response asynchronously. throws RecoverablePduException, UnrecoverablePduException, SmppChannelException |
Internals & Utilities |
|
public SmppSessionConfiguration getConfiguration() | Returns full session config. |
public io.netty.channel.Channel getChannel() | Underlying Netty channel reference. |
public SequenceNumber getSequenceNumber() | Sequence number tracker for matching requests/responses. |
public PduTranscoder getTranscoder() | Access to encoder/decoder used in this session. |
public void expired(PduRequest request) / expireAll() | Manages timed-out request PDUs. |
Event Handling (from SmppSessionChannelListener) |
|
public void firePduReceived(Pdu pdu) | Triggered when any PDU is received. |
public void fireExceptionThrown(Throwable t) | Triggered on low-level I/O or decoding error. |
public void fireChannelClosed() | Triggered when connection is closed unexpectedly. |
Session Capabilities |
|
SmppVersion getInterfaceVersion() | Returns the negotiated SMPP protocol version for the session. |
boolean areOptionalParametersSupported() | Indicates whether optional TLV parameters are supported in the current session. |
Server-specific |
|
public void serverReady(SmppSessionHandler sessionHandler) | Injects handler into server-side session. |
Override |
|
public int hashCode() | Overrides the default Object.hashCode() method to provide a consistent, session-specific hash. |
public boolean equals(Object obj) | Overrides Object.equals() to provide logical equality, comparing session identity (e.g., session ID or connection state) instead of memory reference. |
Start innovating with Mobius
What's next? Let's talk!