Envelope
The domain envelope (openspec pubsub-topics, Common Envelope Extensions). The generic legs
(correlationid, eventtime, walltime, ingesttime) are worker-devkit's
Envelope.
using Virtufin.Domain.DevKit;
output.WithScenarioId("S7F3A9B")
.WithMarketWorld(DomainEnvelope.ActualWorld)
.WithClockType(DomainEnvelope.WallClock);
Helper (DomainEnvelopeExtensions) |
Attribute (DomainAttributes) |
|---|---|
WithScenarioId / GetScenarioId |
scenarioid |
WithRunId / GetRunId |
runid |
WithExchange / GetExchange |
exchange |
WithClockType / GetClockType |
clocktype |
WithMarketWorld / GetMarketWorld |
marketworld |
WithMarketUniverse / GetMarketUniverse |
marketuniverse |
WithPortfolioWorld / GetPortfolioWorld |
portfolioworld |
WithStrategyWorld / GetStrategyWorld |
strategyworld |
DomainAttributes.Carried lists the domain attributes a derived event inherits;
WithDomainEnvelopeFrom(source) copies them and correlationid.
DomainEnvelope.Stamp(output, input[, eventTime]) stamps the whole derived-event envelope:
worker-devkit's Envelope.Stamp (correlation, eventtime inherited or the output's own,
ce-time = eventtime, walltime = now), the input's domain attributes, and clocktype
defaulting to wall. A domain worker base uses it as its StampEnvelope:
protected override void StampEnvelope(CloudEvent output, CloudEvent input, Outgoing outgoing)
=> DomainEnvelope.Stamp(output, input, outgoing.EventTime);
Defaults
| Constant | Value | Meaning |
|---|---|---|
DomainEnvelope.ActualWorld |
act |
the actual world (World.Act); the default world leg |
DomainEnvelope.DefaultMarketUniverse |
ALL |
the unrestricted market universe |
DomainEnvelope.WallClock |
wall |
clocktype of an event on the real clock |
DomainEnvelope.HistoricalClock |
historical |
clocktype of a replayed event |
DomainEnvelope.DefaultClockType |
wall |
clocktype when the input carries none |
Python
virtufin.domain_devkit.envelope has the same names for events as dicts: SCENARIO_ID,
RUN_ID, EXCHANGE, CLOCK_TYPE, MARKET_WORLD, MARKET_UNIVERSE, PORTFOLIO_WORLD,
STRATEGY_WORLD, CARRIED, the defaults ACTUAL_WORLD, DEFAULT_MARKET_UNIVERSE,
WALL_CLOCK, HISTORICAL_CLOCK, DEFAULT_CLOCK_TYPE, and stamp /
with_domain_envelope_from.