Hi ,
Thanks for reaching out to Microsoft Q&A.
Do not requeue messages. Instead, use in session retries with lock renewal or pause session processing using a circuit breaker. This preserves message order and avoids DLQs.
=============================================================
To preserve message ordering in azure service bus with retries:
- Keep messages in the same session - You already do this which ensures ordering. Never re-enqueue failed messages manually as it breaks seq numbers.
- Use session lock renewal + backoff retries - Instead of rescheduling, keep the session lock active and retry the failed message inmemory with exponential backoff (or until a timeout). Use the
RenewSessionLockAsync()method periodically - If the external API is down, stop processing messages for that session. Complete none of them until the API is available. This maintains order and avoids DLQ.
- Detect when the external API is unavailable, pause processing across all sessions, and resume only when healthy.
- Adjust max delivery count + DLQ monitoring : Set higher delivery count limits and use DLQ alerts for visibility but avoid relying on rescheduling
Please 'Upvote'(Thumbs-up) and 'Accept' as answer if the reply was helpful. This will be benefitting other community members who face the same issue.