Publishing a Test Message to a Stream
Publish a test message to a stream in the Streaming service to ensure the stream is working.
Although you can use the Console to publish test messages to a stream, you should use the CLI, API, or an SDK to populate a stream. To publish messages by using the Oracle Cloud Infrastructure (OCI) SDKs, see the Developer Guide to Streaming.
To review requirements and recommendations for publishing messages, see Publishing Messages.
- Access the Streaming service in the Console.
- On the Streams page, click the name of the stream that you want to publish a message to.
- On the stream details page, click Produce Test Message.
- In the Data box, enter the text-only message to publish.
- Click Produce.
For information about using the CLI, see Command Line Interface (CLI). For a complete list of flags and options available for CLI commands, see the Command Line Reference.
To publish a message
oci streaming stream message put --stream-id <stream_id> --messages <JSON_messages> --endpoint <messages_endpoint>
Tip
Provide input for--messages
as valid formatted JSON. See Passing Complex Input and Using a JSON File for Complex Input for information about JSON formatting.For example,
file.txt
contains the properly formatted JSON. Its values are Base64-encoded:[ { "key": "a2V5MQ==", "value": "dmFsdWUx" }, { "key": "a2V5Mg==", "value": "dmFsdWUy" } ]
The
--messages
parameter takes the file as its value:oci streaming stream message put --stream-id ocid1.stream.oc1.phx.exampleuniqueID --messages file://file.txt --endpoint https://cell-1.streaming.us-phoenix-1.oci.oraclecloud.com { "data": { "entries": [ { "error": null, "error-message": null, "offset": 0, "partition": "0", "timestamp": "2020-11-03T21:35:03.837000+00:00" }, { "error": null, "error-message": null, "offset": 1, "partition": "0", "timestamp": "2020-11-03T21:35:03.837000+00:00" } ], "failures": 0 } }
Use the following API operations to produce messages:
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.