Can I configure azure to view and read messages on the Service Bus queue, but not delete?

Per Azure Service Bus Links> :

Trigger behavior

...

PeekLock Behavior - Runtime accepts a message in PeekLock mode and causes the message to terminate if the function succeeds, or calls Abandon if the function fails. If the function runs longer than the PeekLock timeout, the lock is automatically renewed.

My guess is that when the azure function calls Complete on a message, it will be removed from the queue.

What should I do in my function if I want my function to spy on a message but never delete it?

+3


source to share


1 answer


Failure to process the message, resulting in a throwing exception or explicit rejection operation on the message will not complete.

Speaking of which, I see a problem with this approach. You do not really "spy" on messages, but actively process them. This means that the given message will be resent and will end up in the dead letter queue. If you want to spy, you have to peek in messages, but the Azure Service Bus trigger does not.



If you need a wiretap implementation it is probably not a bad idea to use a theme and have 2 subscriptions, one to consume messages and the other to duplicate all messages for your listener function (which probably does some parsing or logging). Without understanding the full scope of what you are doing, it is difficult to answer.

+4


source







All Articles