Defer an Azure Service Bus message and retrieve it later by sequence number instead of losing your place in the queue

domain: azure-service-bus · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Receive the message in PeekLock mode, then call DeferMessageAsync() (.NET), deferMessage() (Java), or defer_message() (Python) instead of completing or abandoning it
  2. Record the message's SequenceNumber somewhere durable — the receiver's lock is released and the message becomes invisible from normal receive calls, retrievable only by sequence number
  3. When ready to process it, call ReceiveDeferredMessageAsync(sequenceNumber) (.NET), receiveDeferredMessage(sequenceNumber) (Java), or receive_deferred_messages(sequence_numbers) (Python) — any receiver that knows the sequence number can retrieve it, not just the original deferrer
  4. Complete or dead-letter the retrieved message as normal once processed
  5. Account for deferred messages still counting against the queue's size/quota limits, since they remain in the main queue rather than moving to a subqueue
  6. If the sequence number is lost, fall back to peek/browse operations to rediscover the deferred message

Known gotchas

Related routes

enable duplicate detection on an azure service bus queue that also uses scheduled messages
learn.microsoft.com · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans