/// <summary> /// Posts the specified request, using the specified topic in the Message Header. /// Intended for use with Request-Reply scenarios instead of Publish-Subscribe scenarios /// </summary> /// <typeparam name="T"></typeparam> /// <param name="replyTo">Contains the topic used for routing the reply and the correlation id used by the sender to match response</param> /// <param name="request">The request.</param> /// <exception cref="System.ArgumentOutOfRangeException"></exception> public void Post <T>(ReplyAddress replyTo, T request) where T : class, IRequest { _logger.InfoFormat("Decoupled invocation of request: {0}", request.Id); if (request is IEvent) { throw new ArgumentException("A Post that expects a Reply, should be a Command and not an Event", "request"); } var messageMapper = _mapperRegistry.Get <T>(); if (messageMapper == null) { throw new ArgumentOutOfRangeException(string.Format("No message mapper registered for messages of type: {0}", typeof(T))); } var message = messageMapper.MapToMessage(request); message.Header.Topic = replyTo.Topic; message.Header.CorrelationId = replyTo.CorrelationId; RetryAndBreakCircuit(() => { _messageStore.Add(message, _messageStoreTimeout); _messageProducer.Send(message); }); }
public Reply(ReplyAddress sendersAddress) : base(Guid.NewGuid()) { SendersAddress = sendersAddress; }
public Request(ReplyAddress replyAddress) : base(Guid.NewGuid()) { ReplyAddress = replyAddress; }
/// <summary> /// Constucts a reply /// </summary> /// <param name="replyAddress"></param> public Request(ReplyAddress replyAddress) : base(Guid.NewGuid()) { ReplyAddress = replyAddress; }
public HeartbeatReply(string hostName, ReplyAddress sendersAddress) :base(sendersAddress) { HostName = hostName; Consumers = new List<RunningConsumer>(); }
/// <summary> /// Initializes a new instance of the <see cref="Command" /> class. /// </summary> public HeartbeatRequest(ReplyAddress sendersAddress) : base(sendersAddress) { }