简体   繁体   English

Masstransit 如何处理慢消费者

[英]How Masstransit deals with slow consumer

I am using Masstransit 7.0.0 with consumer to process the messages from RabbitMQ.我正在与消费者一起使用 Masstransit 7.0.0 来处理来自 RabbitMQ 的消息。 I have observed when the consumer is slow processing the message or when I put the debug point in visual studio for consumer, after some time my consumer receives the message again.我观察到消费者处理消息的速度很慢,或者当我将调试点放在消费者的 Visual Studio 中时,一段时间后我的消费者再次收到消息。 My assumption is Masstransit thought consumer crashed and sent the message again.我的假设是 Masstransit 认为消费者崩溃并再次发送消息。

In my case, my consumer is some times slow processing the message as it talks to external endpoints but the processing is around 30-40 seconds and not minutes.就我而言,我的消费者在与外部端点通信时处理消息的速度有时很慢,但处理时间约为 30-40 秒而不是几分钟。

Could you please explain How masstransit knows the consumer is crashed( or whatever it is) to resend the message?您能否解释一下masstransit 如何知道消费者崩溃(或其他任何原因)以重新发送消息? If it waits for certain amount of time waiting for ack, then Is there setting anywhere just to increase this time little bit specific to queue/consumer?如果它等待一定的时间等待确认,那么是否有任何设置只是为了增加这个特定于队列/消费者的时间?

Thanks谢谢

With RabbitMQ, there is no timeout after which the message would be redelivered.使用 RabbitMQ,没有超时,在此之后消息将被重新传递。 If you are stopping the consumer in the debugger, you are likely causing the RabbitMQ socket connection to close.如果您在调试器中停止使用者,您可能会导致 RabbitMQ 套接字连接关闭。 When the connection is closed, MassTransit will reconnect at which point any messages not previously acknowledged would be redelivered.当连接关闭时,MassTransit 将重新连接,此时任何先前未确认的消息将被重新传送。

In normal operation, consumers that take 30, 60, 90, even 300 seconds are rarely an issue as the broker connection is maintained.在正常操作中,花费 30、60、90、甚至 300 秒的消费者很少会成为问题,因为维护了代理连接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM