8.6. Asynchronous processing

MQSeries JMS provides the much-awaited MessageListener interface. Using the message listener facility, a client can register a listener object with a message consumer. When a message arrives for the consumer, it is delivered by to the client by calling its onMessage method.

This is an alternative to using the other approaches such as triggers, making receive or subscribe calls with the wait or polling mechanism in the application code to check for new messages or subscriptions. When using asynchronous delivery mode with the listener, the entire session associated with the message consumer is marked asynchronous. The same session cannot be used for making any explicit receive calls.

In asynchronous message delivery, ...

Get MQSeries Programming Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.