2009/2/19 Rafael Schloming <[email protected]>: > David Ingham wrote: >> >> Hi Rafael, >> >> I think that the spec extract that you quote is addressing a different >> issue from how I understood Rajith's original ask. > > It's actually from the javadoc for MessageConsumer.setMessageListener(), not > the spec. I wouldn't be surprised if the spec had more explicit language on > this subject. > >> I believe that the extract you quote below is talking about what happens >> when I consume messages via different routes from the same MessageConsumer. >> That is, if I set MessageListener, ML1, on MessageConsumer, MC, and I then I >> also receive messages synchronously by calling MC.receive() or I set another >> MessageListener with MC.setMessageListener(ML2) then I think the spec is >> saying that the behavior is undefined, i.e., how messages are distributed >> between ML1, ML2 and the synchronous receives is undefined. >> I interpreted the original description as something different, namely I >> create a Connection, create a Session, start the Connection and then create >> a MessageConsumer with a MessageListener, i.e., the connection had no >> MessageListeners at the time it was started and then they were latterly >> added. My previous statement was that I believe that this sequence of events >> is legitimate and these new MessageListeners should begin to receive >> messages. I interpreted Rajith's original mail as saying that the >> implementation didn't do this and I would classify that as a bug. > > That may be a reasonable interpretation as well. I guess it depends on what > the term "undefined" applies to, i.e. the method semantics vs the > distribution behavior. > > In any case it doesn't seem unreasonable to make the example work. I would > just caution against putting it forward as an example of a good pattern to > follow. > > --Rafael > > --------------------------------------------------------------------- > Apache Qpid - AMQP Messaging Implementation > Project: http://qpid.apache.org > Use/Interact: mailto:[email protected] >
The JMS spec only requires you to stop the connection if you want to change message listeners. You can set a new one at any time. We already have a QpidTestCase for this scenario. MesasgeListenerTest.testReceiveThenUseMessageListener This starts a connection calls recieve() then swaps to a message listener. for the remainder of the messages. Have you tried this test? Is your test doing something different. -- Martin Ritchie --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:[email protected]
