public class SMPPSession extends AbstractSession implements ClientSession
SMPPClient
implementation give
ability to the asynchronous way by executing the SUBMIT_SM operation parallel
on a different thread. The very simple implementation by using Thread pool,
ExecutorService
will do.
To receive the incoming message such as DELIVER_SM or DATA_SM will be managed
by internal thread. User code only have to set listener
MessageReceiverListener
.Constructor and Description |
---|
SMPPSession()
Default constructor of
SMPPSession . |
SMPPSession(PDUSender pduSender,
PDUReader pduReader,
ConnectionFactory connFactory) |
SMPPSession(java.lang.String host,
int port,
BindParameter bindParam) |
SMPPSession(java.lang.String host,
int port,
BindParameter bindParam,
PDUSender pduSender,
PDUReader pduReader,
ConnectionFactory connFactory) |
Modifier and Type | Method and Description |
---|---|
void |
cancelShortMessage(java.lang.String serviceType,
java.lang.String messageId,
TypeOfNumber sourceAddrTon,
NumberingPlanIndicator sourceAddrNpi,
java.lang.String sourceAddr,
TypeOfNumber destAddrTon,
NumberingPlanIndicator destAddrNpi,
java.lang.String destinationAddress)
Cancel the previous submitted short message.
|
java.lang.String |
connectAndBind(java.lang.String host,
int port,
BindParameter bindParam)
Open connection and bind immediately.
|
java.lang.String |
connectAndBind(java.lang.String host,
int port,
BindParameter bindParam,
long timeout)
Open connection and bind immediately.
|
void |
connectAndBind(java.lang.String host,
int port,
BindType bindType,
java.lang.String systemId,
java.lang.String password,
java.lang.String systemType,
TypeOfNumber addrTon,
NumberingPlanIndicator addrNpi,
java.lang.String addressRange)
Open connection and bind immediately.
|
void |
connectAndBind(java.lang.String host,
int port,
BindType bindType,
java.lang.String systemId,
java.lang.String password,
java.lang.String systemType,
TypeOfNumber addrTon,
NumberingPlanIndicator addrNpi,
java.lang.String addressRange,
long timeout)
Open connection and bind immediately with specified timeout.
|
protected Connection |
connection() |
protected void |
finalize() |
MessageReceiverListener |
getMessageReceiverListener() |
protected GenericMessageReceiverListener |
messageReceiverListener() |
QuerySmResult |
queryShortMessage(java.lang.String messageId,
TypeOfNumber sourceAddrTon,
NumberingPlanIndicator sourceAddrNpi,
java.lang.String sourceAddr)
Query previous submitted short message based on it's message_id and
message_id.
|
void |
replaceShortMessage(java.lang.String messageId,
TypeOfNumber sourceAddrTon,
NumberingPlanIndicator sourceAddrNpi,
java.lang.String sourceAddr,
java.lang.String scheduleDeliveryTime,
java.lang.String validityPeriod,
RegisteredDelivery registeredDelivery,
byte smDefaultMsgId,
byte[] shortMessage)
Replace the previous submitted short message.
|
protected AbstractSessionContext |
sessionContext() |
void |
setMessageReceiverListener(MessageReceiverListener messageReceiverListener) |
SubmitMultiResult |
submitMultiple(java.lang.String serviceType,
TypeOfNumber sourceAddrTon,
NumberingPlanIndicator sourceAddrNpi,
java.lang.String sourceAddr,
Address[] destinationAddresses,
ESMClass esmClass,
byte protocolId,
byte priorityFlag,
java.lang.String scheduleDeliveryTime,
java.lang.String validityPeriod,
RegisteredDelivery registeredDelivery,
ReplaceIfPresentFlag replaceIfPresentFlag,
DataCoding dataCoding,
byte smDefaultMsgId,
byte[] shortMessage,
OptionalParameter[] optionalParameters)
Submit short message to multiple destination address.
|
java.lang.String |
submitShortMessage(java.lang.String serviceType,
TypeOfNumber sourceAddrTon,
NumberingPlanIndicator sourceAddrNpi,
java.lang.String sourceAddr,
TypeOfNumber destAddrTon,
NumberingPlanIndicator destAddrNpi,
java.lang.String destinationAddr,
ESMClass esmClass,
byte protocolId,
byte priorityFlag,
java.lang.String scheduleDeliveryTime,
java.lang.String validityPeriod,
RegisteredDelivery registeredDelivery,
byte replaceIfPresentFlag,
DataCoding dataCoding,
byte smDefaultMsgId,
byte[] shortMessage,
OptionalParameter... optionalParameters)
Submit a short message to specified destination address.
|
addSessionStateListener, close, dataShortMessage, executeSendCommand, fireAcceptDataSm, getEnquireLinkTimer, getLastActivityTimestamp, getPduProcessorDegree, getSessionId, getSessionState, getTransactionTimer, pduSender, removePendingResponse, removeSessionStateListener, sendEnquireLink, sequence, setEnquireLinkTimer, setPduProcessorDegree, setTransactionTimer, unbindAndClose
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addSessionStateListener, close, dataShortMessage, getEnquireLinkTimer, getLastActivityTimestamp, getSessionId, getSessionState, getTransactionTimer, removeSessionStateListener, setEnquireLinkTimer, setTransactionTimer, unbindAndClose
public SMPPSession()
SMPPSession
. The next action might be
connect and bind to a destination message center.public SMPPSession(PDUSender pduSender, PDUReader pduReader, ConnectionFactory connFactory)
public SMPPSession(java.lang.String host, int port, BindParameter bindParam, PDUSender pduSender, PDUReader pduReader, ConnectionFactory connFactory) throws java.io.IOException
java.io.IOException
public SMPPSession(java.lang.String host, int port, BindParameter bindParam) throws java.io.IOException
java.io.IOException
public void connectAndBind(java.lang.String host, int port, BindType bindType, java.lang.String systemId, java.lang.String password, java.lang.String systemType, TypeOfNumber addrTon, NumberingPlanIndicator addrNpi, java.lang.String addressRange) throws java.io.IOException
host
- is the SMSC host address.port
- is the SMSC listen port.bindType
- is the bind type.systemId
- is the system id.password
- is the password.systemType
- is the system type.addrTon
- is the address TON.addrNpi
- is the address NPI.addressRange
- is the address range.java.io.IOException
- if there is an IO error found.public void connectAndBind(java.lang.String host, int port, BindType bindType, java.lang.String systemId, java.lang.String password, java.lang.String systemType, TypeOfNumber addrTon, NumberingPlanIndicator addrNpi, java.lang.String addressRange, long timeout) throws java.io.IOException
host
- is the SMSC host address.port
- is the SMSC listen port.bindType
- is the bind type.systemId
- is the system id.password
- is the password.systemType
- is the system type.addrTon
- is the address TON.addrNpi
- is the address NPI.addressRange
- is the address range.timeout
- is the timeout.java.io.IOException
- if there is an IO error found.public java.lang.String connectAndBind(java.lang.String host, int port, BindParameter bindParam) throws java.io.IOException
host
- is the SMSC host address.port
- is the SMSC listen port.bindParam
- is the bind parameters.java.io.IOException
- if there is an IO error found.public java.lang.String connectAndBind(java.lang.String host, int port, BindParameter bindParam, long timeout) throws java.io.IOException
host
- is the SMSC host address.port
- is the SMSC listen port.bindParam
- is the bind parameters.timeout
- is the timeout.java.io.IOException
- if there is an IO error found.public java.lang.String submitShortMessage(java.lang.String serviceType, TypeOfNumber sourceAddrTon, NumberingPlanIndicator sourceAddrNpi, java.lang.String sourceAddr, TypeOfNumber destAddrTon, NumberingPlanIndicator destAddrNpi, java.lang.String destinationAddr, ESMClass esmClass, byte protocolId, byte priorityFlag, java.lang.String scheduleDeliveryTime, java.lang.String validityPeriod, RegisteredDelivery registeredDelivery, byte replaceIfPresentFlag, DataCoding dataCoding, byte smDefaultMsgId, byte[] shortMessage, OptionalParameter... optionalParameters) throws PDUException, ResponseTimeoutException, InvalidResponseException, NegativeResponseException, java.io.IOException
ClientSession
submitShortMessage
in interface ClientSession
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_addr.esmClass
- is the esm_class.protocolId
- is the protocol_id.priorityFlag
- is the priority_flag.scheduleDeliveryTime
- is the schedule_delivery_time.validityPeriod
- is the validity_period.registeredDelivery
- is the registered_delivery.replaceIfPresentFlag
- is the replace_if_present_flag.dataCoding
- is the data_coding.smDefaultMsgId
- is the sm_default_msg_id.shortMessage
- is the short_message.optionalParameters
- is the optional parameters.PDUException
- if there is invalid PDU parameter found..ResponseTimeoutException
- if timeout has been reach.InvalidResponseException
- if response is invalid.NegativeResponseException
- if negative response received.java.io.IOException
- if there is an I/O error found.public SubmitMultiResult submitMultiple(java.lang.String serviceType, TypeOfNumber sourceAddrTon, NumberingPlanIndicator sourceAddrNpi, java.lang.String sourceAddr, Address[] destinationAddresses, ESMClass esmClass, byte protocolId, byte priorityFlag, java.lang.String scheduleDeliveryTime, java.lang.String validityPeriod, RegisteredDelivery registeredDelivery, ReplaceIfPresentFlag replaceIfPresentFlag, DataCoding dataCoding, byte smDefaultMsgId, byte[] shortMessage, OptionalParameter[] optionalParameters) throws PDUException, ResponseTimeoutException, InvalidResponseException, NegativeResponseException, java.io.IOException
ClientSession
submitMultiple
in interface ClientSession
serviceType
- is the service_type.sourceAddrTon
- is the source_addr_ton.sourceAddrNpi
- is the source_addr_npi.sourceAddr
- is the source_addr.destinationAddresses
- is the destination addresses.esmClass
- is the esm_class.protocolId
- is the protocol_id.priorityFlag
- is the priority_flag.scheduleDeliveryTime
- is the schedule_delivery_time.validityPeriod
- is the validity_period.registeredDelivery
- is the registered_delivery.replaceIfPresentFlag
- is the replace_if_present_flag.dataCoding
- is the data_coding.smDefaultMsgId
- is the sm_default_msg_id.shortMessage
- is the short_message.optionalParameters
- is the optional parameters.PDUException
- if there is invalid PDU parameter found.ResponseTimeoutException
- if timeout has been reach.InvalidResponseException
- if response is invalid.NegativeResponseException
- if negative response received.java.io.IOException
- if there is an I/O error found.public QuerySmResult queryShortMessage(java.lang.String messageId, TypeOfNumber sourceAddrTon, NumberingPlanIndicator sourceAddrNpi, java.lang.String sourceAddr) throws PDUException, ResponseTimeoutException, InvalidResponseException, NegativeResponseException, java.io.IOException
ClientSession
queryShortMessage
in interface ClientSession
messageId
- is the message_id.sourceAddrTon
- is the source_addr_ton.sourceAddrNpi
- is the source_addr_npi.sourceAddr
- is the source_addr.PDUException
- if there is invalid PDU parameter found.ResponseTimeoutException
- if timeout has been reach.InvalidResponseException
- if response is invalid.NegativeResponseException
- if negative response received.java.io.IOException
- if there is an I/O error found.public void replaceShortMessage(java.lang.String messageId, TypeOfNumber sourceAddrTon, NumberingPlanIndicator sourceAddrNpi, java.lang.String sourceAddr, java.lang.String scheduleDeliveryTime, java.lang.String validityPeriod, RegisteredDelivery registeredDelivery, byte smDefaultMsgId, byte[] shortMessage) throws PDUException, ResponseTimeoutException, InvalidResponseException, NegativeResponseException, java.io.IOException
ClientSession
replaceShortMessage
in interface ClientSession
messageId
- is the message_id.sourceAddrTon
- is the source_addr_ton.sourceAddrNpi
- is the source_addr_npi.sourceAddr
- is the source_addr.scheduleDeliveryTime
- is the schedule_delivery_time.validityPeriod
- is the validity_period.registeredDelivery
- is the registered_delivery.smDefaultMsgId
- is the sm_default_msg_id.shortMessage
- is the short_message.PDUException
- if there is invalid PDU parameter found.ResponseTimeoutException
- if timeout has been reach.InvalidResponseException
- if response is invalid.NegativeResponseException
- if negative response received.java.io.IOException
- if there is an I/O error found.public void cancelShortMessage(java.lang.String serviceType, java.lang.String messageId, TypeOfNumber sourceAddrTon, NumberingPlanIndicator sourceAddrNpi, java.lang.String sourceAddr, TypeOfNumber destAddrTon, NumberingPlanIndicator destAddrNpi, java.lang.String destinationAddress) throws PDUException, ResponseTimeoutException, InvalidResponseException, NegativeResponseException, java.io.IOException
ClientSession
cancelShortMessage
in interface ClientSession
serviceType
- is the service_type.messageId
- is the message_id.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.destinationAddress
- is destination_address.PDUException
- if there is invalid PDU parameter found.ResponseTimeoutException
- if timeout has been reach.InvalidResponseException
- if response is invalid.NegativeResponseException
- if negative response received.java.io.IOException
- if there is an I/O error found.public MessageReceiverListener getMessageReceiverListener()
public void setMessageReceiverListener(MessageReceiverListener messageReceiverListener)
protected Connection connection()
connection
in class AbstractSession
protected AbstractSessionContext sessionContext()
sessionContext
in class AbstractSession
protected GenericMessageReceiverListener messageReceiverListener()
messageReceiverListener
in class AbstractSession
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable