Publishing with the Console, CLI, and API

While you can use the Console to publish test messages to a stream, you should use the CLI, API, or an SDK to populate your stream.

To publish messages using the Oracle Cloud Infrastructure (OCI) SDKs, see the Developer Guide to Streaming.

If you take advantage of Streaming's Kafka compatbility, see Developing with Kafka and Streaming.

Tip

You can also use Oracle Cloud Infrastructure Service Connector Hub to publish data to a stream from supported source services, such as Logging.

Using the Console to Produce a Test Message

  1. Open the navigation menu and click Analytics & AI. Under Messaging, click Streaming.
  2. Click a stream to display the stream details page.
  3. Click Produce Test Message.
  4. On the Test Stream dialog, enter the text-only message to produce in the Data text box.
  5. Click Produce.

Using the Command Line Interface (CLI)

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
  }
}