Dead-Lettering a Message on a Service Bus Session Enabled Queue

Warren Kinley 176 Reputation points

I have a Logic App workflow that handles my session enabled queue messages. It processes the first message and completes the session on success. If a failure occurs processing the first message it is dead-lettered. After the dead-lettering does the session also have to be completed or is that handled automatically in the dead-lettering action?

0 comments No comments

Sign in to comment

Answer accepted by question author

Pravallika KV 17,025 Reputation points Microsoft External Staff Moderator

Hi @Warren Kinley ,

Dead-lettering a message does not automatically complete the session; rather, it's up to your application to handle that.

When you dead-letter a message, you use the DeadLetterMessageAsync method. This queues the message for inspection later.

After dead-lettering the message, you need to explicitly complete the session. This step is crucial because, if the session is not completed, it may lead to further issues like session lock timeout or unprocessed messages sitting in the session indefinitely.

You can access the dead-letter queue to inspect the dead-lettered messages later on and make decisions based on the errors encountered.

References:

Hope this helps!

0 comments No comments

Sign in to comment

1 additional answer

  1. AI answer

    When you dead-letter a message in a session-enabled queue, the session does not need to be completed separately. The dead-lettering action automatically handles the completion of the message within the session. This means that once you call the dead-letter operation on a message, it is effectively removed from the session, and you do not have to manually complete the session afterward.

    This behavior ensures that the session state is managed correctly without requiring additional steps from the user after a message has been dead-lettered.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.
Sign in to answer

Your answer