Warm tip: This article is reproduced from serverfault.com, please click

PublishEndpoint.Publish hangs forever when RabbitMQ Memory Alarm goes off

发布于 2020-12-03 10:54:42

I am using MassTransit and RabbitMQ. When RabbitMQ RAM usage exceeds a certain Limit, a memory alarm is raised. In the overview of the RabbitMQ managment website the memory indicator changes red and states

The memory alarm for this node has gone off. It will block incoming network traffic until the memory usage drops below the watermark.

While in this state my service still tries to publish messages using MassTransit. But the publish async task will never complete / wait for continuation forever. To me it seems there is some timeout mechanism missing in MassTransit publish. I would expect an exception, if a message can not be published after a certain duration. I do not find a way to configure time out behaviour.

How do you deal with this situation?

Thanks

Questioner
Diego Frehner
Viewed
0
Chris Patterson 2020-12-03 21:04:31

The Publish method accepts a CancellationToken, which can be used to cancel the publish. This was previously answered with a code sample of how to specify a timeout.