On 24/03/2008, Andrew M <[EMAIL PROTECTED]> wrote: > I'm using the method below to create a Topic and Consumer and register my > MessageListener. I'm worried that with a retroactive consumer I'm missing > messages between the .createConsumer() method and when the MessageListener > is actually registered with the MessageConsumer. Shouldn't there be some > way to set the listener before firing up the consumer? > > > > public void subscribe(String destName, MessageListener l) throws > JMSException { > > char c = destName.contains("?")?'&':'?'; > > destName = destName + c + "consumer.retroactive=true"; > > System.out.println("ActiveMqClient subscribe " + destName); > > MessageConsumer mc = session.createConsumer( > session.createTopic(destName) ); > > mc.setMessageListener(l); > > }
Thats the JMS spec for you :) You can create the consumer, then start the connection when everything is all setup to commence delivery. Though the ActiveMQ implementation should buffer up messages inside the consumer until either its setMessageListener() method is called, or a receive*() method is invoked. -- James ------- http://macstrac.blogspot.com/ Open Source Integration http://open.iona.com