Trait nakadion::HandlerFactory
[−]
[src]
pub trait HandlerFactory { type Handler: BatchHandler + Send + 'static; fn create_handler(
&self,
partition: &PartitionId
) -> Result<Self::Handler, CreateHandlerError>; }
A factory that creates BatchHandler
s.
Usage
A HandlerFactory
can be used in two ways:
-
It does not contain any state it shares with the created
BatchHandler
s. This is useful when incoming data is partitioned in a way that allBatchHandler
s act only on data that never appears on another partition. -
It contains state that is shared with the
BatchHandler
s. E.g. a cache that conatins data that can appear on other partitions.
Associated Types
type Handler: BatchHandler + Send + 'static
Required Methods
fn create_handler(
&self,
partition: &PartitionId
) -> Result<Self::Handler, CreateHandlerError>
&self,
partition: &PartitionId
) -> Result<Self::Handler, CreateHandlerError>