Developer Guide to Streaming

Oracle Cloud Infrastructure (OCI) provides SDKs so that you can interact with Streaming without having to create a framework.

The OCI SDKs let you manage streams and stream pools and Kafka Connect configurations, and publish and consume messages. Refer to the Overview of Streaming for key concepts and additional information.

This section includes the following topics to help you get started quickly with Streaming and the OCI SDK of your choice:

For more information about using the OCI SDKs, see the SDK Guides.

Because Oracle Cloud Infrastructure Streaming is compatible with most Kafka APIs, you can use applications written for Kafka to send messages to and receive messages from the Streaming service. See Developing with Kafka and Streaming for more information.

Streaming Clients

The SDKs encapsulate the Streaming service in two clients: the StreamAdminClient and the StreamClient.

StreamAdminClient

The StreamAdminClient incorporates the control plane operations of Streaming. You can use it to create, delete, update, modify, and list streams.

To instantiate the StreamAdminClient object:

StreamAdminClient adminClient = new StreamAdminClient([authProvider]);
adminClient.setEndpoint("<streaming_endpoint>");

StreamClient

The StreamClient is used to publish and consume messages.

To instantiate a StreamClient object:

// First you have to get the stream you want to consume from/publish to.
// You can either make a CreateStream, GetStream, or ListStream call. They all return a "messagesEndpoint" as part of a Stream object.
// That endpoint needs to be used when creating the StreamClient object.
GetStreamRequest getStreamRequest = GetStreamRequest.builder().streamId(streamId).build();
Stream stream = adminClient.getStream(getStreamRequest).getStream();
 
StreamClient streamClient = new StreamClient([authProvider]);
streamClient.setEndpoint(stream.getMessagesEndpoint());