Getting outstanding message count / queue empty status

89 views
Skip to first unread message

jixigg

unread,
Oct 17, 2013, 4:31:07 AM10/17/13
to stom...@googlegroups.com
Hi,

I'm attempting to create a setup where a client receives a massive number of messages from a broker, and I'm trying to poll with a separate process when the queue reaches 0 unreceived messages (Or, equally, is empty).

Does ActiveMQ provide a mechanism to do this? My first attempt was to have the separate process subscribe to the queue and then loop through canRead(), but this appears to apply only to the messages that particular process has received, not the overarching queue status.

Again, importantly, the receiver is happy to just keep consuming, only the separate process cares about it finally gobbling everything down at that particular moment.


Thanks,
--Josh
MS CS

nikipore

unread,
Oct 20, 2013, 4:54:03 AM10/20/13
to stom...@googlegroups.com
This question is related to ActiveMQ rather than to STOMP or stompest, but let me try to answer this.

You wish to have more than one consumer for a message. I understand that you want only one process to really consume the message, but from a client perspective there is no such thing as peeking without consuming. You can peek by receiving and nacking a frame, but this is not going to work in your setup because the "serious" consumer will not let your monitor process know about "its" messages.

You can proceed in different directions:

1. switch to a topic, maybe even a persistent one
2. let the consumer send a message to some 3rd party topic about the queue status
3. install a server-side camel route; the broker has full knowledge about all messages without having to consume them

Option 3 binds you to the broker implementation, so this should be the last resort.
Reply all
Reply to author
Forward
0 new messages