Interface IReactorSideEffectHandlers

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

Defines a system for managing IReactorSideEffectHandler instances and dispatching return values to them.

public interface IReactorSideEffectHandlers
Extension Methods

Methods

CanHandle(ReactorContext, IEventStore, object)

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

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.

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.

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.

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.