Skip to main content

Messaging concepts

A publication is one message sent to a topic. A delivery is that message's progress in one subscribed queue. A delivery attempt is one consumer's opportunity to process that delivery. Keeping these separate makes fan-out, retries, and acknowledgements easier to predict.

┌─ queue subscriber-a ─┬─ worker 1
publisher ── topic events ─┤ └─ worker 2
└─ queue subscriber-b ─── consumer 3

A publication to events creates a delivery in each live queue. Workers 1 and 2 share subscriber-a's work. Consumer 3 processes subscriber-b independently. Acknowledging the delivery in subscriber-a does not acknowledge it in subscriber-b.

Topic and queue identity​

A topic is the publication destination. It distributes new messages to its subscribed queues. Creating a topic does not create a queue, and publishing without subscribers does not reserve messages for future subscribers.

A queue is a named subscription to one topic. Create it before publishing messages it must receive. Repeating an identical declaration preserves an existing Durable queue or live Exclusive queue. A live Exclusive redeclaration also renews its lifetime; an expired Exclusive queue rejects redeclaration with PMQ02 and must be deleted before its name can be reused. Deleting a queue and reusing its name creates a new subscription.

Choose a Durable queue when that named subscription must survive consumers disconnecting. Use an Exclusive queue when the subscription should expire after its declaring connection stops maintaining it. Both store messages and require acknowledgement. Exclusive does not enforce one consumer.

Claiming and completing work​

A consumer claims a delivery for a visibility timeout. During that interval other consumers cannot claim that delivery. The claim does not complete the work: the consumer must acknowledge success or return a failure.

An acknowledgement completes one queue's delivery. A negative acknowledgement returns it for another attempt, optionally after a delay, or moves it to the dead-letter queue if it has reached the attempt limit. If the consumer disappears, the visibility timeout allows recovery. SDKs normally extend active deliveries while the application processes them.

A timeout can occur while an old worker is still running. The SDK's stop signal tells the application to stop treating the delivery as owned. It cannot undo a request already sent to another service. This is why idempotency and cancellation handling remain application responsibilities.

One delivery can have several attempts​

Suppose worker 1 claims message 1 and disconnects before acknowledging. After its visibility timeout, worker 2 can claim message 1 again, subject to the queue's attempt limit. Both claims concern the same delivery; publication did not run again.

Retrying a publication with an uncertain outcome is different. The retry can create a second message with a different message ID. Use an application event ID when duplicates must be recognized across publications.

A finite attempt limit bounds repeated processing. Exhausted deliveries go to the dead-letter queue, where an operator can investigate and replay them. Final-attempt crashes require scheduled maintenance to perform that move.

Ordering and retention​

Ungrouped deliveries can be processed concurrently without a strict FIFO guarantee. A group key establishes an ordered sequence within each queue. The next message in that group waits until the head is acknowledged, removed, or dead-lettered. Other groups remain independent. FIFO is an ordering capability on either queue lifetime, not a third lifetime setting.

After acknowledgement, a completed delivery remains available for inspection until retention removes it. A payload is collected only after no queue or dead-letter entry references it and the retention conditions are met. Retention does not expire pending work.

Continue with Publishing, Consuming, and the more precise Delivery guarantees.