/// <summary> /// Ctor /// </summary> /// <param name="dispatcher">ConventionalReactorAggregateEventDispatcher Instatiate this in a static constructor for your Reactor type and call BuildDispatchTable() before instantiating a non-static instance</param> public ReactorBase(ConventionalReactionDispatcher dispatcher, IStoreEvents storeEvents) { this.dispatcher = dispatcher; this.storeEvents = storeEvents; }
/// <summary> /// Dispatches the eventstream to the reactor /// </summary> /// <param name="storeEvents"></param> /// <returns>int The last streamrevision that was dispatched</returns> public static async Task <int> DispatchEventStreamAsync(this IReactor reactor, IStoreEvents storeEvents, ConventionalReactionDispatcher dispatcher, Guid aggregateId, int streamRevision = 1) { var stream = storeEvents.OpenStream(aggregateId, streamRevision); await dispatcher.DispatchEventStreamAsync(reactor, stream); return(stream.StreamRevision); }