An interface for objects that receive push-style notification of new messages that are sent or published by a message service.
A listener object can be registered with the message service using the addListener operation.
Process a message. If onMessage returns successfully,
the message will be automatically acknowledged. If the onMessage
operation is transactional, and it throws a
system exception, the message will be redelivered indefinitely until
onMessage returns successfully. If the onMessage
operation is non-transactional, and it throws a
system exception, the message will be discarded.
void onMessage
(
in CtsComponents::Message msg
);
Example:
public void onMessage(Message msg)
{
// process the message...
// reply to sender if requested
if (! msg.replyTo.equals(""))
{
Message reply = new Message();
reply.text = "Received message: " + msg.text;
cms.send(msg.replyTo, reply, 0);
}
}