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.
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.
- Open the navigation menu and click Developer Services. Under Application Integration, click Queues.
- On the left side of the screen, click Queues.
- In the list of existing queues, click the name of the queue to display its details page.
- Under Resources, click Channels.
- (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.
- In the Channels section, click Poll random channel or click the the for a specific channel and select Poll message.
- 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.
- 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, includechannel-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 optionalvisibilityInSeconds
, and an optionaltimeoutInSeconds
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.