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
eventTypesIEventTypesIEventTypes for mapping types.
middlewaresIReactorMiddlewaresIReactorMiddlewares to call.
targetTypeTypeType of Reactor.
activatedReactorActivatedArtifactThe ActivatedArtifact activated reactor.
loggerILogger<ReactorInvoker>ILogger for logging.
sideEffectHandlersIReactorSideEffectHandlersOptional IReactorSideEffectHandlers used to process events returned by handler methods. When null, a non-null return value fails the invocation.
eventStoreIEventStoreOptional IEventStore supplied to side effect handlers when appending events. When null, a non-null return value fails the invocation even if handlers are registered.
reactorContextValuesBuilderIReactorContextValuesBuilderOptional 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.
argumentsResolverIReactorMethodArgumentsResolverOptional IReactorMethodArgumentsResolver used to resolve handler method arguments. When null, a default ReactorMethodArgumentsResolver is used.
serviceProviderIServiceProviderOptional 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
eventTypesIEventTypesIEventTypes for looking up event types.
reactorTypeTypeThe 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
eventTypesIEventTypesRegistry of known event types.
reactorTypeTypeThe reactor type to inspect.
sideEffectHandlersIReactorSideEffectHandlersHandlers 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
contentobjectEvent content to invoke with.
eventContextEventContextEventContext for the event.
Returns
- Task<ReactorInvocationResult>
Awaitable Task.