Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 95993 invoked from network); 23 Jul 2009 21:48:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 23 Jul 2009 21:48:11 -0000 Received: (qmail 96585 invoked by uid 500); 23 Jul 2009 21:49:16 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 96520 invoked by uid 500); 23 Jul 2009 21:49:16 -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 96510 invoked by uid 99); 23 Jul 2009 21:49:16 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Jul 2009 21:49:16 +0000 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 bruce.snyder@gmail.com designates 209.85.218.221 as permitted sender) Received: from [209.85.218.221] (HELO mail-bw0-f221.google.com) (209.85.218.221) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Jul 2009 21:49:05 +0000 Received: by bwz21 with SMTP id 21so1346257bwz.38 for ; Thu, 23 Jul 2009 14:48:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=hhQqiVvEiA4MmIU8oHV55cEpbxht6kAA4T5AAdvjqQk=; b=qF/UGfUMjILsy1pOdLts0ws0AnsgaozB9V+bTiJ9WPxuVmbFjyNP8yhl2DSloBnJRL grFK6N1C+JEHmqJbamnpwfEZX8ixQGjlWnr14Dwt38qnpgSagWQ7gYgFVWBncYN7sBil nPJTkO8Ps4Jue0abPKct3tXTAbgBCrLPMuu/Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=duXB8dkPS6MmdNa0sVuCu0dX8vfqlrzRtnY8pfV/z/RXUzZfr6BYgFNZk88s7naQK/ J5TS2Nd6AMQW4AFiB30WzneIX6xdjvxBwYlAr2s4NmZV+raeUuvhtYpFVn38uXQsRI5y 1oiku3QcIbJCNeXSe9t3yLdyqqjAxtmPwo13c= MIME-Version: 1.0 Received: by 10.223.115.138 with SMTP id i10mr1449173faq.82.1248385724842; Thu, 23 Jul 2009 14:48:44 -0700 (PDT) In-Reply-To: <24634974.post@talk.nabble.com> References: <24634974.post@talk.nabble.com> Date: Thu, 23 Jul 2009 15:48:44 -0600 Message-ID: <7b3355cb0907231448r154f1844x858eebcf6ff9cbe0@mail.gmail.com> Subject: Re: Clearing the message store From: Bruce Snyder To: users@activemq.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org On Thu, Jul 23, 2009 at 3:28 PM, Wxman wrote: > > Hi, > > My app receives messages that are persisted in the ActiveMQ message store= . > This is good except I want to have some control over how many back messag= es > my app receives. =A0Any messages older than a specific time are useless. = =A0I > want ActiveMQ to deliver only the messages since a specific time. =A0In > addition, I want ActiveMQ to only hang on to persisted messages for X hou= rs > before releasing them. =A0How do I do either of these? > > As it is now, it appears ActiveMQ hangs onto them for a very long time, a= nd > when I start my app, it immediately receives an ever-growing number of > messages, which will soon bog down my program... There are a couple of ways to restrict message delivery based on an amount of time: 1) Set the message expiration via the MessageProducer.setTimeToLive() method. This will set the duration of time in milliseconds that a message should be retained by the broker before being expired. Expired messages are not delivered to consumers. 2) Use an eviction policy to dispose of messages in broker. More info on eviction policies is available here: http://activemq.apache.org/slow-consumer-handling.html As far as instructing ActiveMQ to persist messages for a given amount of time, this is not something that's configurable. Persistent messages are held on to by the broker until they're delivered. Upon successful delivery, they are then marked for disposal from the persistent store and are then disposed via a separate thread on a timed interval (IIRC, it runs every five minutes). Bruce --=20 perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=3D6-E+G-N>61E