NCL Community Forum Index
  Home   Login   Register   Help   Memberlist   Search   NCL  

NCL Community Forum Index » SwiftNote (SMSJDK) Support » Does the Asynchronous Receiver Listener Spawn Threads?
Post new topic  Reply to topic View previous topic :: View next topic 
Does the Asynchronous Receiver Listener Spawn Threads?
PostPosted: Wed Nov 17, 2004 11:11 am Reply with quote
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.
View user's profile Send private message Visit poster's website

PostPosted: Thu Nov 18, 2004 12:30 pm Reply with quote
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.

_________________
Best regards,
The NCL forum team
http://www.ncl.ie
View user's profile Send private message

PostPosted: Thu Nov 18, 2004 3:52 pm Reply with quote
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?
View user's profile Send private message Visit poster's website

Does the Asynchronous Receiver Listener Spawn Threads?
PostPosted: Tue Nov 30, 2004 12:48 pm Reply with quote
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.
View user's profile Send private message

Does the Asynchronous Receiver Listener Spawn Threads?
 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  

  
  
 Post new topic  Reply to topic