Class ReactorInvoker

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

Represents an implementation of IReactorInvoker.

public class ReactorInvoker : IReactorInvoker
Inheritance
ReactorInvoker
Implements
Inherited Members
Extension Methods

Remarks

Initializes a new instance of the ReactorInvoker class.

Constructors

ReactorInvoker(IEventTypes, IReactorMiddlewares, Type, ActivatedArtifact, ILogger<ReactorInvoker>, IReactorSideEffectHandlers?, IEventStore?, IReactorContextValuesBuilder?, IReactorMethodArgumentsResolver?, IServiceProvider?)

Represents an implementation of IReactorInvoker.

public ReactorInvoker(IEventTypes eventTypes, IReactorMiddlewares middlewares, Type targetType, ActivatedArtifact activatedReactor, ILogger<ReactorInvoker> logger, IReactorSideEffectHandlers? sideEffectHandlers = null, IEventStore? eventStore = null, IReactorContextValuesBuilder? reactorContextValuesBuilder = null, IReactorMethodArgumentsResolver? argumentsResolver = null, IServiceProvider? serviceProvider = null)

Parameters

eventTypes IEventTypes

IEventTypes for mapping types.

middlewares IReactorMiddlewares

IReactorMiddlewares to call.

targetType Type

Type of Reactor.

activatedReactor ActivatedArtifact

The ActivatedArtifact activated reactor.

logger ILogger<ReactorInvoker>

ILogger for logging.

sideEffectHandlers IReactorSideEffectHandlers

Optional IReactorSideEffectHandlers used to process events returned by handler methods. When null, a non-null return value fails the invocation.

eventStore IEventStore

Optional IEventStore supplied to side effect handlers when appending events. When null, a non-null return value fails the invocation even if handlers are registered.

reactorContextValuesBuilder IReactorContextValuesBuilder

Optional IReactorContextValuesBuilder used to resolve append-metadata for side-effect events. When null, no values are resolved and append-metadata falls back to the triggering event.

argumentsResolver IReactorMethodArgumentsResolver

Optional IReactorMethodArgumentsResolver used to resolve handler method arguments. When null, a default ReactorMethodArgumentsResolver is used.

serviceProvider IServiceProvider

Optional IServiceProvider used to resolve handler method dependencies that are neither the EventContext nor a read model.

Remarks

Initializes a new instance of the ReactorInvoker class.

Methods

GetEventTypesFor(IEventTypes, Type)

Gets all EventType for a specific reactor type.

public static IImmutableList<EventType> GetEventTypesFor(IEventTypes eventTypes, Type reactorType)

Parameters

eventTypes IEventTypes

IEventTypes for looking up event types.

reactorType Type

The reactor Type to get event types for.

Returns

IImmutableList<EventType>

Collection of discovered EventType.

GetEventTypesFor(IEventTypes, Type, IReactorSideEffectHandlers?)

Gets the event types for a reactor, including methods returning handler-claimed synchronous side effects.

public static IImmutableList<EventType> GetEventTypesFor(IEventTypes eventTypes, Type reactorType, IReactorSideEffectHandlers? sideEffectHandlers)

Parameters

eventTypes IEventTypes

Registry of known event types.

reactorType Type

The reactor type to inspect.

sideEffectHandlers IReactorSideEffectHandlers

Handlers claiming synchronous return types.

Returns

IImmutableList<EventType>

The event types handled by the reactor.

Invoke(object, EventContext)

Invoke the Reactor.

public Task<ReactorInvocationResult> Invoke(object content, EventContext eventContext)

Parameters

content object

Event content to invoke with.

eventContext EventContext

EventContext for the event.

Returns

Task<ReactorInvocationResult>

Awaitable Task.