pub struct JobExecutor<D>{ /* private fields */ }Expand description
Extracted execution logic for events and handlers.
This struct consolidates the pure execution logic that was previously scattered across EventWorker and HandlerWorker implementations.
Implementations§
Source§impl<D> JobExecutor<D>
impl<D> JobExecutor<D>
Sourcepub fn new(
deps: Arc<D>,
queue: Arc<dyn HandlerQueue>,
handlers: Arc<HandlerRegistry<D>>,
aggregator_registry: Arc<AggregatorRegistry>,
upcasters: Arc<UpcasterRegistry>,
global_dlq_mapper: Option<GlobalDlqMapper>,
) -> Self
pub fn new( deps: Arc<D>, queue: Arc<dyn HandlerQueue>, handlers: Arc<HandlerRegistry<D>>, aggregator_registry: Arc<AggregatorRegistry>, upcasters: Arc<UpcasterRegistry>, global_dlq_mapper: Option<GlobalDlqMapper>, ) -> Self
Create a new job executor.
Sourcepub async fn process_event(
&self,
event: &PersistedEvent,
_config: &EventWorkerConfig,
) -> Result<IntentCommit>
pub async fn process_event( &self, event: &PersistedEvent, _config: &EventWorkerConfig, ) -> Result<IntentCommit>
Process a persisted event: create handler intents and run projections.
All matching handlers become queued handler intents. Only projections (observers) run inline during event processing.
Returns an IntentCommit that the caller enqueues via HandlerQueue::enqueue.
Process an event: decode, route to handlers, build intents, run projections.
When skip_projections is true, projections are not executed. This is
used for ephemeral events which route through handlers but skip
persistence, aggregators, and projections.
pub async fn process_event_inner( &self, event: &PersistedEvent, _config: &EventWorkerConfig, skip_projections: bool, ) -> Result<IntentCommit>
Sourcepub async fn execute_handler(
&self,
execution: QueuedHandler,
config: &HandlerWorkerConfig,
) -> Result<HandlerResult>
pub async fn execute_handler( &self, execution: QueuedHandler, config: &HandlerWorkerConfig, ) -> Result<HandlerResult>
Execute a queued handler.
Sourcepub async fn run_startup_handlers(&self) -> Result<()>
pub async fn run_startup_handlers(&self) -> Result<()>
Run startup handlers.
Sourcepub fn handler_registry(&self) -> &Arc<HandlerRegistry<D>>
pub fn handler_registry(&self) -> &Arc<HandlerRegistry<D>>
Get handler registry reference.