Interface ClientStreamer<M extends BufferWriter>

All Superinterfaces:
AutoCloseable, CloseableSilently
All Known Implementing Classes:
ClientStreamServiceImpl

public interface ClientStreamer<M extends BufferWriter> extends CloseableSilently
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 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 stream
      metadata - metadata associated with the stream
      clientStreamConsumer - consumer which process data received from the server
      Returns:
      a unique id of the stream
    • remove

      ActorFuture<Void> remove(ClientStreamId streamId)
      Removes a stream that is added via add(DirectBuffer, BufferWriter, ClientStreamConsumer). After the returned future is completed, the ClientStreamConsumer will not receive any more data.
      Parameters:
      streamId - unique id of the stream
      Returns:
      a future which will be completed after the stream is removed