Function akka_persistence_rs::entity_manager::task
source · pub fn task<A, B>(
behavior: B,
adapter: A,
command_capacity: usize,
entity_capacity: usize
) -> (impl Future<Output = Result<()>>, Sender<Message<B::Command>>)where
B: EventSourcedBehavior + Send + Sync + 'static,
B::Command: Send,
B::State: Send + Sync,
A: SourceProvider<B::Event> + Handler<B::Event> + Send + 'static,
Expand description
Provides an asynchronous task and a command channel that can run and drive an entity manager.
Entity managers manage the lifecycle of entities given a specific behavior. They are established given an adapter of persistent events associated with an entity type. That source is consumed by subsequently telling the entity manager to run, generally on its own task. Events are persisted by calling on the adapter’s handler.
Commands are sent to a channel established for the entity manager. Effects may be produced as a result of performing a command, which may, in turn, perform side effects and yield events.
command_capacity
declares size of the command channel and will panic at runtime if zero.entity_capacity
declares size of the number of entities to cache in memory at one time, and will panic at runtime if zero.