Class ReactorSideEffectHandlers

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

Represents an implementation of IReactorSideEffectHandlers that dispatches reactor return values to all registered IReactorSideEffectHandler instances.

[Singleton]
public class ReactorSideEffectHandlers : IReactorSideEffectHandlers
Inheritance
ReactorSideEffectHandlers
Implements
Inherited Members
Extension Methods

Constructors

ReactorSideEffectHandlers(IInstancesOf<IReactorSideEffectHandler>)

Represents an implementation of IReactorSideEffectHandlers that dispatches reactor return values to all registered IReactorSideEffectHandler instances.

public ReactorSideEffectHandlers(IInstancesOf<IReactorSideEffectHandler> handlers)

Parameters

handlers IInstancesOf<IReactorSideEffectHandler>

All registered IReactorSideEffectHandler instances.

Methods

CanHandle(ReactorContext, IEventStore, object)

Determines whether any registered handler can process the given return value.

public bool CanHandle(ReactorContext reactorContext, IEventStore eventStore, object value)

Parameters

reactorContext ReactorContext

The ReactorContext for the reactor invocation.

eventStore IEventStore

The IEventStore the reactor is running under.

value object

The value returned by the reactor handler method.

Returns

bool

true if any handler can process the value; otherwise false.

Remarks

Defaults to the event-store-less overload so an implementation written against the previous contract keeps working unchanged.

CanHandle(ReactorContext, object)

Determines whether any registered handler can process the given return value.

public bool CanHandle(ReactorContext reactorContext, object value)

Parameters

reactorContext ReactorContext

The ReactorContext for the reactor invocation.

value object

The value returned by the reactor handler method.

Returns

bool

true if any handler can process the value; otherwise false.

CanHandleReturnType(Type)

Determines whether any registered handler claims a synchronous reactor return type.

public bool CanHandleReturnType(Type type)

Parameters

type Type

The declared return type of the reactor method.

Returns

bool

true if any handler claims the type; otherwise false.

Remarks

Defaults to false for existing dispatcher implementations.

Handle(ReactorContext, IEventStore, object)

Dispatches the return value to all handlers that can process it.

public Task<Result<ReactorSideEffectFailure>> Handle(ReactorContext reactorContext, IEventStore eventStore, object value)

Parameters

reactorContext ReactorContext

The ReactorContext for the reactor invocation.

eventStore IEventStore

The IEventStore to use for appending events.

value object

The value returned by the reactor handler method.

Returns

Task<Result<ReactorSideEffectFailure>>

A Task representing the asynchronous operation.