Class CloudEventExtensions
- Namespace
- Virtufin.Worker.DevKit
- Assembly
- Virtufin.Worker.DevKit.dll
Fluent extensions for CloudEvent applied automatically
by WorkerBase<TInput, TOutput>.BuildResponse.
public static class CloudEventExtensions
- Inheritance
-
CloudEventExtensions
- Inherited Members
Methods
GetClockType(CloudEvent)
The clocktype extension (wall | historical), or null.
public static string? GetClockType(this CloudEvent ce)
Parameters
ceCloudEvent
Returns
GetCorrelationId(CloudEvent)
The correlationid extension, or null.
public static string? GetCorrelationId(this CloudEvent ce)
Parameters
ceCloudEvent
Returns
GetEventTime(CloudEvent)
The eventtime extension (RFC3339), or null.
public static DateTimeOffset? GetEventTime(this CloudEvent ce)
Parameters
ceCloudEvent
Returns
GetExchange(CloudEvent)
The exchange extension, or null.
public static string? GetExchange(this CloudEvent ce)
Parameters
ceCloudEvent
Returns
GetMarketUniverse(CloudEvent)
The marketuniverse extension, or null.
public static string? GetMarketUniverse(this CloudEvent ce)
Parameters
ceCloudEvent
Returns
GetMarketWorld(CloudEvent)
The marketworld extension (act | hyp.<name>), or null.
public static string? GetMarketWorld(this CloudEvent ce)
Parameters
ceCloudEvent
Returns
GetPortfolioWorld(CloudEvent)
The portfolioworld extension, or null.
public static string? GetPortfolioWorld(this CloudEvent ce)
Parameters
ceCloudEvent
Returns
GetRunId(CloudEvent)
The runid extension as a Guid, or null.
public static Guid? GetRunId(this CloudEvent ce)
Parameters
ceCloudEvent
Returns
- Guid?
GetScenarioId(CloudEvent)
The scenarioid extension, or null.
public static string? GetScenarioId(this CloudEvent ce)
Parameters
ceCloudEvent
Returns
GetStrategyWorld(CloudEvent)
The strategyworld extension, or null.
public static string? GetStrategyWorld(this CloudEvent ce)
Parameters
ceCloudEvent
Returns
GetWallTime(CloudEvent)
The walltime extension (RFC3339), or null.
public static DateTimeOffset? GetWallTime(this CloudEvent ce)
Parameters
ceCloudEvent
Returns
WithClockType(CloudEvent, string)
Sets the clocktype extension attribute (wall or historical).
public static CloudEvent WithClockType(this CloudEvent ce, string clockType)
Parameters
ceCloudEventclockTypestring
Returns
WithCorrelationId(CloudEvent, CloudEvent)
Copies the correlationid extension attribute from
input to ce. No-op if the
input has no correlationid.
public static CloudEvent WithCorrelationId(this CloudEvent ce, CloudEvent input)
Parameters
ceCloudEventinputCloudEvent
Returns
WithEnvelopeFrom(CloudEvent, CloudEvent)
Copy the Common Envelope Extensions present on source
onto ce -- correlationid, scenarioid,
runid, exchange, clocktype, the market/portfolio/strategy
worlds and marketuniverse -- for a worker that derives its event
from an incoming one and doesn't own those values (an executor echoing
the order's scenario, an indicator echoing its market data). The
per-event eventtime/walltime are deliberately NOT copied:
they describe this event, so set them with WithEventTime(CloudEvent, DateTimeOffset) /
WithWallTime(CloudEvent, DateTimeOffset?). Attributes absent on the source are left as
they are on ce.
public static CloudEvent WithEnvelopeFrom(this CloudEvent ce, CloudEvent source)
Parameters
ceCloudEventsourceCloudEvent
Returns
WithEventTime(CloudEvent, DateTimeOffset)
Sets the eventtime extension attribute (RFC3339) — the logical
event time matching clocktype (historical for backtest replay,
real clock otherwise), distinct from Time
(which WithTimestamp(CloudEvent, DateTimeOffset?) sets, and which callers typically
leave as the real publish time). The ratified spec defines
eventtime as equal to ce-time; call
ce.WithTimestamp(eventTime) too if a given event genuinely
wants both to match -- this method only sets the extension, since
unconditionally overwriting Time here would
change existing callers that intentionally publish at the real
timestamp while carrying a historical eventtime.
public static CloudEvent WithEventTime(this CloudEvent ce, DateTimeOffset eventTime)
Parameters
ceCloudEventeventTimeDateTimeOffset
Returns
WithExchange(CloudEvent, string)
Sets the exchange extension attribute (e.g. binance, coinbase).
public static CloudEvent WithExchange(this CloudEvent ce, string exchange)
Parameters
ceCloudEventexchangestring
Returns
WithMarketUniverse(CloudEvent, string)
Sets the marketuniverse extension attribute — present for both
act and hyp.<name> (use "ALL" for unrestricted).
public static CloudEvent WithMarketUniverse(this CloudEvent ce, string marketUniverse)
Parameters
ceCloudEventmarketUniversestring
Returns
WithMarketWorld(CloudEvent, string)
Sets the marketworld extension attribute (act or hyp.<name>).
public static CloudEvent WithMarketWorld(this CloudEvent ce, string marketWorld)
Parameters
ceCloudEventmarketWorldstring
Returns
WithPortfolioWorld(CloudEvent, string)
Sets the portfolioworld extension attribute (act or hyp.<name>).
public static CloudEvent WithPortfolioWorld(this CloudEvent ce, string portfolioWorld)
Parameters
ceCloudEventportfolioWorldstring
Returns
WithRunId(CloudEvent, Guid)
Sets the runid extension attribute.
public static CloudEvent WithRunId(this CloudEvent ce, Guid runId)
Parameters
ceCloudEventrunIdGuid
Returns
WithScenarioId(CloudEvent, string)
Sets the scenarioid extension attribute.
public static CloudEvent WithScenarioId(this CloudEvent ce, string scenarioId)
Parameters
ceCloudEventscenarioIdstring
Returns
WithStrategyWorld(CloudEvent, string)
Sets the strategyworld extension attribute (act or hyp.<name>).
public static CloudEvent WithStrategyWorld(this CloudEvent ce, string strategyWorld)
Parameters
ceCloudEventstrategyWorldstring
Returns
WithTimestamp(CloudEvent, DateTimeOffset?)
public static CloudEvent WithTimestamp(this CloudEvent ce, DateTimeOffset? timestamp = null)
Parameters
ceCloudEventtimestampDateTimeOffset?
Returns
WithWallTime(CloudEvent, DateTimeOffset?)
Sets the walltime extension attribute (RFC3339) to
wallTime (or UtcNow
if null) — always the real clock at publish time, for tracing and
logging, independent of WithEventTime(CloudEvent, DateTimeOffset).
public static CloudEvent WithWallTime(this CloudEvent ce, DateTimeOffset? wallTime = null)
Parameters
ceCloudEventwallTimeDateTimeOffset?