Ivan, thanks for your reply.

I tried setting a higher prefetch size as described in <
http://activemq.apache.org/what-is-the-prefetch-limit-for.html>. Here's my
code:


Queue queue = session.createQueue(queueName + "?consumer.prefetchSize=" +
messagesCount + "&consumer.maximumPendingMessageLimit=" + messagesCount);
MessageConsumer consumer = session.createConsumer(queue);

messagesCount is (you won't imagine :) ) the amount of queued messages. I
tested it and it's OK (has 10k messages).

I first tried setting only prefetchSize, then saw the
maximumPendingMessageLimit while inspecting MessageConsumer and tried to set
it too. It still doesn't work.


Any other guess?


I'm thinking of sending messages ack and using some temporal queue as backup
for not loosing messages as an alternative...

On Fri, Aug 19, 2011 at 2:12 PM, Ivan Pechorin <ivan.pecho...@gmail.com>wrote:

> It seems like you hit prefetch limit (the default prefetch size is
> 1000). Try setting prefetch size to something larger for the
> particular connection or consumer used by your 'queue sorter'.
>
> On 8/19/11, Matías García Isaía <mis...@keepcon.com> wrote:
> > Hi all...
> >
> > Another one here trying to implement kind-of-a-stack with an ActiveMQ
> queue.
> >
> > I've allready read about using Camel's resequencer, but didn't seem to
> help
> > too much.
> >
> >
> > What I need is to periodically sort a queue, so the messages get sorted
> from
> > newer to oldest. But they still have to be in the same queue.
> >
> >
> > Implementing a Camel route didn't work, because Camel will consume the
> > messages and retain them until it complete's its timeout or message count
> > limit, and then will send the messages to the queue, at the bottom of it.
> It
> > could probably work if it had some kind "sleep time" between each
> resquence
> > (say, resequence all queue, then send back messages, and sleep for, say,
> a
> > couple of hours, and then resequencing again), but I couldn't find out
> how
> > to do that.
> >
> >
> > Since we use Mule ESB, I tried to implement a quartz job that consumes
> all
> > messages in the queue, sort them, and send them back in order. It seemed
> to
> > be a good approach, but it had the risk of loosing messages if Mule went
> > down while resorting, so decided to use ackwnoldeged session.
> >
> > I consume all messages, sort them, and then send them back one by one,
> > sending individual ack for each message sent. It should be a secure way
> to
> > do this, but it doesn't seem to scale too much: testing, just 2500
> messages
> > out of 10k are being read. I think there would be some ActiveMQ
> limitation
> > about having too many blocked messages, but I'm not sure neither...
> >
> >
> > Apart from expecting a queue provider to work like a stack, what am I
> doing
> > wrong? What else could I try? Any ideas or suggestions will help
> >
> >
> > Thanks for reading :)
> >
>
> --
> Sent from my mobile device
>

Reply via email to