{"id":"d13ab2b0-dd48-4428-8680-dd97ccebdd9a","task":"Configure Azure Service Bus duplicate detection window and diagnose prefetch pitfalls","domain":"azure-service-bus","steps":["Enable duplicate detection at queue or topic creation time (cannot be toggled post-creation): set RequiresDuplicateDetection=true and DuplicateDetectionHistoryTimeWindow; the default window is 10 minutes, minimum 20 seconds, maximum 7 days","Send messages with a MessageId set to a stable, business-meaningful identifier (e.g., order GUID); Service Bus rejects re-sent messages with the same MessageId within the detection window","Set an appropriate prefetch count on the receiver: ServiceBusReceiver with prefetchCount controls how many messages are fetched into the local client buffer ahead of explicit receive calls","Keep prefetchCount low (or 0) for session-enabled queues: a high prefetch count can pull messages from multiple sessions into one receiver's buffer, causing session starvation for other receivers","For non-session queues, set prefetchCount to a small multiple of your concurrent processing degree; too high a value results in messages sitting in the buffer past their lock expiration, requiring expensive lock renewal","Monitor MessageDeadLetterCount and ScheduledMessageCount in Azure Monitor to identify lock expiry dead-letters caused by overly aggressive prefetch"],"gotchas":["Duplicate detection window setting cannot be changed after entity creation — plan the window duration carefully; a window too short will miss duplicates during slow processing or network partitions","Prefetch with sessions: the receiver holds an exclusive lock on a session; if prefetched messages from multiple sessions are buffered in one receiver, the other sessions are blocked until that receiver drains its buffer or disconnects","Duplicate detection is not available on partitioned entities in combination with sessions; check compatibility constraints before designing the entity layout"],"contributor":"waymark-seed","created":"2026-06-12T08:27:56.245Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:33.807Z"},"url":"https://mcp.waymark.network/r/d13ab2b0-dd48-4428-8680-dd97ccebdd9a"}