[rabbitmq-discuss] TCP Backpressure / Flow Control in C# producer

Matthias Radestock matthias at rabbitmq.com
Wed Aug 8 08:57:38 BST 2012


Ulli,

On 08/08/12 08:51, Ulli Berthold - Exactag GmbH wrote:
> Well, because i got a producer that frequently puts more data into
> the queue than is processed at that time (will processed be at later,
> quieter, intervals though). Frequently that puts the producer into
> flow mode, slowing it down, which is not an option in our case. The
> producer has to be freed again within milliseconds to accept the next
> event. If the queue doesn't accept data as fast as I produce it I
> need to see that and switch over to an alternative (local file-based
> cache) which again will be processed later.

I suggest you introduce a second thread and connect that to the producer 
thread via a one-place buffer or a queue data structure. The second 
thread pulls items off that queue and publishes them to RabbitMQ. The 
publisher thread can look at the queue's length before deciding whether 
to place another item in it or write to disk.

Matthias.


More information about the rabbitmq-discuss mailing list