Class ReactorContext

Namespace
Cratis.Chronicle.Reactors.SideEffects
Assembly
Cratis.Chronicle.dll

Represents the combined context available to a IReactorSideEffectHandler when processing a value returned by a reactor handler method.

public record ReactorContext : IEquatable<ReactorContext>
Inheritance
ReactorContext
Implements
Inherited Members
Extension Methods

Constructors

ReactorContext(EventContext, object, ReactorContextValues)

Represents the combined context available to a IReactorSideEffectHandler when processing a value returned by a reactor handler method.

public ReactorContext(EventContext EventContext, object Reactor, ReactorContextValues Values)

Parameters

EventContext EventContext

The EventContext of the event that triggered the reactor.

Reactor object

The reactor instance that handled the event.

Values ReactorContextValues

The ReactorContextValues carrying append-metadata resolved for the side-effect.

ReactorContext(ReactorContext)

protected ReactorContext(ReactorContext original)

Parameters

original ReactorContext

Properties

Delivery

Gets the ReactorDelivery of the event that triggered the reactor, when the context was produced by the Chronicle invocation pipeline.

public ReactorDelivery? Delivery { get; init; }

Property Value

ReactorDelivery

Remarks

Built-in handlers derive the idempotency keys of the events a reactor returns from this. It is null for contexts built outside the invocation pipeline, whose events are then appended without keys.

EqualityContract

protected virtual Type EqualityContract { get; }

Property Value

Type

EventContext

The EventContext of the event that triggered the reactor.

public EventContext EventContext { get; init; }

Property Value

EventContext

EventStore

Gets the IEventStore the reactor is running under, when the context was produced by the Chronicle invocation pipeline.

public IEventStore? EventStore { get; init; }

Property Value

IEventStore

Remarks

This lets callers of the previous event-store-less CanHandle contract reach the same per-store path as current callers. It is not a constructor parameter so the previous three-parameter constructor and deconstruction shape remain binary compatible.

Reactor

The reactor instance that handled the event.

public object Reactor { get; init; }

Property Value

object

Values

The ReactorContextValues carrying append-metadata resolved for the side-effect.

public ReactorContextValues Values { get; init; }

Property Value

ReactorContextValues

Methods

Deconstruct(out EventContext, out object, out ReactorContextValues)

public void Deconstruct(out EventContext EventContext, out object Reactor, out ReactorContextValues Values)

Parameters

EventContext EventContext
Reactor object
Values ReactorContextValues

Equals(ReactorContext?)

public virtual bool Equals(ReactorContext? other)

Parameters

other ReactorContext

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

PrintMembers(StringBuilder)

protected virtual bool PrintMembers(StringBuilder builder)

Parameters

builder StringBuilder

Returns

bool

ToString()

public override string ToString()

Returns

string

Operators

operator ==(ReactorContext?, ReactorContext?)

public static bool operator ==(ReactorContext? left, ReactorContext? right)

Parameters

left ReactorContext
right ReactorContext

Returns

bool

operator !=(ReactorContext?, ReactorContext?)

public static bool operator !=(ReactorContext? left, ReactorContext? right)

Parameters

left ReactorContext
right ReactorContext

Returns

bool