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

Reply via email to