public void PostCommit(Commit committed) { if (committed != null) { _scheduler.ScheduleDispatch(committed); } }
public void Dispatch(Commit commit) { List<EventMessage> events = commit.Events; foreach (EventMessage message in events) { var @event = message.Body; _bus.Publish(@event); } }
public void DispatchCommit(Commit commit) { foreach (var @event in commit.Events) { foreach (var eventHandler in eventHandlers) { eventHandler.Handle(@event); } } }
public Commit Select(Commit committed) { var eventConversionRunner = _eventConversionRunnerFactory(); foreach (var eventMessage in committed.Events) { eventMessage.Body = eventConversionRunner.Run(eventMessage.Body); } return committed; }
public void Dispatch(Commit commit) { for (var i = 0; i < commit.Events.Count; i++) { var eventMessage = commit.Events[i]; var busMessage = eventMessage.Body as Event; // AppendHeaders(busMessage, commit.Headers); // optional // AppendHeaders(busMessage, eventMessage.Headers); // optional // AppendVersion(commit, i); // optional _ravenDispatcher.Publish(busMessage); Bus.Publish(busMessage); } }
private static void DispatchCommit(Commit commit) { // This is where we'd hook into our messaging infrastructure, such as NServiceBus, // MassTransit, WCF, or some other communications infrastructure. // This can be a class as well--just implement IDispatchCommits. try { foreach (var @event in commit.Events) Console.WriteLine(Resources.MessagesDispatched + ((SomeDomainEvent)@event.Body).Value); } catch (Exception) { Console.WriteLine(Resources.UnableToDispatch); } }
public bool PreCommit(Commit attempt) { return true; }
public void PostCommit(Commit committed) { }
private void CopyToEvents(int minRevision, int maxRevision, int currentRevision, Commit commit) { foreach (var @event in commit.Events) { if (currentRevision > maxRevision) { Logger.Debug(Resources.IgnoringBeyondRevision, commit.CommitId, StreamId, maxRevision); break; } if (currentRevision++ < minRevision) { Logger.Debug(Resources.IgnoringBeforeRevision, commit.CommitId, StreamId, maxRevision); continue; } _committed.Add(@event); StreamRevision = currentRevision - 1; } }
private void CopyToCommittedHeaders(Commit commit) { foreach (var key in commit.Headers.Keys) { _committedHeaders[key] = commit.Headers[key]; } }
public void PostCommit(Commit committed) { // anything to do after the commit has been persisted. }
public bool PreCommit(Commit attempt) { // Can easily do logging or other such activities here return true; // true == allow commit to continue, false = stop. }
public Commit Select(Commit committed) { // return null if the user isn't authorized to see this commit return committed; }
public Commit Select(Commit committed) { return committed; }
public virtual bool PreCommit(Commit attempt) { return true; }
public virtual void Dispatch(Commit commit) { _eventPublisherFactory().Publish(commit.Events.Select(e => e.Body), commit.Headers, commit.Events.ToDictionary(e => e.Body, e => e.Headers)); }
protected override void Because() { selected = DispatchSchedulerHook.Select(commit); }