Getting (Reading) Messages
Using a specified cursor, get (or read) messages from a stream in the Streaming service. A message is a Base64-encoded message that's published to a stream.
This task can't be performed using the Console. Use the oci streaming stream message get command and required parameters to get messages from a stream:
oci streaming stream message get --stream-id <stream_OCID> --cursor <cursor> --endpoint <messages_endpoint>
Your first request to get messages should use the value returned when you created a cursor. Each subsequent request should use the
opc-next-cursor
value returned in the previous response.For example:
oci streaming stream message get --stream-id ocid1.stream.oc1.phx.exampleuniqueID --cursor examplecursorvalue --endpoint https://cell-1.streaming.us-phoenix-1.oci.oraclecloud.com { "data": [ { "key": "a2V5MQ==", "offset": 0, "partition": "0", "stream": "MyStream", "timestamp": "2020-11-03T21:52:58.470000+00:00", "value": "dmFsdWUx" }, { "key": "a2V5Mg==", "offset": 1, "partition": "0", "stream": "MyStream", "timestamp": "2020-11-03T21:52:58.470000+00:00", "value": "dmFsdWUy" }, { "key": "a2V5MQ==", "offset": 2, "partition": "0", "stream": "MyStream", "timestamp": "2020-11-03T22:00:48.305000+00:00", "value": "dmFsdWUx" }, { "key": "a2V5Mg==", "offset": 3, "partition": "0", "stream": "MyStream", "timestamp": "2020-11-03T22:00:48.305000+00:00", "value": "dmFsdWUy" } ], "opc-next-cursor": "examplenextcursorvalue" }
For a complete list of parameters and values for CLI commands, see the CLI Command Reference.
Run the GetMessages operation to get messages for a stream.