Skip to main content

Events

Outbox types are written with OutboxWriterService inside prisma.$transaction. The worker dispatcher emits the eventType string.

Outbox types​

eventTypeProducers foundListeners
order.createdorder command, marketplace ingestionOrderFulfillmentListener
order.confirmedorder commandWalletListener
order.location.changedorder commandOrderFulfillmentListener
order.status.changedorder status service, return commandOrderFulfillmentListener, OutboundOrderSyncListener
order.address.resolution_triggeredorder commandWhatsAppAddressResolutionListener
stock.sync.requestedorder command, stock count, fulfillment, returns, stock transfer, goods receipt, allocationProductStockSyncListener
stock.receivedstock commandStockAllocationListener

Constants: STOCK_EVENTS.SYNC_REQUESTED = stock.sync.requested, STOCK_EVENTS.RECEIVED = stock.received.

Payload classes under src/common/events (for example OrderCreatedEvent) exist. Dispatch is still the string name.

Code map​

PiecePath
Fulfillment on order eventsorder-fulfillment.listener.ts
Wallet debitwallet.listener.ts
Outbound channel statusoutbound-order-sync.listener.ts
Stock arrivalstock-allocation.listener.ts
Inventory publish bufferproduct-stock-sync.listener.ts
WhatsApp addresswhatsapp-address-resolution.listener.ts
Shipment to fulfillmentshipment-fulfillment.listener.ts
NDRndr-shipment.listener.ts
Return shipmentreturn-shipment.listener.ts

shipment.status.changed is in-process, not an outbox type found in the enqueue scan.

Failure​

A throw inside the business transaction rolls back the aggregate and the outbox row together. A throw in a listener happens after commit. The dispatcher retries. See Wallet debit for the comment that disagrees with the throw.

How to add an event: Adding an event.