Interface ClientStreamer<M extends BufferWriter>
- All Superinterfaces:
AutoCloseable,CloseableSilently
- All Known Implementing Classes:
ClientStreamServiceImpl
Allows to add and remove client streams.
When a client stream is added, it opens a stream to all servers. When a server pushes data to
this stream, the client receives it via ClientStreamConsumer.push(DirectBuffer)
-
Method Summary
Modifier and TypeMethodDescriptionadd(org.agrona.DirectBuffer streamType, M metadata, ClientStreamConsumer clientStreamConsumer) Registers a client and opens a stream for the given streamType and associated Metadata with all available servers.remove(ClientStreamId streamId) Removes a stream that is added viaadd(DirectBuffer, BufferWriter, ClientStreamConsumer).Methods inherited from interface io.camunda.zeebe.util.CloseableSilently
close
-
Method Details
-
add
ActorFuture<ClientStreamId> add(org.agrona.DirectBuffer streamType, M metadata, ClientStreamConsumer clientStreamConsumer) Registers a client and opens a stream for the given streamType and associated Metadata with all available servers. The stream is also opened for servers that are not currently reachable, but available later.NOTE: The stream to a server can be added asynchronously. So there might be a delay until the consumer receives the first data.
- Parameters:
streamType- type of the streammetadata- metadata associated with the streamclientStreamConsumer- consumer which process data received from the server- Returns:
- a unique id of the stream
-
remove
Removes a stream that is added viaadd(DirectBuffer, BufferWriter, ClientStreamConsumer). After the returned future is completed, theClientStreamConsumerwill not receive any more data.- Parameters:
streamId- unique id of the stream- Returns:
- a future which will be completed after the stream is removed
-