How to enable FlowControl with RabbitMQ

616 Views Asked by At

does anyone know how to enable RabbitMQ Flow Control in C# ? I tried something like this:

    channel = connection.CreateModel();
    channel.ChannelFlow(true);
    channel.FlowControl += new RabbitMQ.Client.Events.FlowControlEventHandler(channel_FlowControl);

Basically, i would expect the "channel_FlowControl" Event to be triggered when the RabbitMQ connection goes into FlowControl Mode - but somehow that doesn't happen.

Anyone knows how i hae to handle it correctly?

Thanks in advance

1

There are 1 best solutions below

0
On

Well, after some discussion with the really!!! nice folks from RabbitMQ the answer is easy.

You can't

There is no available callback in the C# driver, so the recommended method is using a small, internal async pre-queue and put your stuff in there, with an async thread reading that queue and publishing it to rabbit.

That way, when rabbit slows down and you need to slow your input too, you'll notice because the internal queue grows and you can detect that growth and act accordingly.

Again, thanks to the helpful folks at the RabbitMQ mailing list, even if its not the kind of reply i wanted to hear ;-)