Class ReactorSideEffectHandlers
- 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
handlersIInstancesOf<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
reactorContextReactorContextThe ReactorContext for the reactor invocation.
eventStoreIEventStoreThe IEventStore the reactor is running under.
valueobjectThe value returned by the reactor handler method.
Returns
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
reactorContextReactorContextThe ReactorContext for the reactor invocation.
valueobjectThe value returned by the reactor handler method.
Returns
CanHandleReturnType(Type)
Determines whether any registered handler claims a synchronous reactor return type.
public bool CanHandleReturnType(Type type)
Parameters
typeTypeThe declared return type of the reactor method.
Returns
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
reactorContextReactorContextThe ReactorContext for the reactor invocation.
eventStoreIEventStoreThe IEventStore to use for appending events.
valueobjectThe value returned by the reactor handler method.
Returns
- Task<Result<ReactorSideEffectFailure>>
A Task representing the asynchronous operation.