Return-Path: X-Original-To: apmail-activemq-users-archive@www.apache.org Delivered-To: apmail-activemq-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 05CFE63A0 for ; Mon, 13 Jun 2011 08:53:32 +0000 (UTC) Received: (qmail 80200 invoked by uid 500); 13 Jun 2011 08:53:31 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 80171 invoked by uid 500); 13 Jun 2011 08:53:31 -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 80163 invoked by uid 99); 13 Jun 2011 08:53:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Jun 2011 08:53:31 +0000 X-ASF-Spam-Status: No, hits=2.0 required=5.0 tests=FREEMAIL_FROM,RFC_ABUSE_POST,SPF_NEUTRAL,T_TO_NO_BRKTS_FREEMAIL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [216.139.236.26] (HELO sam.nabble.com) (216.139.236.26) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Jun 2011 08:53:24 +0000 Received: from joe.nabble.com ([192.168.236.139]) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1QW2tL-0000vJ-A7 for users@activemq.apache.org; Mon, 13 Jun 2011 01:53:03 -0700 Date: Mon, 13 Jun 2011 01:53:03 -0700 (PDT) From: serious To: users@activemq.apache.org Message-ID: <1307955183300-3593408.post@n4.nabble.com> In-Reply-To: References: <1306779732316-3561343.post@n4.nabble.com> <1306834423558-3562643.post@n4.nabble.com> <1306916124022-3565219.post@n4.nabble.com> <1307357596758-3576662.post@n4.nabble.com> Subject: Re: Keeping the messages in a queue or topic during a day MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Thanks a lot Mr Tully, this is the right solution. So, to sum up : - you first have to configure the broker by tweaking its "conf/activemq.xml" configuration file : [code] ... ... [/code] The "recoverDuration" is expressed in ms, so here the duration is 1 hour. - then you should be able to use retroactive consumers (some C#/NMS sample) : [code] string retroactiveTopicName = "tests.retro.test_" + Guid.NewGuid() + ".topic"; ConnectionFactory connectionFactory = new ConnectionFactory("tcp://localhost:61616"); var producerConnection = connectionFactory.CreateConnection(); producerConnection.Start(); var producerSession = (Session)producerConnection.CreateSession(); var producer = producerSession.CreateProducer(); var message = producer.CreateTextMessage("First message!"); producer.Send(producerSession.GetTopic(retroactiveTopicName), message); message = producer.CreateTextMessage("Second message!"); producer.Send(producerSession.GetTopic(retroactiveTopicName), message); var consumerConnection = connectionFactory.CreateConnection(); consumerConnection.Start(); var consumersSession = (Session)consumerConnection.CreateSession(); var retroactiveConsumer = (MessageConsumer)consumersSession.CreateConsumer(consumersSession.GetTopic(retroactiveTopicName + "?consumer.retroactive=true")); retroactiveConsumer.Listener += incomingMessage => { Console.WriteLine("Retroactive consumer in : {0}!", (incomingMessage as ITextMessage).Text); }; var nonRetroactiveConsumer = (MessageConsumer)consumersSession.CreateConsumer(consumersSession.GetTopic(retroactiveTopicName)); nonRetroactiveConsumer.Listener += incomingMessage => { Console.WriteLine("Non retroactive consumer in : {0}!", (incomingMessage as ITextMessage).Text); }; message = producer.CreateTextMessage("Third message!"); producer.Send(producerSession.GetTopic(retroactiveTopicName), message); System.Console.Write("Press enter to exit..."); System.Console.ReadLine(); [/code] Notice the "?consumer.retroactive=true" appended to the name of the topic to make the current consumer retroactive. Only the retroactive consumer should receive the three messages, the other one only the third one. Hopefully this will help somebody else. Thanks all for your precious help. -- View this message in context: http://activemq.2283324.n4.nabble.com/Keeping-the-messages-in-a-queue-or-topic-during-a-day-tp3561343p3593408.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.