The result of calling the setMessageListener method of MessageConsumer while messages are being consumed by an existing listener or the consumer is being used to consume messages synchronously is undefined.

The result of calling the setMessageListener method of MessageConsumer while messages are being consumed by an existing listener or the consumer is being used to consume messages synchronously is undefined.

book

Article ID: KB0089260

calendar_today

Updated On:

Products Versions
TIBCO Enterprise Message Service -
Not Applicable -

Description

Resolution:
MessageConsumer.setMessageListener() is the method that enables asynchronous message consuming in the JMS API.

The JMS 1.1 specification has documented that "The result of calling setMessageListener method of MessageConsumer while messages are being consumed by an existing listener or the consumer is being used to consume messages synchronously is undefined". In EMS, doing so will cause message delivery to fail.

Considering the following scenario:

1). Initially MessageConsumer.setMessageListener() has been called and messages are consumed.

2). Calling setMessageListener(null) from within the onMessage() callback will suspend message delivery.

3). Call setMessageListener(messageListener) to set back the MessageListener in hope that message delivery will continue.

We have observed that if several clients that share the same session conduct the same operations as above, the message delivery will cease for all those clients after step 3).

Note that this behavior is conforming to the JMS specification. To avoid this issue, you should not call setMessageListener() on a specific MessageConsumer more than once. 

Issue/Introduction

The result of calling the setMessageListener method of MessageConsumer while messages are being consumed by an existing listener or the consumer is being used to consume messages synchronously is undefined.

Additional Information

JMS Spec 1.1