Asynchronous message delivery
XMS uses
one thread to handle all asynchronous message deliveries for a session.
This means that only one message listener function or one onMessage()
method
can run at a time.
If more than one message consumer in a session is receiving messages
asynchronously, and a message listener function or onMessage()
method
is delivering a message to a message consumer, then any other message
consumers that are waiting for the same message must continue to wait.
Other messages that are waiting to be delivered to the session must
also continue to wait.
If an application requires concurrent delivery of messages, create
more than one session so that XMS uses more than one
thread to handle asynchronous message delivery. In this way, more
than one message listener function or onMessage()
method
can run concurrently.
A session is not made asynchronous by assigning a message listener
to a consumer. A session becomes asynchronous only when the Connection.Start
method
is called. All synchronous calls are permitted until the Connection.Start
method
is called. Message delivery to consumers start when the Connection.Start
is
called.
If synchronous calls, such as creation of a consumer or producer,
must be made on an asynchronous session, the Connection.Stop
must
be called. A session can be resumed by calling the Connection.Start
method
to start delivery of messages. The only exception to this is the Session
message delivery thread, which is the thread that delivers messages
to the callback function. This thread can to make any call on session
(except a Close call) in the message callback function.
MessageListener
method.