Class StreamParameters

java.lang.Object
org.zalando.fahrschein.StreamParameters

public class StreamParameters extends Object
  • Constructor Details

    • StreamParameters

      public StreamParameters()
  • Method Details

    • withBatchLimit

      public StreamParameters withBatchLimit(int batchLimit) throws IllegalArgumentException
      Maximum number of Events in each chunk (and therefore per partition) of the stream.

      Note 2017/05/19: the API definition says if the value is 0 or unspecified the server will buffer events indefinitely and flush on reaching of batchFlushTimeout. This is incorrect - if the server receives a value of '0' it will not send events at all (effectively it's a silent bug). Because of this if value is set to 0 (or less than 1) client raise an exception.

      Parameters:
      batchLimit - batch_limit must be lower or equal to stream_limit
      Throws:
      IllegalArgumentException
    • withStreamLimit

      public StreamParameters withStreamLimit(int streamLimit) throws IllegalArgumentException
      Maximum number of Events in this stream (over all partitions being streamed in this connection).
      Parameters:
      streamLimit - If 0 or undefined, will stream batches indefinitely. Stream initialization will fail if stream_limit is lower than batch_limit.
      Throws:
      IllegalArgumentException
    • withBatchFlushTimeout

      public StreamParameters withBatchFlushTimeout(int batchFlushTimeout) throws IllegalArgumentException
      Maximum time in seconds to wait for the flushing of each chunk (per partition).
      Parameters:
      batchFlushTimeout - If the amount of buffered Events reaches batch_limit before this batch_flush_timeout is reached, the messages are immediately flushed to the client and batch flush timer is reset. If 0 or undefined, will assume 30 seconds.
      Throws:
      IllegalArgumentException
    • withStreamTimeout

      public StreamParameters withStreamTimeout(int streamTimeout) throws IllegalArgumentException
      Maximum time in seconds a stream will live before connection is closed by the server. If 0 or unspecified will stream indefinitely. If this timeout is reached, any pending messages (in the sense of stream_limit) will be flushed to the client.
      Parameters:
      streamTimeout - Stream initialization will fail if stream_timeout is lower than batch_flush_timeout
      Throws:
      IllegalArgumentException
    • withCommitTimeout

      public StreamParameters withCommitTimeout(int commitTimeout)
      Maximum amount of seconds that nakadi will be waiting for commit after sending a batch to a client. If the commit does not come within this timeout, nakadi will initialize stream termination, no new data will be sent. Partitions from this stream will be assigned to other streams.
      Parameters:
      commitTimeout -
    • withStreamKeepAliveLimit

      public StreamParameters withStreamKeepAliveLimit(int streamKeepAliveLimit)
      Maximum number of empty keep alive batches to get in a row before closing the connection.
      Parameters:
      streamKeepAliveLimit - If 0 or undefined will send keep alive messages indefinitely.
    • withMaxUncommittedEvents

      public StreamParameters withMaxUncommittedEvents(int maxUncommittedEvents)
    • getBatchLimit

      public Optional<Integer> getBatchLimit()
    • getStreamLimit

      public Optional<Integer> getStreamLimit()
    • getBatchFlushTimeout

      public Optional<Integer> getBatchFlushTimeout()
    • getStreamTimeout

      public Optional<Integer> getStreamTimeout()
    • getStreamKeepAliveLimit

      public Optional<Integer> getStreamKeepAliveLimit()
    • getMaxUncommittedEvents

      public Optional<Integer> getMaxUncommittedEvents()
    • getCommitTimeout

      public Optional<Integer> getCommitTimeout()