Class StreamParameters
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionwithBatchFlushTimeout(int batchFlushTimeout) Maximum time in seconds to wait for the flushing of each chunk (per partition).withBatchLimit(int batchLimit) Maximum number of events in each chunk (and therefore per partition) of the stream.withBatchTimespan(int batchTimespan) Useful for batching events based on their received_at timestamp.withCommitTimeout(int commitTimeout) Maximum amount of seconds that Nakadi will be waiting for commit after sending a batch to a client.withMaxUncommittedEvents(int maxUncommittedEvents) The maximum number of uncommitted events that Nakadi will stream before pausing the stream.withStreamKeepAliveLimit(int streamKeepAliveLimit) Maximum number of empty keep alive batches to get in a row before closing the connection.withStreamLimit(int streamLimit) Maximum number of events in this stream (over all partitions being streamed in this connection).withStreamTimeout(int streamTimeout) Maximum time in seconds a stream will live before connection is closed by the server.
-
Constructor Details
-
StreamParameters
public StreamParameters()
-
-
Method Details
-
withBatchLimit
Maximum number of events in each chunk (and therefore per partition) of the stream.- Parameters:
batchLimit- Nakadi's default value (at the time of writing): 1. batchLimit must be lower or equal to streamLimit. A value of 0 (or less than 1) is rejected by Nakadi.- Throws:
IllegalArgumentException
-
withStreamLimit
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 streamLimit is lower than batchLimit.- Throws:
IllegalArgumentException
-
withBatchFlushTimeout
public StreamParameters withBatchFlushTimeout(int batchFlushTimeout) throws IllegalArgumentException Maximum time in seconds to wait for the flushing of each chunk (per partition).
If the amount of buffered Events reaches batchLimit before this batchFlushTimeout is reached, the messages are immediately flushed to the client and batch flush timer is reset.
If 0 or undefined, will assume 30 seconds.
Value is treated as a recommendation. Nakadi may flush chunks with a smaller timeout.
- Parameters:
batchFlushTimeout- Maximum time in seconds to wait for the flushing of each chunk (per partition). Nakadi's default value (at the time of writing): 30- Throws:
IllegalArgumentException
-
withStreamTimeout
Maximum time in seconds a stream will live before connection is closed by the server. If 0 or unspecified will stream for 1h ±10min.
If this timeout is reached, any pending messages (in the sense of stream_limit) will be flushed to the client.
Stream initialization will fail if streamTimeout is lower than batchFlushTimeout. If the streamTimeout is greater than max value (4200 seconds) - Nakadi will treat this as not specifying streamTimeout (this is done due to backwards compatibility).
- Parameters:
streamTimeout- Maximum time in seconds a stream will live before connection is closed by the server. Nakadi's default value (at the time of writing): 0 Stream initialization will fail if streamTimeout is lower than batchFlushTimeout- Throws:
IllegalArgumentException
-
withCommitTimeout
Maximum amount of seconds that Nakadi will be waiting for commit after sending a batch to a client. In case if 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. Setting commitTimeout to 0 is equal to setting it to the maximum allowed value: 60 seconds.- Parameters:
commitTimeout- Maximum amount of seconds that Nakadi will be waiting for commit after sending a batch to a client.
-
withStreamKeepAliveLimit
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. Nakadi's default value (at the time of writing): 0
-
withMaxUncommittedEvents
The maximum number of uncommitted events that Nakadi will stream before pausing the stream. When in paused state and commit comes - the stream will resume.- Parameters:
maxUncommittedEvents- Nakadi's default value (at the time of writing): 10
-
withBatchTimespan
Useful for batching events based on their received_at timestamp. Nakadi would flush a batch as soon as the difference in time between the first and the last event in the batch exceeds the batchTimespan.- Parameters:
batchTimespan- Nakadi's default (at the time of writing): 0, meaning "do not inspect timestamps".
-
getBatchLimit
- Returns:
- Maximum number of events in each chunk (and therefore per partition) of the stream.
-
getStreamLimit
- Returns:
- Maximum number of events in this stream (over all partitions being streamed in this connection).
-
getBatchFlushTimeout
- Returns:
- Maximum time in seconds to wait for the flushing of each chunk (per partition).
-
getStreamTimeout
- Returns:
- Maximum time in seconds a stream will live before connection is closed by the server.
-
getStreamKeepAliveLimit
- Returns:
- Maximum number of empty keep alive batches to get in a row before closing the connection.
-
getMaxUncommittedEvents
- Returns:
- The maximum number of uncommitted events that Nakadi will stream before pausing the stream.
-
getCommitTimeout
- Returns:
- Maximum amount of seconds that Nakadi will be waiting for commit after sending a batch to a client
-
getBatchTimespan
- Returns:
- Nakadi would flush a batch as soon as the difference in time between the first and the last event in the batch exceeds the batchTimespan.
-