From users-return-13218-apmail-activemq-users-archive=activemq.apache.org@activemq.apache.org Tue Mar 18 17:20:47 2008 Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 75897 invoked from network); 18 Mar 2008 17:20:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 Mar 2008 17:20:47 -0000 Received: (qmail 15257 invoked by uid 500); 18 Mar 2008 17:20:45 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 14920 invoked by uid 500); 18 Mar 2008 17:20:44 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 14911 invoked by uid 99); 18 Mar 2008 17:20:44 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Mar 2008 10:20:44 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of andrew@oc384.net designates 204.80.187.5 as permitted sender) Received: from [204.80.187.5] (HELO mail1.ykwc.com) (204.80.187.5) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Mar 2008 17:19:53 +0000 Received: from box2 (brandtllc.com [66.17.204.66]) by mail1.ykwc.com (Postfix) with ESMTPA id 6A2D4AB4A3 for ; Tue, 18 Mar 2008 10:20:06 -0700 (PDT) From: "Andrew M" To: References: <03be01c87e33$1b098620$511c9260$@net> <046f01c87ed8$7313c3d0$593b4b70$@net> <04cd01c87f01$211fb4c0$635f1e40$@net> <016701c880a7$aa061c00$fe125400$@net> <02b701c88903$489cec50$d9d6c4f0$@net> <74e15baa0803180807h72d975bsf20b9a90d5509eac@mail.gmail.com> In-Reply-To: <74e15baa0803180807h72d975bsf20b9a90d5509eac@mail.gmail.com> Subject: RE: Retroactive consumer...yes, no, maybe so? Date: Tue, 18 Mar 2008 12:19:49 -0500 Message-ID: <02de01c8891c$45e27de0$d1a779a0$@net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AciJCsi0PUNZJB0ER7qEuwZjYRIZMQAERhKQ Content-Language: en-us X-YKWC-MailScanner-Information: Please contact Yellowknife for more information X-MailScanner-ID: 6A2D4AB4A3.2C29C X-YKWC-MailScanner: Found to be clean X-YKWC-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-4.399, required 5, autolearn=not spam, ALL_TRUSTED -1.80, BAYES_00 -2.60) X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No Aaron, My original producer and consumer code are at the bottom of the msg. Note the subscribe method appends retroactive=true. Thanks for any suggestions you may have.. Andrew -----Original Message----- From: ammulder@gmail.com [mailto:ammulder@gmail.com] On Behalf Of Aaron Mulder Sent: Tuesday, March 18, 2008 10:07 AM To: users@activemq.apache.org Subject: Re: Retroactive consumer...yes, no, maybe so? Do you want to post your example that's *not* working? I last used retroactive consumers probably 18 months ago, and they worked fine at that time. I was doing a network of brokers with fail-over, and if I took one broker down and caused a consumer to fail over, it missed messages during the fail-over operation. With retroactive consumer enabled, it didn't miss any messages (but got some duplicates) once it failed over. I don't have that code/configuration at hand, though -- just this from my notes: topic = new ActiveMQTopic("com.example.MyTopic?consumer.retroactive=true"); And I used this to set the retroactive consumers to receive the last 30s worth of messages, instead of the default (which I think at the time was last 100): http://www.activemq.org/site/retroactive-consumer.html http://www.activemq.org/site/subscription-recovery-policy.html Thanks, Aaron On Tue, Mar 18, 2008 at 10:20 AM, Andrew M wrote: > > -----Original Message----- > From: Andrew [mailto:andrew@oc384.net] > Sent: Wednesday, March 05, 2008 2:40 PM > To: users@activemq.apache.org > Subject: Retroactive consumer not working... > > 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); > } > >