Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get size (number of messages) of a MassTransit IBus?

Tags:

c#

masstransit

I'm using the MassTransit library's InMemoryMessageBus and I would like to know how I can get the number of messages in the queue (the size of the bus).

like image 724
user854301 Avatar asked Nov 04 '25 15:11

user854301


1 Answers

The number of messages in any particular queue using the in-memory transport is not available. The message delivery is based on a queued task scheduler, and the message counts have not been made available. I'm not sure if they could be or not (well, easily. Anything is possible, but practical is another matter).

UPDATE: This was added to MassTransit and will be in the next release (3.5.x). The tracking issue is on GitHub, including example usage of the new code.

like image 161
Chris Patterson Avatar answered Nov 07 '25 11:11

Chris Patterson