How Do I Model Effects And Integrations?
Use effects for externally meaningful work. An integration is modelled as an effect such as an invocation, not as a transport-specific endpoint.
Order Effects Explicitly
The after phrase expresses dependency between effects without
relying on source order alone. Outcome causation can then refer to unresolved
integration effects.
language dcl 0.9
actor Customer is human
effect PersistPaymentAttempt is persistence
effect CallPaymentGateway is invocation
effect SendPaymentReceipt is notification
shape PaymentAuthorisationInput {
paymentId: Uuid required
amount: Money required
}
event PaymentAuthorised is {
paymentId: Uuid required
}
capability AuthorisePayment {
intent PaymentAuthorisationInput from Customer
outcomes {
PaymentAuthorised
PaymentGatewayUnavailable
}
effects {
PersistPaymentAttempt
CallPaymentGateway after PersistPaymentAttempt
SendPaymentReceipt after CallPaymentGateway
}
events {
emits PaymentAuthorised
}
when {
CallPaymentGateway unresolved then PaymentGatewayUnavailable
otherwise then PaymentAuthorised
}
}