Struct nakadion::NakadionBuilder [−][src]
pub struct NakadionBuilder { pub streaming_client_builder: ConfigBuilder, pub request_timeout: Option<Duration>, pub commit_strategy: Option<CommitStrategy>, pub subscription_discovery: Option<SubscriptionDiscovery>, pub min_idle_worker_lifetime: Option<Duration>, }
Build a NakadionConfig
or directly build and start Nakadion
Fields
streaming_client_builder: ConfigBuilder
The configuration of the streaming client used to connect to the stream.
The defaults are defaults of streaming_client::ConfigBuilder
request_timeout: Option<Duration>
The request timeout used when committing events
commit_strategy: Option<CommitStrategy>
The CommitStrategy
to use for committing cursors
subscription_discovery: Option<SubscriptionDiscovery>
Used for discovering/creating the subscription to consume
min_idle_worker_lifetime: Option<Duration>
The time after which a worker that received no events will be shut down. The default is to never shut down workers.
Methods
impl NakadionBuilder
[src]
impl NakadionBuilder
pub fn stream_keep_alive_limit(
self,
stream_keep_alive_limit: usize
) -> NakadionBuilder
[src]
pub fn stream_keep_alive_limit(
self,
stream_keep_alive_limit: usize
) -> NakadionBuilder
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) -> NakadionBuilder
[src]
pub fn stream_limit(self, stream_limit: usize) -> NakadionBuilder
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) -> NakadionBuilder
[src]
pub fn stream_timeout(self, stream_timeout: Duration) -> NakadionBuilder
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
) -> NakadionBuilder
[src]
pub fn batch_flush_timeout(
self,
batch_flush_timeout: Duration
) -> NakadionBuilder
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) -> NakadionBuilder
[src]
pub fn batch_limit(self, batch_limit: usize) -> NakadionBuilder
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
) -> NakadionBuilder
[src]
pub fn max_uncommitted_events(
self,
max_uncommitted_events: usize
) -> NakadionBuilder
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) -> NakadionBuilder
[src]
pub fn nakadi_host<T: Into<String>>(self, nakadi_host: T) -> NakadionBuilder
The URI prefix for the Nakadi Host, e.g. "https://my.nakadi.com"
pub fn request_timeout(self, request_timeout: Duration) -> NakadionBuilder
[src]
pub fn request_timeout(self, request_timeout: Duration) -> NakadionBuilder
The request timeout used when committing events
pub fn commit_strategy(self, commit_strategy: CommitStrategy) -> NakadionBuilder
[src]
pub fn commit_strategy(self, commit_strategy: CommitStrategy) -> NakadionBuilder
The time after which a worker that received no events will be shut down. The default is to never shut down workers.
pub fn subscription_discovery(
self,
subscription_discovery: SubscriptionDiscovery
) -> NakadionBuilder
[src]
pub fn subscription_discovery(
self,
subscription_discovery: SubscriptionDiscovery
) -> NakadionBuilder
pub fn min_idle_worker_lifetime(
self,
min_idle_worker_lifetime: Option<Duration>
) -> NakadionBuilder
[src]
pub fn min_idle_worker_lifetime(
self,
min_idle_worker_lifetime: Option<Duration>
) -> NakadionBuilder
pub fn set_min_idle_worker_lifetime(
self,
min_idle_worker_lifetime: Duration
) -> NakadionBuilder
[src]
pub fn set_min_idle_worker_lifetime(
self,
min_idle_worker_lifetime: Duration
) -> NakadionBuilder
pub fn from_env() -> Result<NakadionBuilder, Error>
[src]
pub fn from_env() -> Result<NakadionBuilder, Error>
Create a new builder from environment variables.
Environment Variables:
NAKADION_NAKADI_HOST
: SeeNakadionBuilder::nakadi_host
NAKADION_MAX_UNCOMMITED_EVENTS
: SeeNakadionBuilder::max_uncommitted_events
NAKADION_BATCH_LIMIT
: SeeNakadionBuilder::batch_limit
NAKADION_BATCH_FLUSH_TIMEOUT_SECS
: SeeNakadionBuilder::batch_flush_timeout
NAKADION_STREAM_TIMEOUT_SECS
: SeeNakadionBuilder::stream_timeout
NAKADION_STREAM_LIMIT
: SeeNakadionBuilder::stream_limit
NAKADION_STREAM_KEEP_ALIVE_LIMIT´: See
NakadionBuilder::stream_keep_alive_limit`NAKADION_REQUEST_TIMEOUT_MS
: SeeNakadionBuilder::request_timeout
NAKADION_COMMIT_STRATEGY
: SeeNakadionBuilder::commit_strategy
. Value must be the JSON representation of aCommitStrategy
.NAKADION_SUBSCRIPTION_DISCOVERY
: SeeNakadionBuilder::subscription_discovery
. Value must be the JSON representation of aSubscriptionDiscovery
.NAKADION_MIN_IDLE_WORKER_LIFETIME_SECS
: SeeNakadionBuilder::min_idle_worker_lifetime
Errors
A value from an existing environment variable was not parsable
pub fn build_config(self) -> Result<NakadionConfig, Error>
[src]
pub fn build_config(self) -> Result<NakadionConfig, Error>
pub fn build_and_start<HF, P>(
self,
handler_factory: HF,
access_token_provider: P
) -> Result<Nakadion, Error> where
HF: HandlerFactory + Sync + Send + 'static,
P: ProvidesAccessToken + Send + Sync + 'static,
[src]
pub fn build_and_start<HF, P>(
self,
handler_factory: HF,
access_token_provider: P
) -> Result<Nakadion, Error> where
HF: HandlerFactory + Sync + Send + 'static,
P: ProvidesAccessToken + Send + Sync + 'static,
Build and start Nakadion
from this builder
No metrics will be collected.
Errors
Not all mandatory values have been set or
creating Nakadion
failed.
pub fn build_and_start_with_metrics<HF, P, M>(
self,
handler_factory: HF,
access_token_provider: P,
metrics_collector: M
) -> Result<Nakadion, Error> where
HF: HandlerFactory + Sync + Send + 'static,
P: ProvidesAccessToken + Send + Sync + 'static,
M: MetricsCollector + Clone + Send + Sync + 'static,
[src]
pub fn build_and_start_with_metrics<HF, P, M>(
self,
handler_factory: HF,
access_token_provider: P,
metrics_collector: M
) -> Result<Nakadion, Error> where
HF: HandlerFactory + Sync + Send + 'static,
P: ProvidesAccessToken + Send + Sync + 'static,
M: MetricsCollector + Clone + Send + Sync + 'static,
Build and start Nakadion
from this builder
The given MetricsCollector
will be used to collect metrics
Errors
Not all mandatory values have been set or
creating Nakadion
failed.
Trait Implementations
impl Default for NakadionBuilder
[src]
impl Default for NakadionBuilder
fn default() -> NakadionBuilder
[src]
fn default() -> NakadionBuilder
Returns the "default value" for a type. Read more
Auto Trait Implementations
impl Send for NakadionBuilder
impl Send for NakadionBuilder
impl Sync for NakadionBuilder
impl Sync for NakadionBuilder