Consuming Messages from a Channel

Learn how to consume messages from a specific channel or channels within a queue.

Consuming messages requires permissions to the queue and access to its Messages endpoint. For more information, see Consuming Messages and Channels.

You can specify a particular channel to consume messages from. For more information on filtering, see Message Selection.

Note

If messages were published to a channel, but a consumption request doesn't include a channel, messages are returned from a random channel with available messages from the specified queue.
  • You can't use the Console to consume messages, but you can use the Console to poll for messages. Polling messages serves as a peek at the queue or channel. Messages polled by the Console are unavailable to other consumers until the visibility timeout passes.

    1. Open the navigation menu and click Developer Services. Under Application Integration, click Queues.
    2. On the left side of the screen, click Queues.
    3. In the list of existing queues, click the name of the queue to display its details page.
    4. Under Resources, click Channels.
    5. (Optional) Click Manage polling settings. Provide the following information and then click Save changes:
      • Polling timeout: The length of time to wait for messages to consume.
      • Number of messages in a request: The maximum number of messages to consume when polling.
    6. In the Channels section, click Poll random channel or click the the Actions menu (Actions Menu) for a specific channel and select Poll message.
    7. Click Continue.

      If messages are available for consumption, they displayed in the Poll channel messages panel along with the queue's name and the channel ID.

    8. Click a message to get more details about a message.
  • Use the oci queue messages get-messages command and required parameters to consume messages from a channel. To consume messages from a specific channel, include channel-filter. For example:

    oci queue messages get-messages --queue-id <queue_OCID> --channel-filter <channel_ID>

    For a complete list of parameters and values for CLI commands, see the CLI Command Reference.

  • Use the GetMessages operation to consume messages from a channel. A GetMessages request contains an optional limit, an optional visibilityInSeconds, and an optional timeoutInSeconds parameter.

    To consume messages from particular channels, include the channelFilter parameter.

    For information about using the API and signing requests, see REST API documentation and Security Credentials. For information about SDKs, see SDKs and the CLI.