public void Dispatch(NEventStore.ICommit commit) { Contract.Requires <ArgumentNullException>(commit != null, "commit"); bool commitIsAboutSaga = commit.Headers.ContainsKey(SagaTypeHeader); if (!commitIsAboutSaga) { // Dispatch to Event Bus Implementation foreach (var @event in commit.Events) { //Run-time conversion for typed event Publish((dynamic)@event.Body); } } // Commands dispatched from sagas if (commitIsAboutSaga) { var commands = commit .Headers .Where(h => h.Key.StartsWith(UndispatchedMessageHeader)).Select(h => h.Value) .ToArray(); if (commands.Any()) { foreach (var command in commands) { (this as IBus).Send(command); } } } }
public void Dispatch(NEventStore.ICommit commit) { Contract.Requires <ArgumentNullException>(commit != null, "commit"); // Dispatch to EventBus Implementation foreach (var @event in commit.Events) { Publish(@event.Body); } }
public void Dispatch(NEventStore.ICommit commit) { Contract.Requires <ArgumentNullException>(commit != null, "commit"); // Dispatch to Event Bus Implementation foreach (var @event in commit.Events) { //Run-time conversion for typed event Publish((dynamic)@event.Body); } }
public void Dispatch(NEventStore.ICommit commit) { foreach (var @event in commit.Events) { // Create message, passing a string message for the body. BrokeredMessage message = new BrokeredMessage(@event.Body); // Set additional custom app-specific property. message.Properties["EventName"] = @event.Body.GetType().Name; message.Properties.Add("StreamRevision", commit.StreamRevision); this.client.Send(message); } }