I have a long running process which I call in my Service Bus Queue. I want it to continue beyond 5 minutes

a 夏天 提交于 2019-12-06 07:56:28

Messages are intended for notifications and not long running processing.

You've got a fewoptions:

  1. Receive the message and rely on receiver's RenewLock() operation to extend the lock.
  2. Use user-callback API and specify maximum processing time, if known, via MessageHandlerOptions.MaxAutoRenewDuration setting to auto-renew message's lock.
  3. Record the processing started but do not complete the incoming message. Rather leverage message deferral feature, sending yourself a new delayed message with the reference to the deferred message SequenceNumber. This will allow you to periodically receive a "reminder" message to see if the work is finished. If it is, complete the deferred message by its SequenceNumber. Otherise, complete the "reminder" message along with sending a new one. This approach would require some level of your architecture redesign.
  4. Similar to option 3, but offload processing to an external process that will report the status later. There are frameworks that can help you with that. MassTransit or NServiceBus. The latter has a sample you can download and play with.

Note that option 1 and 2 are not guaranteed as those are client-side initiated operations.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!