feat: event infrastructure — payload, transport, NATS adapter
- EventPublisher now takes &DomainEvent (11 call sites + 3 impls updated) - EventEnvelope + EventConsumer port in domain - event-payload: serializable DomainEvent mirror with subject routing - event-transport: generic Transport/MessageSource traits, publisher/consumer adapters - adapters-nats: JetStream publish + durable pull consumer
This commit is contained in:
@@ -49,7 +49,7 @@ impl CompleteJobHandler {
|
||||
self.batch_repo.save(&batch).await?;
|
||||
}
|
||||
self.event_pub
|
||||
.publish(DomainEvent::JobCompleted {
|
||||
.publish(&DomainEvent::JobCompleted {
|
||||
job_id: job.job_id,
|
||||
timestamp: DateTimeStamp::now(),
|
||||
})
|
||||
|
||||
@@ -39,7 +39,7 @@ impl EnqueueJobHandler {
|
||||
}
|
||||
self.job_repo.save(&job).await?;
|
||||
self.event_pub
|
||||
.publish(DomainEvent::JobEnqueued {
|
||||
.publish(&DomainEvent::JobEnqueued {
|
||||
job_id: job.job_id,
|
||||
job_type: format!("{:?}", cmd.job_type),
|
||||
timestamp: DateTimeStamp::now(),
|
||||
|
||||
@@ -77,7 +77,7 @@ impl ExecutePipelineHandler {
|
||||
self.job_repo.save(&job).await?;
|
||||
self.update_batch_on_complete(&job).await?;
|
||||
self.event_pub
|
||||
.publish(DomainEvent::JobCompleted {
|
||||
.publish(&DomainEvent::JobCompleted {
|
||||
job_id: job.job_id,
|
||||
timestamp: DateTimeStamp::now(),
|
||||
})
|
||||
@@ -89,7 +89,7 @@ impl ExecutePipelineHandler {
|
||||
self.job_repo.save(&job).await?;
|
||||
self.update_batch_on_fail(&job).await?;
|
||||
self.event_pub
|
||||
.publish(DomainEvent::JobFailed {
|
||||
.publish(&DomainEvent::JobFailed {
|
||||
job_id: job.job_id,
|
||||
error: error_msg,
|
||||
timestamp: DateTimeStamp::now(),
|
||||
|
||||
@@ -49,7 +49,7 @@ impl FailJobHandler {
|
||||
self.batch_repo.save(&batch).await?;
|
||||
}
|
||||
self.event_pub
|
||||
.publish(DomainEvent::JobFailed {
|
||||
.publish(&DomainEvent::JobFailed {
|
||||
job_id: job.job_id,
|
||||
error: cmd.error,
|
||||
timestamp: DateTimeStamp::now(),
|
||||
@@ -57,7 +57,7 @@ impl FailJobHandler {
|
||||
.await?;
|
||||
} else if job.status == JobStatus::Queued {
|
||||
self.event_pub
|
||||
.publish(DomainEvent::JobEnqueued {
|
||||
.publish(&DomainEvent::JobEnqueued {
|
||||
job_id: job.job_id,
|
||||
job_type: format!("{:?}", job.job_type),
|
||||
timestamp: DateTimeStamp::now(),
|
||||
|
||||
Reference in New Issue
Block a user