This recipe maps owned commands and events to a queue without treating broker
acknowledgement as a domain result. The .one syntax is illustrative end-product
syntax.
Declare the semantic edges
operation Orders.Place@1
accepts PlaceOrderRequest
returns PlaceOrderResponse
faults OrdersPlaceFault
effect irreversible
idempotency operation(window: 24h)
event OrderPlaced@1
payload OrderPlacedEvent
ordering customer
retention 7d
Select a messaging projection
interface OrdersMessaging@1
command parcelhub.orders#Orders.Place@1
channel "orders.place"
key input.customer_id
delivery at_least_once
acknowledgement accepted_for_delivery
event parcelhub.orders#OrderPlaced@1
channel "orders.placed"
key payload.customer_id
cursor broker_offset
The profile owns envelope, key, acknowledgement, retry, dead-letter, deduplication, ordering, cursor, and fault mappings.
Consume with exact dispositions
match delivery.handle().await {
Applied(receipt) => delivery.ack(receipt).await?,
Rejected(fault) => delivery.reject(fault).await?,
OutcomeUnknown(effect) => delivery.suspend(effect).await?,
Retryable(cause) => delivery.retry_within_budget(cause).await?,
}
See communication and Handle failures.