Updated 2025-02-03

Message Management

Read about how to publish, consume, and manage messages in a queue.

Example Queue Flow

The following diagram provides an example where producer sends a message to a queue and two consumers attempt to process it.

Diagram representing the production, update, consumption, and deletion of a message.

  1. A producer sends a message to the queue with default message retention time.

    The producer receives confirmation that the Queue service received and stored the message.

  2. Consumer A tries to receive the message.

    Consumer A receives the message, which it's supposed to process within Visibility Timeout A.

  3. Consumer B tries to receive a message.

    Consumer B receives nothing, because the only available message was already consumed by Consumer A.

  4. Consumer A fails to process message within Visibility Timeout A, so it updates the message to extend the visibility timeout.
  5. Consumer B tries to receive a message again.

    Consumer B receives nothing, because the only available message was consumed and extended by Consumer A.

  6. The extended visibility timeout elapses.
  7. Consumer B tries to receive a message a third time.

    Consumer B receives the message, which it's supposed to process within Visibility Timeout B.

  8. Consumer A tries to receive the message, but receives nothing, because Consumer B consumed the message.

    Consumer A can no longer extend the message's visibility timeout or delete the message.

  9. Consumer B processes the message successfully and tries to delete the message from the queue.

    Consumer B receives confirmation that the message was permanently deleted, so it can't be delivered to any other consumer.

Note

Every time a message is delivered to a consumer, the message's Delivery Count field is incremented. When a message's delivery count reaches the configured maximum, it's sent to a dead letter queue.

Messages Endpoint

To produce to a queue or consume from a queue, you need to know the messages endpoint used by that queue. A queue's messages endpoint looks something such as this:

https://cell-1.queue.messaging.<region>.oci.oraclecloud.com

To find a queue's messages endpoint:

  1. On the Queues list page, select the queue that you want to work with. If you need help finding the list page or the queue, see Listing Queues.

    The Queue information section contains the Messages endpoint.

You can find the messages endpoint using the API with a GetQueue request.

Required IAM Policy

See Queue Policies and Policy Examples for details on required permissions for queue management.

Next Steps