Struct nakadion::streaming_client::ConfigBuilder
[−]
[src]
pub struct ConfigBuilder { pub stream_keep_alive_limit: Option<usize>, pub stream_limit: Option<usize>, pub stream_timeout: Option<Duration>, pub batch_flush_timeout: Option<Duration>, pub batch_limit: Option<usize>, pub max_uncommitted_events: Option<usize>, pub nakadi_host: Option<String>, }
Builds a configuration for a Config
.
Fields
stream_keep_alive_limit: Option<usize>
stream_limit: Option<usize>
stream_timeout: Option<Duration>
batch_flush_timeout: Option<Duration>
batch_limit: Option<usize>
max_uncommitted_events: Option<usize>
nakadi_host: Option<String>
Methods
impl ConfigBuilder
[src]
pub fn stream_keep_alive_limit(
self,
stream_keep_alive_limit: usize
) -> ConfigBuilder
[src]
self,
stream_keep_alive_limit: usize
) -> ConfigBuilder
Maximum number of empty keep alive batches to get in a row before closing the connection. If 0 or undefined will send keep alive messages indefinitely.
pub fn stream_limit(self, stream_limit: usize) -> ConfigBuilder
[src]
Maximum number of Event
s in this stream (over all partitions being streamed
in this
connection).
- If 0 or undefined, will stream batches indefinitely.
- Stream initialization will fail if
stream_limit
is lower thanbatch_limit
.
pub fn stream_timeout(self, stream_timeout: Duration) -> ConfigBuilder
[src]
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.
Stream initialization will fail if stream_timeout
is lower than
batch_flush_timeout
.
pub fn batch_flush_timeout(self, batch_flush_timeout: Duration) -> ConfigBuilder
[src]
Maximum time in seconds to wait for the flushing of each chunk (per partition).
- If the amount of buffered Events reaches
batch_limit
before thisbatch_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.
pub fn batch_limit(self, batch_limit: usize) -> ConfigBuilder
[src]
Maximum number of Event
s in each chunk (and therefore per partition) of the
stream.
- If 0 or unspecified will buffer Events indefinitely and flush on reaching of
batch_flush_timeout
.
pub fn max_uncommitted_events(
self,
max_uncommitted_events: usize
) -> ConfigBuilder
[src]
self,
max_uncommitted_events: usize
) -> ConfigBuilder
The amount of uncommitted events Nakadi will stream before pausing the stream. When in paused state and commit comes - the stream will resume. Minimal value is 1.
When using the concurrent worker you should adjust this value to safe your workers from running dry.
pub fn nakadi_host<T: Into<String>>(self, nakadi_host: T) -> ConfigBuilder
[src]
The URI prefix for the Nakadi Host, e.g. "https://my.nakadi.com"
pub fn from_env() -> Result<ConfigBuilder, Error>
[src]
Create a builder from environment variables.
For variables not found except 'NAKADION_NAKADI_HOST' a default will be set.
Variables:
- NAKADION_NAKADI_HOST: See
ConfigBuilder::nakadi_host
- NAKADION_MAX_UNCOMMITED_EVENTS: See
ConfigBuilder::max_uncommitted_events
- NAKADION_BATCH_LIMIT: See
ConfigBuilder::batch_limit
- NAKADION_BATCH_FLUSH_TIMEOUT_SECS: See
ConfigBuilder::batch_flush_timeout
- NAKADION_STREAM_TIMEOUT_SECS: See
ConfigBuilder::stream_timeout
- NAKADION_STREAM_LIMIT: See
ConfigBuilder::stream_limit
- NAKADION_STREAM_KEEP_ALIVE_LIMIT: See
ConfigBuilder::stream_keep_alive_limit
pub fn build(self) -> Result<Config, Error>
[src]
Build a Config
from
pub fn build_client<T, M>(
self,
token_provider: T,
metrics_collector: M
) -> Result<NakadiStreamingClient<M>, Error> where
T: ProvidesAccessToken + Send + Sync + 'static,
M: MetricsCollector + Send + 'static,
[src]
self,
token_provider: T,
metrics_collector: M
) -> Result<NakadiStreamingClient<M>, Error> where
T: ProvidesAccessToken + Send + Sync + 'static,
M: MetricsCollector + Send + 'static,
Build a NakadiStreamingClient
from this builder.
[src]
Build a NakadiStreamingClient
from this builder.
Trait Implementations
impl Default for ConfigBuilder
[src]
fn default() -> ConfigBuilder
[src]
Returns the "default value" for a type. Read more