pub struct OutboxMessage {Show 14 fields
pub message_id: OutboxMessageId,
pub stream_id: StreamId,
pub process_id: ProcessId,
pub tenant_id: TenantId,
pub correlation_id: CorrelationId,
pub conversation_id: ConversationId,
pub causation_event_id: EventId,
pub message_type: Box<str>,
pub recipient: Box<str>,
pub payload: Value,
pub payload_schema: Option<Box<str>>,
pub created_at: OffsetDateTime,
pub deliver_after: Option<OffsetDateTime>,
pub attempt_count: u32,
}Expand description
An outbound message queued for delivery via AS4 or another channel.
The message carries both routing information (recipient, message_type)
and full correlation metadata so the delivery worker can trace every send
back to the domain event that caused it.
Construct with OutboxMessage::new and optionally chain
OutboxMessage::with_deliver_after for deferred delivery.
Fields§
§message_id: OutboxMessageIdStable unique identifier for this outbox entry.
stream_id: StreamIdThe process stream that produced this outbound message.
process_id: ProcessIdThe MaKo process instance.
tenant_id: TenantIdThe tenant sending this message.
correlation_id: CorrelationIdPropagated correlation root from the triggering event.
conversation_id: ConversationIdBusiness conversation this message belongs to (e.g. UTILMD ↔ APERAK).
causation_event_id: EventIdThe persisted event that directly caused this outbound message.
message_type: Box<str>EDIFACT or XML message type (e.g. "APERAK", "CONTRL", "UTILMD").
recipient: Box<str>GLN or EIC code of the intended recipient market participant.
payload: ValueSerialized message payload.
Typically a JSON-encoded string of EDIFACT bytes or a structured JSON object for non-EDIFACT channels.
payload_schema: Option<Box<str>>BO4E JSON Schema URL that validates payload, if present.
None for raw EDIFACT or untyped payloads. Set by domain workflows
via PendingOutbox::with_schema when the payload is a BO4E object.
created_at: OffsetDateTimeWhen this entry was created.
deliver_after: Option<OffsetDateTime>Do not deliver before this time.
None means deliver immediately (as soon as the delivery worker runs).
attempt_count: u32Number of delivery attempts so far. Starts at 0, incremented by
OutboxStore::reschedule.
Implementations§
Source§impl OutboxMessage
impl OutboxMessage
Sourcepub fn new(
stream_id: StreamId,
process_id: ProcessId,
tenant_id: TenantId,
correlation_id: CorrelationId,
conversation_id: ConversationId,
causation_event_id: EventId,
message_type: impl Into<Box<str>>,
recipient: impl Into<Box<str>>,
payload: Value,
) -> Self
pub fn new( stream_id: StreamId, process_id: ProcessId, tenant_id: TenantId, correlation_id: CorrelationId, conversation_id: ConversationId, causation_event_id: EventId, message_type: impl Into<Box<str>>, recipient: impl Into<Box<str>>, payload: Value, ) -> Self
Construct a new outbox message.
message_id and created_at are generated automatically.
attempt_count is initialized to 0.
Call OutboxMessage::with_deliver_after to schedule deferred
delivery.
Sourcepub fn with_deliver_after(self, deliver_after: OffsetDateTime) -> Self
pub fn with_deliver_after(self, deliver_after: OffsetDateTime) -> Self
Set a deferred delivery time.
The message will not appear in OutboxStore::pending results until
now >= deliver_after.
Trait Implementations§
Source§impl Clone for OutboxMessage
impl Clone for OutboxMessage
Source§fn clone(&self) -> OutboxMessage
fn clone(&self) -> OutboxMessage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more