What is the difference between a transaction and completion message in a Daml trigger?

A trigger’s updateState function has the signature Message -> TriggerUpdateA s (). A Message can be a Transaction, Completion, or Heartbeat, which indicates that they’re mutually exclusive. However, Completion is the only message that includes a completion status.

For successful transactions, when would one receive a Completion rather than a Transaction?

And for a failed transaction, would one always receive a Completion rather than a Transaction?

1 Like

For a successful commands you will receive both a transaction and a completion. For failed commands you will only received a failded completion. Triggers just mirror the transaction service and completion service.

So for successful commands, updateState will be invoked twice?

Yes, you don’t get guarantees about the order just like you don’t get guarantees if you subscribe to the corresponding ledger API streams.

Thanks, it’s helpful to know that the semantics mirror the ledger API.