org.jsmpp.session
Interface Session

All Known Subinterfaces:
ClientSession
All Known Implementing Classes:
AbstractSession, SMPPServerSession, SMPPSession

public interface Session

Session describe all abilities of the session. Each created session will be identified with session id and has a state (open, bound, unbound, closed). Every changes of state will be notified and the event can be captured by implementing SessionStateListener and register it to a session addSessionStateListener(SessionStateListener).

Commonly, every SMPP request has a response. The maximum waiting time can be configured as transaction timer.

To terminate the communication with the Message Center gracefully, invoke unbindAndClose(). It will send UNBIND command and close the connection. This method will wait the UNIBIND_RESP but, negative response will be acceptable and closing connection will be done immediately.

Author:
uudashr
See Also:
SessionState

Method Summary
 void addSessionStateListener(SessionStateListener l)
           
 void close()
          Forced close connection without sending UNBIND command to Message Center.
 DataSmResult dataShortMessage(java.lang.String serviceType, TypeOfNumber sourceAddrTon, NumberingPlanIndicator sourceAddrNpi, java.lang.String sourceAddr, TypeOfNumber destAddrTon, NumberingPlanIndicator destAddrNpi, java.lang.String destinationAddr, ESMClass esmClass, RegisteredDelivery registeredDelivery, DataCoding dataCoding, OptionalParameter... optionalParameters)
          Sending a short message like SUBMIT_SM.
 int getEnquireLinkTimer()
           
 long getLastActivityTimestamp()
          Get the last reading valid PDU from remote host.
 java.lang.String getSessionId()
          Get session id.
 SessionState getSessionState()
           
 long getTransactionTimer()
           
 void removeSessionStateListener(SessionStateListener l)
           
 void setEnquireLinkTimer(int enquireLinkTimer)
           
 void setTransactionTimer(long transactionTimer)
           
 void unbindAndClose()
          Sending UNBIND and close connection immediately.
 

Method Detail

dataShortMessage

DataSmResult dataShortMessage(java.lang.String serviceType,
                              TypeOfNumber sourceAddrTon,
                              NumberingPlanIndicator sourceAddrNpi,
                              java.lang.String sourceAddr,
                              TypeOfNumber destAddrTon,
                              NumberingPlanIndicator destAddrNpi,
                              java.lang.String destinationAddr,
                              ESMClass esmClass,
                              RegisteredDelivery registeredDelivery,
                              DataCoding dataCoding,
                              OptionalParameter... optionalParameters)
                              throws PDUException,
                                     ResponseTimeoutException,
                                     InvalidResponseException,
                                     NegativeResponseException,
                                     java.io.IOException
Sending a short message like SUBMIT_SM. This method will blocks until response received or timeout reached. This method simplify operation of sending DATA_SM and receiving DATA_SM_RESP.

Parameters:
serviceType - is the service_type.
sourceAddrTon - is the source_addr_ton.
sourceAddrNpi - is the source_addr_npi.
sourceAddr - is the source_addr.
destAddrTon - is the dest_addr_ton.
destAddrNpi - is the dest_addr_npi.
destinationAddr - is the destination_address.
esmClass - is the esm_class.
registeredDelivery - is the registered_delivery.
dataCoding - is the data_coding.
optionalParameters - is the optional parameters.
Returns:
the response/result of DATA_SM.
Throws:
PDUException - if there is invalid PDU parameter found.
ResponseTimeoutException - if timeout has been reached.
InvalidResponseException - if response is invalid.
NegativeResponseException - if negative response received.
java.io.IOException - if there is an I/O error found.

getSessionId

java.lang.String getSessionId()
Get session id.

Returns:
the session id.

setEnquireLinkTimer

void setEnquireLinkTimer(int enquireLinkTimer)

getEnquireLinkTimer

int getEnquireLinkTimer()

setTransactionTimer

void setTransactionTimer(long transactionTimer)

getTransactionTimer

long getTransactionTimer()

getSessionState

SessionState getSessionState()

addSessionStateListener

void addSessionStateListener(SessionStateListener l)

removeSessionStateListener

void removeSessionStateListener(SessionStateListener l)

getLastActivityTimestamp

long getLastActivityTimestamp()
Get the last reading valid PDU from remote host.

Returns:
the last reading valid PDU from remote host.

close

void close()
Forced close connection without sending UNBIND command to Message Center.


unbindAndClose

void unbindAndClose()
Sending UNBIND and close connection immediately.