| Does the Asynchronous Receiver Listener Spawn Threads? |
Posted: Wed Nov 17, 2004 11:11 am |
|
|
| olutoye |
|
|
 |
| Joined: 17 Nov 2004 |
| Posts: 2 |
| Location: United Kingdom |
|
|
 |
 |
 |
|
As a user of the SMSJDK 2.2, I have a query regarding the Asynchronous Listener Receiver callback interface.
The documentation states that this should be used when an application wants to be notified of messages as they arrive instead of block or poll.
How is this facilitated at run-time? Is a separate execution thread spawned for every message that is received and notified to the listener ?
If extra processing (say, writing to a database table) is performed in the received( ) method, does this affect the non-blocking , non-polling nature of the receiver? If 50 messages are received by the application are all 50 notified to the listener concurrently ?
I guess my concern is whether there is the possibility of messages getting lost when implementing an asynchronous listener.
Any response that can address these concerns will be appreciated. |
|
|
|
|
Posted: Thu Nov 18, 2004 12:30 pm |
|
|
| Administrator |
| Site Admin |
|
 |
| Joined: 11 Aug 2004 |
| Posts: 237 |
|
|
|
 |
 |
 |
|
Notifications are not sent back to the SMSC until the callback returns without error.
The thread that makes the call back is the same thread that reads the 'deliver SMS' notifications from the SMSC from the socket and issues a response. The process is as follows: dispatcher thread reads a 'deliver SMS' from the socket. Decodes message and makes a callback to the application. Application returns from callback. Dispatcher issues an acknowledgement back to the SMSC. And the process begins again.
So if the SMSC connection is lost, then the messages will be redelivered.
NOTE however that it is possible that a message is delivered twice in the event of a connection loss under the following scenario: Dispatcher thread reads a 'deliver SMS' from the socket. Decodes message and makes a callback to the application. Application returns from callback. Dispatcher issues an acknowledgement back to the SMSC but connection is lost and SMSC never gets acknowledgement. On reconnecting, the same SMS is delivered. |
|
|
|
|
Posted: Thu Nov 18, 2004 3:52 pm |
|
|
| olutoye |
|
|
 |
| Joined: 17 Nov 2004 |
| Posts: 2 |
| Location: United Kingdom |
|
|
 |
 |
 |
|
Ok so this talks about the processing of a callback, not the processing of multiple messages.
How are 50 concurrent messages arriving at the SMSc handled?
If my understanding is correct then it appears that each message is on a different socket and thread and therefore each callback is also on a different thread.
Is my understanding correct? |
|
|
|
|
| Does the Asynchronous Receiver Listener Spawn Threads? |
Posted: Tue Nov 30, 2004 12:48 pm |
|
|
| Administrator |
| Site Admin |
|
 |
| Joined: 11 Aug 2004 |
| Posts: 237 |
|
|
|
 |
 |
 |
|
There is one thread processing incoming messages for each SMSC connection. If you have one active connection to the SMSc then your 50 messages will be processed one after the other on a single thread.
Each message will not be on a different socket unless you open multiple sockets. Threads are not spawned per-message received. |
|
|
|
|
| NCL Community Forum Index » SwiftNote (SMSJDK) Support |
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
All times are GMT
Page 1 of 1
|
|
|
|
|
|
|
|
|