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:
Copy
StreamAdminClient adminClient = new StreamAdminClient([authProvider]);
adminClient.setEndpoint("<streaming_endpoint>");
StreamClient 🔗
The StreamClient is used to publish and consume messages.
To instantiate a StreamClient object:
Copy
// 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());