My broker is not feeding my consumer the messages from the retroactive queue when the consumer connects. The producer puts in a 10 min (600000ms) TTL so I would think when my consumer reconnects it should receive the last 10 mins of msgs. Otherwise things appear fine, new msgs are received, etc... any ideas?
On the producer....... private Session getActiveMqSession() throws JMSException { String url = "failover:(tcp://" + ACTIVE_MQ_SERVER + ":" + ACTIVE_MQ_PORT + "?wireFormat.maxInactivityDuration=0)?maxReconnectAttempts=0"; ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(url); connection = connectionFactory.createConnection(); ((ActiveMQConnection)connection).setUseAsyncSend(false); connection.start(); return connection.createSession(false, Session.SESSION_TRANSACTED); } Session session = getActiveMqSession(); void send(Object a) throws blah blah blah { Destination destination = session.createQueue(consumerName); producer = session.createProducer(destination); ObjectMessage m = session.createObjectMessage(); m.setObject(a); //10 min TTL ((ActiveMQMessageProducer)producer).send(m, DeliveryMode.PERSISTENT, Message.DEFAULT_PRIORITY, 600000L); } ...and on the Consumer... Session session; public void run() { String url = "failover:(tcp://tupolev:61616?wireFormat.maxInactivityDuration=0)?maxReconn ectAttempts=0"; ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(url); Connection connection = connectionFactory.createConnection(); connection.start(); connection.setExceptionListener(this); session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); } public void subscribe(String destName, MessageListener l) throws JMSException { destName = destName + "?consumer.retroactive=true"; MessageConsumer mc = session.createConsumer(session.createQueue(destName)); mc.setMessageListener(l); } -----Original Message----- From: Andrew [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 05, 2008 9:49 AM To: users@activemq.apache.org Subject: RE: purging an ActiveMQ queue Thanks I'll create it as retroactive. Problem is, how can I tell the broker to purge the msgs at midnight so I get only msgs from the current day? Would I just schedule a messageConsumer.close() ? Thanks, Andrew -----Original Message----- From: James Strachan [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 05, 2008 12:17 AM To: users@activemq.apache.org Subject: Re: purging an ActiveMQ queue On 04/03/2008, Andrew <[EMAIL PROTECTED]> wrote: > I would like to set up a topic or queue so that when a client connects to > the broker and subscribes to that topic he receives a refresh of all the > messages sent so far on that topic that day. At midnight the broker should > purge the day's messages. What's the best way to do that? For queues, messages stay on a queue until they expire. For topics, normally you only get messages sent after you start subscribing (unless you use persistent topic subscriptions) though ActiveMQ supports Subscription Recovery for this kinda stuff... http://activemq.apache.org/subscription-recovery-policy.html -- James ------- http://macstrac.blogspot.com/ Open Source Integration http://open.iona.com