Class ReplyAddress. The addrees to reply to when doing request-reply and not publish-subscribe
コード例 #1
0
ファイル: CommandProcessor.cs プロジェクト: franhoey/Paramore
        /// <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);
            });
        }
コード例 #2
0
 public Reply(ReplyAddress sendersAddress)
     : base(Guid.NewGuid())
 {
     SendersAddress = sendersAddress;
 }
コード例 #3
0
ファイル: Request.cs プロジェクト: andrewm1986/Paramore
 public Request(ReplyAddress replyAddress)
     : base(Guid.NewGuid())
 {
     ReplyAddress = replyAddress;
 }
コード例 #4
0
ファイル: Request.cs プロジェクト: sixrandanes/Paramore
 /// <summary>
 /// Constucts a reply
 /// </summary>
 /// <param name="replyAddress"></param>
 public Request(ReplyAddress replyAddress)
     : base(Guid.NewGuid())
 {
     ReplyAddress = replyAddress;
 }
コード例 #5
0
 public HeartbeatReply(string hostName, ReplyAddress sendersAddress)
     :base(sendersAddress)
 {
     HostName = hostName;
     Consumers = new List<RunningConsumer>();
 }
コード例 #6
0
ファイル: Reply.cs プロジェクト: andrewm1986/Paramore
 public Reply(ReplyAddress sendersAddress)
     : base(Guid.NewGuid())
 {
     SendersAddress = sendersAddress;
 }
コード例 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Command" /> class.
 /// </summary>
 public HeartbeatRequest(ReplyAddress sendersAddress) 
     : base(sendersAddress)
 {
 }