[−][src]Enum nakadion::consumer::DispatchMode
Defines how to dispatch batches to handlers.
FromStr
use nakadion::consumer::DispatchMode; let strategy = "all_seq".parse::<DispatchMode>().unwrap(); assert_eq!(strategy, DispatchMode::AllSeq); let strategy = "event_type_par".parse::<DispatchMode>().unwrap(); assert_eq!(strategy, DispatchMode::EventTypePar); let strategy = "event_type_partition_par".parse::<DispatchMode>().unwrap(); assert_eq!(strategy, DispatchMode::EventTypePartitionPar);
JSON is also valid:
use nakadion::consumer::DispatchMode; let strategy = "\"all_seq\"".parse::<DispatchMode>().unwrap(); assert_eq!(strategy, DispatchMode::AllSeq); let strategy = "\"event_type_par\"".parse::<DispatchMode>().unwrap(); assert_eq!(strategy, DispatchMode::EventTypePar); let strategy = "\"event_type_partition_par\"".parse::<DispatchMode>().unwrap(); assert_eq!(strategy, DispatchMode::EventTypePartitionPar);
Environment variables
Fetching values from the environment uses FromStr
for parsing.
Variants (Non-exhaustive)
Dispatch all batches to a single worker(handler)
This means batches all are processed sequentially by a single handler.
This will always request a handler with HandlerAssignment::Unspecified
from the BatchHandlerFactory
.
This means that if multiple event types are consumed, the handler is responsible
for determining the event type to be processed from BatchMeta
.
It is suggested to not use this strategy if multiple event types are expected.
Dispatch all batches to a dedicated worker for an event type.
This means batches are processed sequentially for each event type but the maximum parallelism is the number of event types.
This will always request a handler with HandlerAssignment::EventType(EventTypeName)
from the BatchHandlerFactory
.
This is the default DispatchMode
.
Dispatch all batches to a dedicated worker for an partition on each event type.
This means batches are processed sequentially for each individual partition of an event type. The maximum parallelism is the sum of each event type multiplied by its number of partitions.
This will always request a handler with
HandlerAssignment::EventTypePartition(EventTypePartitionName)
from the BatchHandlerFactory
.
Methods
impl DispatchMode
[src]
pub fn try_from_env() -> Result<Option<Self>, Error>
[src]
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_ DISPATCH_MODE "
pub fn try_from_env_prefixed<T: Into<String>>(
prefix: T
) -> Result<Option<Self>, Error>
[src]
prefix: T
) -> Result<Option<Self>, Error>
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
_
DISPATCH_MODE
"
pub fn try_from_env_named<T: AsRef<str>>(
var_name: T
) -> Result<Option<Self>, Error>
[src]
var_name: T
) -> Result<Option<Self>, Error>
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
.
pub fn from_env() -> Result<Self, Error>
[src]
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_ DISPATCH_MODE "
pub fn from_env_prefixed<T: Into<String>>(prefix: T) -> Result<Self, Error>
[src]
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
_
DISPATCH_MODE
"
pub fn from_env_named<T: AsRef<str>>(var_name: T) -> Result<Self, Error>
[src]
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
.
pub fn from_env_opt() -> Option<Self>
[src]
Initialize from the environment.
Returns None
if the value could not be read for any reason.
The name of the environment variable is "NAKADION_ DISPATCH_MODE "
pub fn from_env_opt_prefixed<T: Into<String>>(prefix: T) -> Option<Self>
[src]
Initialize from the environment.
Returns None
if the value could not be read for any reason.
The name of the environment variable is "prefix
_
DISPATCH_MODE
"
pub fn from_env_opt_named<T: AsRef<str>>(var_name: T) -> Option<Self>
[src]
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
.
Trait Implementations
impl Clone for DispatchMode
[src]
fn clone(&self) -> DispatchMode
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for DispatchMode
[src]
impl Debug for DispatchMode
[src]
impl Default for DispatchMode
[src]
impl<'de> Deserialize<'de> for DispatchMode
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Display for DispatchMode
[src]
impl Eq for DispatchMode
[src]
impl FromStr for DispatchMode
[src]
type Err = Error
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
impl PartialEq<DispatchMode> for DispatchMode
[src]
fn eq(&self, other: &DispatchMode) -> bool
[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl Serialize for DispatchMode
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralEq for DispatchMode
[src]
impl StructuralPartialEq for DispatchMode
[src]
Auto Trait Implementations
impl RefUnwindSafe for DispatchMode
impl Send for DispatchMode
impl Sync for DispatchMode
impl Unpin for DispatchMode
impl UnwindSafe for DispatchMode
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SendSyncUnwindSafe for T where
T: Send + Sync + UnwindSafe + ?Sized,
T: Send + Sync + UnwindSafe + ?Sized,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,