Skip to main content

StreamParameters

Struct StreamParameters 

Source
pub struct StreamParameters {
    pub partitions: Vec<EventTypePartition>,
    pub max_uncommitted_events: Option<StreamMaxUncommittedEvents>,
    pub batch_limit: Option<StreamBatchLimit>,
    pub stream_limit: Option<StreamLimit>,
    pub batch_flush_timeout_secs: Option<StreamBatchFlushTimeoutSecs>,
    pub batch_timespan_secs: Option<StreamBatchTimespanSecs>,
    pub stream_timeout_secs: Option<StreamTimeoutSecs>,
    pub commit_timeout_secs: Option<StreamCommitTimeoutSecs>,
}
Expand description

Parameters for starting a new stream on a subscription

See also Nakadi Manual

§Environment

When initialized/updated from the environment the following environment variable are used which by are by default prefixed with “NAKADION_” or a custom prefix “_”:

  • “STREAM_MAX_UNCOMMITTED_EVENTS”
  • “STREAM_BATCH_LIMIT”
  • “STREAM_LIMIT”
  • “STREAM_BATCH_FLUSH_TIMEOUT_SECS”
  • “STREAM_BATCH_TIMESPAN_SECS”
  • “STREAM_TIMEOUT_SECS”
  • “STREAM_COMMIT_TIMEOUT_SECS”

Fields§

§partitions: Vec<EventTypePartition>

List of partitions to read from in this stream. If absent or empty - then the partitions will be automatically assigned by Nakadi.

§max_uncommitted_events: Option<StreamMaxUncommittedEvents>

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.

§batch_limit: Option<StreamBatchLimit>

Maximum number of Events in each chunk (and therefore per partition) of the stream.

§stream_limit: Option<StreamLimit>

Maximum number of Events in this stream (over all partitions being streamed in this connection)

§batch_flush_timeout_secs: Option<StreamBatchFlushTimeoutSecs>

Maximum time in seconds to wait for the flushing of each chunk (per partition).

§batch_timespan_secs: Option<StreamBatchTimespanSecs>

Useful for batching events based on their received_at timestamp. For example, if batch_timespan is 5 seconds then Nakadi would flush a batch as soon as the difference in time between the first and the last event in the batch exceeds 5 seconds. It waits for an event outside of the window to signal the closure of a batch.

§stream_timeout_secs: Option<StreamTimeoutSecs>

Maximum time in seconds a stream will live before connection is closed by the server.

If 0 or unspecified will stream for 1h ±10min.

§commit_timeout_secs: Option<StreamCommitTimeoutSecs>

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 commit_timeout to 0 is equal to setting it to the maximum allowed value - 60 seconds.

Implementations§

Source§

impl StreamParameters

Source

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

Initializes all fields from environment variables prefixed with “NAKADION_”

Source

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

Initializes all fields from environment variables prefixed with “[prefix]_”

The underscore is omitted if prefix is empty

Source

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

Initializes all fields from environment variables without any prefix

Source

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

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

Source

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

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

Source

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

Updates all not yet set fields from environment variables prefixed with “[prefix]_”

The underscore is omitted if prefix is empty

Source

pub fn apply_defaults(&mut self)

Source

pub fn partitions(self, partitions: Vec<EventTypePartition>) -> Self

List of partitions to read from in this stream. If absent or empty - then the partitions will be automatically assigned by Nakadi.

Source

pub fn max_uncommitted_events<T: Into<StreamMaxUncommittedEvents>>( self, value: T, ) -> Self

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.

Source

pub fn batch_limit<T: Into<StreamBatchLimit>>(self, value: T) -> Self

Maximum number of Events in each chunk (and therefore per partition) of the stream.

Source

pub fn stream_limit<T: Into<StreamLimit>>(self, value: T) -> Self

Maximum number of Events in this stream (over all partitions being streamed in this connection)

Source

pub fn batch_flush_timeout_secs<T: Into<StreamBatchFlushTimeoutSecs>>( self, value: T, ) -> Self

Maximum time in seconds to wait for the flushing of each chunk (per partition).

Source

pub fn batch_timespan_secs<T: Into<StreamBatchTimespanSecs>>( self, value: T, ) -> Self

Useful for batching events based on their received_at timestamp.

For example, if batch_timespan is 5 seconds then Nakadi would flush a batch as soon as the difference in time between the first and the last event in the batch exceeds 5 seconds. It waits for an event outside of the window to signal the closure of a batch.

Source

pub fn stream_timeout_secs<T: Into<StreamTimeoutSecs>>(self, value: T) -> Self

Maximum time in seconds a stream will live before connection is closed by the server..

Source

pub fn commit_timeout_secs<T: Into<StreamCommitTimeoutSecs>>( self, value: T, ) -> Self

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 commit_timeout to 0 is equal to setting it to the maximum allowed value - 60 seconds.

Source

pub fn effective_commit_timeout_secs(&self) -> u32

Returns the configured value or the Nakadi default

Source

pub fn effective_max_uncommitted_events(&self) -> u32

Returns the configured value or the Nakadi default

Source

pub fn effective_batch_limit(&self) -> u32

Returns the configured value or the Nakadi default

Trait Implementations§

Source§

impl Clone for StreamParameters

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StreamParameters

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for StreamParameters

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for StreamParameters

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for StreamParameters

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

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

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.