Multiple Function instances must process redaction jobs from one Service Bus queue safely. Which pattern applies?
Select an answer to reveal the explanation.
Short Explanation
With competing consumers, you let each scaled Function instance lock and process a different redaction job from the shared queue. That shares the work safely without running every job on every instance.
Full Explanation
Use competing consumers when multiple Function instances process redaction jobs from one Service Bus queue. As the Function scales out, each instance can lock a different message, process its redaction job, and complete that message, allowing work to run in parallel. The broker’s message lock normally prevents two instances from processing the same message at the same time. Broadcasting every redaction message to all instances duplicates work, increases compute and token costs, and can cause conflicting writes to the same document. Routing every job to one permanently designated instance prevents parallel queue processing and gives up the throughput benefit of scaling when the backlog grows. Deleting messages before processing can lose redaction jobs and does not provide safe concurrency. Exam caveat: a message can be delivered again if its lock expires before completion, so competing consumers do not remove the need for idempotent processing. Practical check: run several Function instances, enqueue distinct redaction jobs, and verify that instances process different messages and complete them; also check that duplicate outputs do not appear under normal lock durations.