/// <summary> /// Publishes the specified <paramref name="payload"/> on the underlying message bus. /// </summary> /// <param name="headers">The set of message headers associated with the command.</param> /// <param name="payload">The command payload to be published.</param> public void Publish(IEnumerable <Header> headers, CommandEnvelope payload) { Verify.NotNull(payload, nameof(payload)); Log.Trace("Publishing {0} to {1}", payload.Command, payload.AggregateId); messageSender.Send(messageFactory.Create(headers, payload)); }
/// <summary> /// Publishes the specified <paramref name="payload"/> on the underlying message bus. /// </summary> /// <param name="headers">The set of message headers associated with the command.</param> /// <param name="payload">The command payload to be published.</param> public void Publish(IEnumerable<Header> headers, CommandEnvelope payload) { Verify.NotNull(payload, nameof(payload)); Log.Trace("Publishing {0} to {1}", payload.Command, payload.AggregateId); messageSender.Send(messageFactory.Create(headers, payload)); }
/// <summary> /// Initializes a new instance of <see cref="CommandContext"/> with the specified <paramref name="commandId"/> and <paramref name="headers"/>. /// </summary> /// <param name="commandId">The unique <see cref="Command"/> identifier.</param> /// <param name="headers">The <see cref="Command"/> headers.</param> /// <param name="envelope">The <see cref="CommandEnvelope"/> associated with this context.</param> public CommandContext(Guid commandId, HeaderCollection headers, CommandEnvelope envelope) { Verify.NotNull(headers, nameof(headers)); Verify.NotNull(envelope, nameof(envelope)); this.raisedEvents = new List<Event>(); this.originalContext = currentContext; this.thread = Thread.CurrentThread; this.commandId = commandId; this.envelope = envelope; this.headers = headers; currentContext = this; }
/// <summary> /// Initializes a new instance of <see cref="CommandContext"/> with the specified <paramref name="commandId"/> and <paramref name="headers"/>. /// </summary> /// <param name="commandId">The unique <see cref="Command"/> identifier.</param> /// <param name="headers">The <see cref="Command"/> headers.</param> /// <param name="envelope">The <see cref="CommandEnvelope"/> associated with this context.</param> public CommandContext(Guid commandId, HeaderCollection headers, CommandEnvelope envelope) { Verify.NotNull(headers, nameof(headers)); Verify.NotNull(envelope, nameof(envelope)); this.raisedEvents = new List <Event>(); this.originalContext = currentContext; this.thread = Thread.CurrentThread; this.commandId = commandId; this.envelope = envelope; this.headers = headers; currentContext = this; }
/// <summary> /// Publishes the specified <paramref name="payload"/> on the underlying message bus. /// </summary> /// <param name="headers">The set of message headers associated with the command.</param> /// <param name="payload">The command payload to be published.</param> public void Publish(IEnumerable<Header> headers, CommandEnvelope payload) { statistics.IncrementQueuedCommands(); bus.Publish(headers, payload); }