Reputation: 11
Hi I am looking for simple solution on rabbit mq. Below are the settings been done on the rabbit.
Code snippet below
channel = connectionFactory.getChannel();
channel.queueDeclarePassive("myqueue");
channel.confirmSelect();
channel.basicPublish("myexchange", "myrouting", true,
null, "test".getBytes("UTF-8"));
channel.waitForConfirmsOrDie();
Now the rabbit mq is not replying with error for the number of messages exceeded/size exceeded. I could able to send 1000 messages/with 1kb size and the consumer also consuming all these messages. So how could I get the error code? Any help on this please?
Upvotes: 1
Views: 1242
Reputation: 9627
There are two items you need to consider here. First, your consumer may be consuming messages fast enough that the limit is never reached.
Second, when a queue length limit is hit, messages are dropped from the head of the queue to make room for new messages. This means that you will lose the oldest messages in the queue - docs. This behavior will be configurable in 3.7.0
.
However, in no case will an error be returned, so I don't know why you think an error will be returned. The documentation is clear on what happens when a queue limit is reached.
Upvotes: 1