1

I am exploring the option of getting the queue count based on the custom header value in the message. For ex, If I have a queue that has 100 messages - 25 with a custom header "CUSTHDR" and value = "Apple", 25 with header value "Orange" and another 50 with header value "Grapes", I need to be able to get the count of messages in the queue based on the header value. Something like a method that returns 50 when I run GetMessageCount("Grapes");

Any direction is greatly appreciated.

3
  • Can you post what you have tried so far Commented Mar 18, 2019 at 16:56
  • To be frank, I am still trying to know the options available for me (I just started off using RabbitMQ). One option I have is to use the MessageCount(string queueName) method in the IModel interface. But this method returns the totat message count by taking only the queue name (without any filtering condition). I am trying to reach out experienced developers to know if there is a better option. Commented Mar 18, 2019 at 17:37
  • @GouthamSomashekar Similar is my requirement. Did you find an alternative solution to this requirement? Commented May 21, 2020 at 18:05

1 Answer 1

1

This is not supported by RabbitMQ.

You would have to consume all messages, group them by header to get counts, and then re-enqueue them (or reject the deliveries).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.