activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stan Lewis <>
Subject Re: Persistence without spooling, memory limit, eviction policies
Date Sat, 11 Dec 2010 14:21:01 GMT
You probably need to turn off producer flow control and then also
enable sendFailIfNoSpace or sendFailIfNoSpaceAfterTimeout, there's a
bunch of information here:

On Sat, Dec 11, 2010 at 6:52 AM, Roberto Cappa <> wrote:
> Hi,
> I'm evaluating the possibility to use ActiveMQ in my project to manage a
> persistent queue. I've done some tests, but I've encountered some issues.
> These are my requirements:
> - All queues in my broker must be persistent, because I cannot loose pending
> messages if the system goes down. This is the code, and it is ok, it works:
> BrokerService jmsBroker = new BrokerService();
> jmsBroker.setPersistent(true);
> - I've to set a memory (or messages number) limit, in order to prevent too
> high memory usage by the queue on my VM. This is the code:
> List<PolicyEntry> entries = new ArrayList<PolicyEntry>();
> PolicyEntry conf = new PolicyEntry();
> conf.setMemoryLimit(5000000);
> conf.setQueue("myQueue");
> entries.add(conf);
> policyMap.setPolicyEntries(entries);
> jmsBroker.setDestinationPolicy(policyMap);
> This is the first problem: if setPersistent(false) it works, but if
> setPersistent(true) the broker ignores the memory limit, when the memory is
> full starts spooling to disk. It is an undesired behavior, persistence and
> spooling are two logical separate concepts.  Is there a way to set a memory
> limit and persistence without enabling spooling?
> - When the memory limit is reached, by default the producer is blocked (if
> persistence is false) or slowed (if persistence is true). There are two
> undesired behaviors, my producer cannot be blocked or slowed by the queue (I
> think it is a typical asynchronous scenario). If the queue is full, I can
> choose two options, both valid for my requirements:
>    - Throwing an exception in producer code, so I can take actions in case
> of full queue.
>    - Discard oldest messages from the queue, accepting the new ones from
> the producer, without blocking.
> For the first scenario, I haven't found any suitable configuration on
> ActiveMQ.
> For the secondo scenario, I've tryed with this code:
> OldestMessageEvictionStrategy strategy = new
> OldestMessageEvictionStrategy();
> conf.setMessageEvictionStrategy(strategy);
> ...
> But it seems to be completely ignored. Any idea?
> Thanks.

Stan Lewis
Twitter: gashcrumb

View raw message