rabbitmq - Is it possible to get a "push" when number of messages reaches threshold? -
i want check
- what best practice number of messages in queue. know can via queue.getmessagecount() know can monitor plugin gets it. http request? or rabbitmqctl application.(jni?) ? best way if want react when x messages arrive?
- and more important - can number of messages in queue via push?
can declare threshold receive push notification? (e.g. signal every time have 5000 messages)
you use queue x-max-length
http://www.rabbitmq.com/maxlength.html
queue length measure takes account ready messages, ignoring unacknowledged messages , message size. messages dropped or dead-lettered front of queue make room new messages once limit reached.
so can configure dead letter exchanges , manage messages rejected limit exceeded.
the reason name describing why message dead-lettered , 1 of following: rejected - message rejected requeue=false, expired - ttl of message expired; or maxlen - maximum allowed queue length exceeded.
i hope helps
edit**
the idea be:
subscribe queue example _queue
on dle when message arrives means reached.
void hanlemymessage(msg){ ..... } //// consumer _queue public void handledelivery(string consumertag, envelope envelope, basicproperties properties, byte[] body) throws java.io.ioexception { mymessage m= new mymessage(body) voidhanlemymessage(m) startmybulkconsumer() }
now can start work_consumer
.
//// consumer work_queue public void handledelivery(string consumertag, envelope envelope, basicproperties properties, byte[] body) throws java.io.ioexception { mymessage m= new mymessage(body) voidhanlemymessage(m) if (msgcount.addandget()==mythreshold){ closeconsumer() }
this 1 solution.
actually think logic should delegated application: example work_consumer
running , application trigger bulk function when reaches .
Comments
Post a Comment