Interface IReactorDefinition
- Namespace
- Cratis.Chronicle.Reactors
- Assembly
- Cratis.Chronicle.dll
Defines a reactor declared fluently through an IReactorBuilder, which can be inspected before and after it is registered.
public interface IReactorDefinition
- Extension Methods
Properties
ClrTypes
Gets the CLR types of the events the reactor subscribes to, one for each of the EventTypes.
IEnumerable<Type> ClrTypes { get; }
Property Value
EventSequenceId
Gets the event sequence the reactor observes.
EventSequenceId EventSequenceId { get; }
Property Value
EventTypes
Gets the event types the reactor subscribes to - exactly the set Chronicle is asked to deliver.
IEnumerable<EventType> EventTypes { get; }
Property Value
Remarks
For a reactor with only typed handlers this is one event type per handled type. For an all-events subscription it is every event type the client knew when the reactor was defined, in its latest generation unless a typed handler names a different one.
Id
Gets the identifier of the reactor.
ReactorId Id { get; }
Property Value
IsReplayable
Gets a value indicating whether the reactor can be replayed.
bool IsReplayable { get; }
Property Value
SubscribesToAllEvents
Gets a value indicating whether the reactor subscribes to all events, through Subscribe(Action<object, EventContext>) or its asynchronous equivalent.
bool SubscribesToAllEvents { get; }
Property Value
Methods
Handle(object, EventContext)
Dispatch an event to the handlers that apply to it, the way the reactor does for every delivered event.
Task Handle(object @event, EventContext context)
Parameters
eventobjectThe event to dispatch.
contextEventContextThe EventContext of the event.
Returns
- Task
Awaitable task, completing when every applicable handler has completed.
Remarks
Typed handlers apply when the event's type is exactly the type they were declared for; catch-all handlers apply to every event. An event no handler applies to is ignored.