I want to check
Can I declare a threshold to receive a push notification? (e.g. get a signal every time I have 5000 messages)
you could use queue x-max-length
http://www.rabbitmq.com/maxlength.html
Queue length is a measure that takes into account ready messages, ignoring unacknowledged messages and message size. Messages will be dropped or dead-lettered from the front of the queue to make room for new messages once the limit is reached.
So you can configure the Dead Letter Exchanges and manage the messages rejected by limit exceeded.
The reason is a name describing why the message was dead-lettered and is one of the following: rejected - the message was rejected with requeue=false, expired - the TTL of the message expired; or maxlen - the maximum allowed queue length was exceeded.
I hope it helps
EDIT**
The idea could be:
Subscribe a queue for example _queue
on DLE so when a message arrives means your is 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 you can start your 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 could be one solution.
Actually I think that this logic should be delegated to the application:
For example the work_consumer
always running and your application trigger your bulk function when reaches the .