Windows service holding messages from RMQ queue

58 views
Skip to first unread message

Aneesha K.A

unread,
Oct 9, 2023, 12:13:50 PM10/9/23
to rabbitmq-users
Dear RMQ users,

I am facing one issue and adding the details here. 
I have multiple Windows services consuming RMQ queues. I am using topshelf for Windows service and EastnetQ for RMQ subscription. Prefetch count is 1 for all consumers.
I am publishing the message to the queue through my web application. All are through c#.
image
My issue is that Service Shared is a single-thread application. In my case, ServiceShared is consuming one message from each queue at a time, but processing one after another.
It's holding the message from each queue. But actual message processing is one by one. Due to that other individual consumers cannot process the messages.

I checked the connection and channels and I can see multiple channels for the Service shared and messages are in unack state.

How I can avoid holding messages from other queues until the current one has finished its processing?

Luke Bakken

unread,
Oct 9, 2023, 1:53:09 PM10/9/23
to rabbitmq-users
Hello,

You should only consume from queues for which you can actually process the messages.

Aneesha K.A

unread,
Oct 9, 2023, 2:04:36 PM10/9/23
to rabbitmq-users

yes, I doing that like that only. All the queue will have messages most of the time. My individual services consuming only one queue.But shared service is consuming different queues. I am attaching the images that I posted in the initial message. When shared service start to process a message from queue1, it will also hold one message from queue2 if it has message. So service2 (individual consumer of queue2) is not getting that message
RMQ channels.png
Overall flow.png

Luke Bakken

unread,
Oct 9, 2023, 3:08:46 PM10/9/23
to rabbitmq-users
On Monday, October 9, 2023 at 11:04:36 AM UTC-7 Aneesha K.A wrote:
yes, I doing that like that only. All the queue will have messages most of the time. My individual services consuming only one queue.But shared service is consuming different queues. I am attaching the images that I posted in the initial message. When shared service start to process a message from queue1, it will also hold one message from queue2 if it has message. So service2 (individual consumer of queue2) is not getting that message

Yes, this is how consuming works. The only way to prevent the "shared service" from consuming messages that "service2" should have is for the "shared service" to NOT consume from "queue2".
 
The "shared service" should cancel consuming messages from queues that it can't process. If it has been delivered messages already, it should "nack" or reject the message so that another consumer can process it.

If you "nack" or reject a message without canceling the consumer, there's a chance the message will be re-delivered to the "shared service".

Thanks,
Luke

Aneesha K.A

unread,
Oct 10, 2023, 9:44:02 AM10/10/23
to rabbitmq-users
If shared service is free and queue 2 has a message, it will process that message. Even if a shared service is consuming a message from queue1, and its completed the processing,  it will process the queue2 message. 

My issue is that if queue1 and queue2 have messages, the shared service will process queue1 message and also hold message from queue2 as well. Once the first message processing is done, it will process this message.  If the shared service is not holding the queue2 message, individual service 2 can process that message. Due to that, it's delaying the message processing. 

How we can avoid holding messages while the Windows service is processing another message so that other consumers can get the message? 

Luke Bakken

unread,
Oct 10, 2023, 11:50:15 AM10/10/23
to rabbitmq-users
I've already explained in my last message what you can do. Asking the question again isn't going to change it.

Aneesha K.A

unread,
Oct 10, 2023, 2:57:45 PM10/10/23
to rabbitmq-users
I am sorry if it's confusing. I am looking for any of these options. Please let me know anything else I can do here.
1. shared service should not hold any messages from other queues if it's currently processing any message. Not sure how can I do that one. 
2. As you suggested, we can nack/reject messages, since it single-thread app, I cannot reject them until other message processing is completed.
Reply all
Reply to author
Forward
0 new messages