Handling
import { Workflow } from '@node-ts/bus-core'
export class FulfilmentWorkflow extends Workflow<FulfilmentWorkflowState> {
configureWorkflow (
mapper: WorkflowMapper<FulfilmentWorkflowState, FulfilmentWorkflow>
): void {
mapper
.withState(FulfilmentWorkflowState)
// ...
// When the item is shipped, email the customer their receipt
.when(ItemShipped, 'emailReceipt')
}
// Handles an `ItemShipped` event
async emailReceipt (event: ItemShipped) {
// ...
}
}Default mapping
Mapping via message properties
Mapping via message attributes
Last updated