1

I am using the Microsoft Azure ServiceBus for Queue messages using WCF for the subscriptions. I am trying to implement retry logic. I use Peak/Lock to view the message and then have to do some local processing on the message. If that processing fails, I unlock the message so I can try processing it again. The problem is I need to build a have a delay in-between processing tries. Currently it is popped back into the queue and then is processed almost immediately. There needs to be about 2 minutes between attempts.

4

2 回答 2

1

如果您总是需要等待 2 分钟才能重新处理该特定队列的消息,您可以尝试将队列上的锁定超时配置为 2 分钟(加上您预计处理消息所需的时间)然后让锁过期,而不是解锁它。这样做的缺点是您需要密切关注处理时间,并在需要时延长锁的超时时间。

另一种选择可能是接收并完成消息,将预定的传递设置为未来 2 分钟,然后重新发送消息。这样做的缺点是您需要使用它并确认它,这涉及某些风险(例如,您的进程在您有机会重新发送消息之前就死了)。

于 2013-06-04T20:45:16.283 回答
0

“如果从队列中以 Peek Lock 模式查看消息,则消息中没有接收上下文。您可以在 Peek Lock 模式下接收消息,这将在为“锁定持续时间”指定的间隔内锁定消息' 队列的属性。锁定的消息在其锁定到期之前无法接收。因此,通过将锁定持续时间设置为 2 分钟并以 Peek Lock 模式接收消息将解决此问题。

您可以编写自定义代码来更新 Lock Duration 属性。Service Bus Explorer、Serverless360 等工具提供了使用图形用户界面更新属性的选项。”

于 2018-06-15T00:30:09.183 回答