Publishing a Test Message to a Stream

Emit (publish) a test message to a stream in the Streaming service to ensure the stream is working.

Use the CLI, API, or an SDK to populate a stream. For requirements and recommendations for publishing messages, see Publishing Messages. To publish messages using an SDK, see Developer Guide to Streaming.

    1. On the Streams list page, select the stream that you want to work with. If you need help finding the list page or the stream, see Listing Streams.
    2. On the details page, select Produce Test Message.
    3. In the Data box, enter the text-only message to publish.
    4. Select Produce.
  • Use the oci streaming stream message put command and required parameters to publish a test message to a stream:

    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
      }
    }
  • Run the PutMessages operation to publish a test message to a stream.