Skip to content

Envelope

Derived events carry the input's generic envelope (openspec pubsub-topics, "Envelope on a derived event") unless the worker sets a field explicitly.

output.WithCorrelationId(input)
      .WithTimestamp()
      .WithEventTime(reading.MeasuredAt);
Helper Attribute
WithCorrelationId / GetCorrelationId correlationid
WithEventTime / GetEventTime eventtime
WithWallTime / GetWallTime walltime

EnvelopeAttributes.Carried lists the attributes a derived event inherits (correlationid); WithEnvelopeFrom(source, names) carries any other names a domain devkit passes. EnvelopeAttributes.IngestTime (ingesttime) names the receive time a feed worker (e.g. WebSocketFeed) stamps on an external frame; like eventtime and walltime it is per-event and not carried. A timestamp read without an offset is UTC.

Envelope.Stamp stamps the generic derived-event envelope, and Envelope.StampTimes the time legs (ce-time = eventtime, walltime = now). Wire.Precision (8) is the number of decimals of a wire amount.

Domain attributes

worker-devkit holds no domain code. The domain attributes (scenarioid, runid, exchange, clocktype, the market/portfolio/strategy worlds, marketuniverse), their helpers and defaults, and the virtufin.worlds naming fragment are in domain-devkit (DomainEnvelope.Stamp, DomainEnvelopeExtensions). A domain worker base overrides BehaviorWorkerBase.StampEnvelope to stamp them.

Python

virtufin.worker_devkit.envelope (PyPI virtufin-worker-devkit) has the same names for events as dicts: CORRELATION_ID, EVENT_TIME, WALL_TIME, INGEST_TIME, CARRIED, with_envelope_from(output, source, names=CARRIED), stamp and stamp_times.