0

I have a service bus, that will trigger the azure function. In the azure function, I do something, and if it is not ready, I'll push the message back to the queue. But the message will be picked up by the azure function again almost immediately.. I thought there is a "Message Lock Duration" which is set to 30 seconds, so the message will be available only after 30 seconds?

justyy
  • 5,831
  • 4
  • 40
  • 73
  • What do you mean by `I'll push the message back to the queue`? – Gaurav Mantri Jun 16 '22 at 18:13
  • message is pushed back to the queue by azure function – justyy Jun 17 '22 at 08:39
  • Sounds like you're creating an entirely new message. The original is complete, though not processed by your consumer. – DanielG Jun 19 '22 at 04:34
  • 1
    What about improving your error handling in the Azure function to try again, either X times, or pause Y seconds, and try again? Pushing a new message starts everything over, and the fact that the function picks it up immediately is a good thing. Just thinking maybe you can tweak your error handling instead of trying to use the queue to do that. – DanielG Jun 20 '22 at 12:56
  • What i am doing now is to wait 30 seconds before push the message back to the queue. So just to clarify, the service bus cannot be configured with a message delay visibility e.g. messages only become available 30 seconds after enqueue? – justyy Jun 20 '22 at 13:29
  • 1
    I have never used such a feature, but this article implies that you can add a property to the message (in UTC time) to post it to the queue but defer in from being visible to consumers until that time occurs. I have not tried it but it appears possible. Cool feature! ScheduledEnqueueTimeUtc seems to be the property you want: https://stackoverflow.com/questions/60437666/how-to-defer-a-azure-service-bus-message – DanielG Jun 20 '22 at 15:25

0 Answers0