[][src]Struct nakadion::consumer::ConnectConfig

pub struct ConnectConfig {
    pub stream_parameters: StreamParameters,
    pub abort_on_auth_error: Option<ConnectAbortOnAuthError>,
    pub abort_on_conflict: Option<ConnectAbortOnConflict>,
    pub abort_connect_on_subscription_not_found: Option<ConnectAbortOnSubscriptionNotFound>,
    pub timeout_secs: Option<ConnectTimeout>,
    pub max_retry_delay_secs: Option<ConnectMaxRetryDelaySecs>,
    pub attempt_timeout_secs: Option<ConnectAttemptTimeoutSecs>,
}

Parameters to configure the Connector

See also Nakadi Manual

Example

use nakadion::components::connector::{ConnectConfig, ConnectTimeout};

let cfg = ConnectConfig::default()
    .abort_on_auth_error(true)
    .timeout_secs(25u64);

assert_eq!(cfg.abort_on_auth_error, Some(true.into()));
assert_eq!(cfg.timeout_secs, Some(ConnectTimeout::Seconds(25)));

Fields

stream_parameters: StreamParameters

StreamParameters used to configure the stream consumed from Nakadi

abort_on_auth_error: Option<ConnectAbortOnAuthError>

If set to true auth error will not cause a retry on connect attempts

abort_on_conflict: Option<ConnectAbortOnConflict>

If set to true conflicts (Status 409) will not cause a retry on connect attempts

abort_connect_on_subscription_not_found: Option<ConnectAbortOnSubscriptionNotFound>

If true abort the consumer when a subscription does not exist when connection to a stream.

It can make sense if the subscription is expected to not already be there on startup and waiting for it to became available is intended.

The default is true

timeout_secs: Option<ConnectTimeout>

The maximum time for until a connection to a stream has to be established.

When elapsed and no stream could be connected to, the Connector fails

Default is to retry indefinitely

max_retry_delay_secs: Option<ConnectMaxRetryDelaySecs>

The maximum retry delay between failed attempts to connect to a stream.

attempt_timeout_secs: Option<ConnectAttemptTimeoutSecs>

The timeout for a request made to Nakadi to connect to a stream.

Implementations

impl ConnectConfig[src]

pub fn from_env() -> Result<Self, Error>[src]

Initializes all fields from environment variables prefixed with "NAKADION_"

pub fn from_env_prefixed<T: AsRef<str>>(prefix: T) -> Result<Self, Error>[src]

Initializes all fields from environment variables prefixed with "[prefix]_" The underscore is omitted if prefix is empty

pub fn from_env_type_names() -> Result<Self, Error>[src]

Initializes all fields from environment variables without any prefix

pub fn fill_from_env(&mut self) -> Result<(), Error>[src]

Updates all not yet set fields from environment variables prefixed with "NAKADION_"

pub fn fill_from_env_prefixed<T: AsRef<str>>(
    &mut self,
    prefix: T
) -> Result<(), Error>
[src]

Updates all not yet set fields from environment variables prefixed with "[prefix]_" The underscore is omitted if prefix is empty

pub fn fill_from_env_type_names(&mut self) -> Result<(), Error>[src]

Updates all not yet set fields from environment variables without any prefix

pub fn apply_defaults(&mut self)[src]

Fills not set values with default values.

The filled in values are those which would be used if a value was not set.

pub fn stream_parameters<T: Into<StreamParameters>>(self, v: T) -> Self[src]

StreamParameters used to configure the stream consumed from Nakadi

pub fn abort_on_auth_error<T: Into<ConnectAbortOnAuthError>>(self, v: T) -> Self[src]

If set to true auth error will not cause a retry on connect attempts

pub fn abort_on_conflict<T: Into<ConnectAbortOnConflict>>(self, v: T) -> Self[src]

If set to true conflicts (Status 409) will not cause a retry on connect attempts

pub fn abort_connect_on_subscription_not_found<T: Into<ConnectAbortOnSubscriptionNotFound>>(
    self,
    v: T
) -> Self
[src]

If true abort the consumer when a subscription does not exist when connection to a stream.

pub fn timeout_secs<T: Into<ConnectTimeout>>(self, v: T) -> Self[src]

The maximum time for until a connection to a stream has to be established.

Default is to retry indefinitely

pub fn max_retry_delay_secs<T: Into<ConnectMaxRetryDelaySecs>>(
    self,
    v: T
) -> Self
[src]

The maximum retry delay between failed attempts to connect to a stream.

pub fn attempt_timeout_secs<T: Into<ConnectAttemptTimeoutSecs>>(
    self,
    v: T
) -> Self
[src]

The timeout for a request made to Nakadi to connect to a stream.

pub fn configure_stream_parameters<F>(self, f: F) -> Self where
    F: FnMut(StreamParameters) -> StreamParameters
[src]

Modify the current StreamParameters with a closure.

pub fn try_configure_stream_parameters<F>(self, f: F) -> Result<Self, Error> where
    F: FnMut(StreamParameters) -> Result<StreamParameters, Error>, 
[src]

Modify the current StreamParameters with a closure.

Trait Implementations

impl Clone for ConnectConfig[src]

impl Debug for ConnectConfig[src]

impl Default for ConnectConfig[src]

impl<'de> Deserialize<'de> for ConnectConfig[src]

impl Serialize for ConnectConfig[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SendSyncUnwindSafe for T where
    T: Send + Sync + UnwindSafe + ?Sized

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,