op: emit_each
Emit one event per element in a collection.
Allowed phases
| Phase | Status |
|---|---|
preflight | ✗ forbidden |
core | ✓ allowed |
side_effects | ✓ allowed |
Syntax
- op: emit_each
from: "entity.cart.items"
event_type: INVENTORY_RESERVE_REQUESTED
target_stream: inventory_stream
target_entity: "item.product_id"
payload:
order_id: event.order_id
product_id: "item.product_id"
quantity: "item.quantity"Parameters
| Field | Required | Description |
|---|---|---|
from | yes | Expression evaluating to an array |
event_type | yes | Event type per item |
payload | yes | Payload map; use item for the current element |
target_stream | no | Stream for each emitted event |
target_entity | no | Per-item entity ID expression |
Behavior
- Iterator variable is
item(notit). Each emit is validated against the event schema.
Related operations
See also
- Operations index — all ops by phase
- actions — rule structure and phases
- Intents: Rules — narrative examples