Enum nakadion::consumer::StreamDeadPolicy [−][src]
#[non_exhaustive]
pub enum StreamDeadPolicy {
Never,
NoFramesFor {
seconds: u32,
},
NoEventsFor {
seconds: u32,
},
}
Expand description
Specifies when a stream is considered dead and has to be aborted.
Once a stream is considered dead a reconnect for a new stream will be attempted.
The default is NoFramesFor { seconds: 300 }
FromStr
use nakadion::consumer::StreamDeadPolicy;
let policy = "never".parse::<StreamDeadPolicy>().unwrap();
assert_eq!(policy, StreamDeadPolicy::Never);
let policy = "no_frames_for_seconds 1".parse::<StreamDeadPolicy>().unwrap();
assert_eq!(
policy,
StreamDeadPolicy::NoFramesFor { seconds: 1}
);
let policy = "no_events_for_seconds 2".parse::<StreamDeadPolicy>().unwrap();
assert_eq!(
policy,
StreamDeadPolicy::NoEventsFor { seconds: 2}
);
JSON is also valid:
use nakadion::consumer::StreamDeadPolicy;
let policy = r#""never""#.parse::<StreamDeadPolicy>().unwrap();
assert_eq!(policy, StreamDeadPolicy::Never);
let policy = r#"{"no_frames_for":{"seconds": 1}}"#.parse::<StreamDeadPolicy>().unwrap();
assert_eq!(
policy,
StreamDeadPolicy::NoFramesFor { seconds: 1}
);
let policy = r#"{"no_events_for":{"seconds": 2}}"#.parse::<StreamDeadPolicy>().unwrap();
assert_eq!(
policy,
StreamDeadPolicy::NoEventsFor { seconds: 2}
);
Environment variables
Fetching values from the environment uses FromStr
for parsing
Variants (Non-exhaustive)
This enum is marked as non-exhaustive
The stream is never considered dead
The stream is considered dead if no frames (lines) have
been received from Nakadi for seconds
Fields of NoFramesFor
seconds: u32
The stream is considered dead if no events (lines with events) have
been received from Nakadi for seconds
Fields of NoEventsFor
seconds: u32
Implementations
The default name of the environment variable for this type. The name of the environment variable is “ STREAM_DEAD_POLICY “
Initialize from the environment.
Returns None
if the value was not found and fails if the value could not be parsed.
The name of the environment variable is “NAKADION_
STREAM_DEAD_POLICY
“
Initialize from the environment.
Returns None
if the value was not found and fails if the value could not be parsed.
The name of the environment variable is “prefix
_
STREAM_DEAD_POLICY
“
The underscore and prefix will be omitted if prefix is empty.
Initialize from the environment.
Returns None
if the value was not found and fails if the value could not be parsed.
The name of the environment variable is var_name
.
Initialize from the environment.
Returns None
if the value was not found and fails if the value could not be parsed.
The name of the environment variable is “
STREAM_DEAD_POLICY
“
Initialize from the environment. Fails if the value was not found or if the value could not be parsed. The name of the environment variable is “NAKADION_ STREAM_DEAD_POLICY “
Initialize from the environment.
Fails if the value was not found or if the value could not be parsed.
The name of the environment variable is “prefix
_
STREAM_DEAD_POLICY
“
The underscore and prefix will be omitted if prefix is empty.
Initialize from the environment.
Fails if the value was not found or if the value could not be parsed.
The name of the environment variable is var_name
.
Initialize from the environment. Fails if the value was not found or if the value could not be parsed. The name of the environment variable is “ STREAM_DEAD_POLICY “
Initialize from the environment.
Returns None
if the value could not be read for any reason.
The name of the environment variable is “NAKADION_
STREAM_DEAD_POLICY
“
Initialize from the environment.
Returns None
if the value could not be read for any reason.
The name of the environment variable is “prefix
_
STREAM_DEAD_POLICY
“
The underscore and prefix will be omitted if prefix is empty.
Initialize from the environment.
Returns None
if the value could not be read for any reason.
The name of the environment variable is var_name
.
Initialize from the environment.
Returns None
if the value could not be read for any reason.
The name of the environment variable is “
STREAM_DEAD_POLICY
“
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl RefUnwindSafe for StreamDeadPolicy
impl Send for StreamDeadPolicy
impl Sync for StreamDeadPolicy
impl Unpin for StreamDeadPolicy
impl UnwindSafe for StreamDeadPolicy
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more