This topic covers how to emit messages to a stream.
To publish messages:
Once a stream is created and active, you can publish messages.
A message is composed of a key and a value. Both the key and the value are byte arrays. If you don't explicitly supply a key, one is generated automatically.
The message is published to a partition in the stream. If there is more than one partition, the partition where the message is published is calculated using the message's key. If the key is null, the partition is calculated using a random 16-byte value.
For messages with a null key, do not expect messages with same value to go on the same partition, since the partitioning scheme may change. Passing a null key will put the message in a random partition. If you want to ensure that messages with the same value go to the same partition, you should use the same key for those messages.
Required IAM Policy
To use Oracle Cloud Infrastructure, you must be given the required type of access in a policy written by an administrator, whether you're using the Console or the REST API with an SDK, CLI, or other tool. If you try to perform an action and get a message that you don’t have permission or are unauthorized, confirm with your administrator the type of access you've been granted and which compartment you should work in.
For administrators: The policy in Let streaming users manage streams lets the specified group do everything with streaming and related Streaming service resources.
If you're new to policies, see Getting Started with Policies and Common Policies. If you want to dig deeper into writing policies for databases, see Details for the Streaming Service in the IAM policy reference.
Using the Console
- Click on the stream that you want to publish on.
- Click the Produce Test Message button.
- Type the message in the Data text box.
- Click Produce.
Using the API
For information about using the API and signing requests, see REST APIs and Security Credentials. For information about SDKs, see Software Development Kits and Command Line Interface.
Use these API operations to produce messages: