commit_envelopes — Two-Phase Coordination
Declarative two-phase coordination across multiple participants (e.g., wallet transfers, inventory reserves). Expanded into core rules by the compiler.
commit_envelopes:
wallet_transfer:
start_action: INITIATE_TRANSFER
envelope_state: transfer
envelope_state_path: /transfer_state
lifecycle:
prepare_event: TRANSFER_PREPARED
prepared_event: TRANSFER_PREPARE_CONFIRMED
commit_event: TRANSFER_COMMITTED
abort_event: TRANSFER_ABORTED
timeout:
abort_after_seconds: 30
tick_event: CLOCK_TICK
participants:
- name: sender
state: wallet
entity_expr: event.sender_id
- name: receiver
state: wallet
entity_expr: event.receiver_idSee apps/causet-compiler/src/test/resources/fixtures/wallet_demo_v1/causet.product.yaml for a full working example.