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 :)