Creating a Stream

Before publishing messages to a stream or consuming messages from a stream, you must first create a stream in the Streaming service.

To review requirements for creating and managing streams, see Getting Started with Streaming.

    1. Access the Streaming service in the Console.
    2. On the Streaming page, click Create Stream.
    3. Complete the options to create a stream:
      • Stream Name: Enter a name for the stream. The name doesn't have to be unique within the compartment, but must be unique to the stream pool. The stream name can't be changed. Avoid entering confidential information.
      • Compartment: Select the compartment in which to create the stream.
      • Stream Pool: Choose the stream pool to contain your stream.

        If the compartment has an existing stream pool, you can select it.

        If no stream pool exists in the compartment, click Create New Stream Pool and configure the stream pool. For instructions, see step 5 in Creating a Stream Pool.

    4. Provide values for Define Stream Settings:
      • Retention (in hours): Enter the number of hours (from 24 to 168) to retain messages in this stream. The default value is 24.
      • Number of Partitions: Enter the number of partitions for the stream. The maximum number is based on the limits for your tenancy.

        The maximum Total Write Rate and Total Read Rate values for the stream are displayed as you adjust the number of partitions.

    5. (Optional) Click Show Advanced Options to define tags. 

      If you have permissions to create a resource, then you also have permissions to apply free-form tags to that resource. To apply a defined tag, you must have permissions to use the tag namespace. For more information about tagging, see Resource Tags. If you're not sure whether to apply tags, skip this option or ask an administrator. You can apply tags later.

    6. Click Create.
  • 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.


    The examples in this section use the full syntax for all parameters, for example --compartment-id. For some parameters, there are shortened versions that you can use instead, like -c. See the CLI online help for instances of a shortened parameter associated with a command.

    You can create a stream in a compartment or a stream pool. The --compartment-id and --stream-pool-id parameters cannot be specified at the same time.

    oci streaming admin stream create --name <stream_name> --partitions <number_of_partitions> --compartment-id <compartment_OCID>
    oci streaming admin stream create --name <stream_name> --partitions <number_of_partitions> --stream-pool-id <stream_pool_OCID>

    For example:

    oci streaming admin stream create --name MyStream --partitions 5 --compartment-id ocid1.tenancy.oc1..exampleuniqueID
      "data": {
        "compartment-id": "ocid1.tenancy.oc1..exampleuniqueID",
        "defined-tags": {},
        "freeform-tags": {},
        "id": "",
        "lifecycle-state": "CREATING",
        "lifecycle-state-details": null,
        "messages-endpoint": "",
        "name": "MyStream",
        "partitions": 5,
        "retention-in-hours": 24,
        "stream-pool-id": "ocid1.streampool.oc1.phx.exampleuniqueID",
        "time-created": "2020-11-02T19:12:22.385000+00:00"
      "etag": "\"d72d8103-f1ae-442a-822d-10f86cd097c5-25e61a9b-cc08-4fad-9908-40c9636d31d8\""
  • Use the CreateStream API operation to create streams.

    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.