Leave both unset for the default Tier 0 path: the API publishes to
"sys.api.state.saved" or "sys.api.state.deleted" with ce-type
com.virtufin.api.state.saved/.deleted and a payload of
{service, key, action, value?}. That is correct for INFRA state --
worker registrations, connection records, leader leases -- where the owning
service is the natural namespace.
Set both for DOMAIN state (positions, portfolios, orders, risk, P&L). Such a
write is scenario- or universe-scoped Tier 1 data, and which service performed
it is an implementation detail subscribers should not have to track. The API
cannot build that event for you: it has the store, the key and the bytes, but
not the scenario, the world markers, the clock type, or your service identity.
So supply the whole CloudEvent and the topic it belongs on -- see the
pubsub-topics spec for the Tier 1 patterns and required envelope extensions.
Do NOT reach for a "sys.api.state.saved.<state_name>" style topic: a Tier 0
topic names an entity and a kind of event, not a state, and per-key topics
contradict the Cardinality Rule. Domain state belongs on the
Tier 1 taxonomy, which already has topics subscribers subscribe to.
Ordering: Tier 0 events carry no version and cannot -- Dapr's write API
returns no etag, and re-reading to get one would attribute a newer version to
an older payload. If subscribers consume the value instead of reading state
back, carry a monotonic token in the event you supply here.
Type declaration
Optionalcloudevent?: CloudEvent
The complete event to publish, after the write succeeds.
Generated
from field: io.cloudevents.v1.CloudEvent cloudevent = 2;
topic: string
The topic to publish to. Required when cloudevent is set.
Where a change notification is published.
Leave both unset for the default Tier 0 path: the API publishes to "sys.api.state.saved" or "sys.api.state.deleted" with ce-type com.virtufin.api.state.saved/.deleted and a payload of {service, key, action, value?}. That is correct for INFRA state -- worker registrations, connection records, leader leases -- where the owning service is the natural namespace.
Set both for DOMAIN state (positions, portfolios, orders, risk, P&L). Such a write is scenario- or universe-scoped Tier 1 data, and which service performed it is an implementation detail subscribers should not have to track. The API cannot build that event for you: it has the store, the key and the bytes, but not the scenario, the world markers, the clock type, or your service identity. So supply the whole CloudEvent and the topic it belongs on -- see the pubsub-topics spec for the Tier 1 patterns and required envelope extensions.
Do NOT reach for a "sys.api.state.saved.<state_name>" style topic: a Tier 0 topic names an entity and a kind of event, not a state, and per-key topics contradict the Cardinality Rule. Domain state belongs on the Tier 1 taxonomy, which already has topics subscribers subscribe to.
Ordering: Tier 0 events carry no version and cannot -- Dapr's write API returns no etag, and re-reading to get one would attribute a newer version to an older payload. If subscribers consume the value instead of reading state back, carry a monotonic token in the event you supply here.