On Wed, Feb 18, 2009 at 2:19 PM, Rafael Schloming <[email protected]> wrote: > Rajith Attapattu wrote: >> >> Aidan, >> >> I came across this when I wrote a simple test to figure out another issue. >> Basically I did the following. >> >> create connection >> start the connection >> create a session >> create a destination, using that create a MC and a MP. >> set a MessageListener to the MC. >> send messages using MP. >> >> When the session tries to deliever the messages it throws an >> IllegalStateException as the dispatcher thread is null. >> >> Let me create a JIRA and then attach the test case and the stack trace. > > Strictly speaking I believe the JMS api-doc says that the behavior in the > above scenario is undefined. From the api-doc: > > "The effect of calling MessageConsumer.setMessageListener while messages > are being consumed by an existing listener or the consumer is being used to > consume messages synchronously is undefined." > > I think this means that throwing an IllegalStateException is valid, however > that doesn't mean we can't do something a bit more graceful if we want to.
Rafi, the important point here is that when the message listener is set there is no existing listener or a synchronous receive in progress. In other words you haven't yet used the Message Consumer to receive messages synchronously or asynchronously. But the message consumer is created only after connection.start is called. So I guess what you are saying is that after connection.start is called any message consumer created will be interepreted as consuming messages synchronously ? Did I understand you correctly? Regards, Rajith > > --Rafael > > > --------------------------------------------------------------------- > Apache Qpid - AMQP Messaging Implementation > Project: http://qpid.apache.org > Use/Interact: mailto:[email protected] > > -- Regards, Rajith Attapattu Red Hat http://rajith.2rlabs.com/ --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:[email protected]
