You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by David Sitsky <si...@nuix.com> on 2008/01/08 06:23:07 UTC

Using FilePendingQueueMessageStoragePolicy for non-persistent messaging

Hi,

I want to use FilePendingQueueMessageStoragePolicy in my application 
since I don't use persistent messaging, but I don't want to be limited 
by memory as to the number of queued messages that are outstanding, 
which for my application might be very large, depending on the data 
being processed.

I did a search, but couldn't find much in the way of setting this up. 
My current code looks roughly follows, and appears to work, but I wanted 
to check with the activemq developers - is it safe/recommended to do this?

Store tmpStore = new KahaStore(tmpStoreDir, "rw");
broker.setTempDataStore(tmpStore);
List<PolicyEntry> policyEntries = new ArrayList<PolicyEntry>();
PolicyEntry entry = new PolicyEntry();
entry.setPendingQueuePolicy(new FilePendingQueueMessageStoragePolicy());
entry.setQueue(WORKER_ITEMS_QUEUE_NAME);
entry.setMemoryLimit(BROKER_MEMORY_LIMIT / 2);
policyEntries.add(entry);
PolicyMap policyMap = new PolicyMap();
policyMap.setPolicyEntries(policyEntries);
broker.setDestinationPolicy(policyMap);

-- 
Cheers,
David

Nuix Pty Ltd
Suite 79, 89 Jones St, Ultimo NSW 2007, Australia    Ph: +61 2 9280 0699
Web: http://www.nuix.com                            Fax: +61 2 9212 6902


Re: Using FilePendingQueueMessageStoragePolicy for non-persistent messaging

Posted by Rob Davies <ra...@gmail.com>.
Hi David,

this looks fine - you can set these properties using the xml  
configuration too btw

cheers,

Rob

On Jan 8, 2008, at 5:23 AM, David Sitsky wrote:

> Hi,
>
> I want to use FilePendingQueueMessageStoragePolicy in my application  
> since I don't use persistent messaging, but I don't want to be  
> limited by memory as to the number of queued messages that are  
> outstanding, which for my application might be very large, depending  
> on the data being processed.
>
> I did a search, but couldn't find much in the way of setting this  
> up. My current code looks roughly follows, and appears to work, but  
> I wanted to check with the activemq developers - is it safe/ 
> recommended to do this?
>
> Store tmpStore = new KahaStore(tmpStoreDir, "rw");
> broker.setTempDataStore(tmpStore);
> List<PolicyEntry> policyEntries = new ArrayList<PolicyEntry>();
> PolicyEntry entry = new PolicyEntry();
> entry.setPendingQueuePolicy(new  
> FilePendingQueueMessageStoragePolicy());
> entry.setQueue(WORKER_ITEMS_QUEUE_NAME);
> entry.setMemoryLimit(BROKER_MEMORY_LIMIT / 2);
> policyEntries.add(entry);
> PolicyMap policyMap = new PolicyMap();
> policyMap.setPolicyEntries(policyEntries);
> broker.setDestinationPolicy(policyMap);
>
> -- 
> Cheers,
> David
>
> Nuix Pty Ltd
> Suite 79, 89 Jones St, Ultimo NSW 2007, Australia    Ph: +61 2 9280  
> 0699
> Web: http://www.nuix.com                            Fax: +61 2 9212  
> 6902
>