Beispiel #1
0
        public void ReturnedMessage(IMessage <byte[]> message, int replyCode, string replyText, string exchange, string routingKey)
        {
            // no need for null check; we asserted we have a RabbitTemplate in doInit()
            var converter = Template.MessageConverter;
            var returned  = BuildReturnedMessage(message, replyCode, replyText, exchange, routingKey, converter);

            ReturnChannel.Send(returned);
        }
        private void DefineRpcConsumer(string exchangeName, Guid connectedExchangeId, int ttl = 2000000)
        {
            ttl = 10000000;
            var args = new Dictionary <string, object> {
                { DictionaryKey_QueueTtl, ttl }
            };

            ReturnChannelQueueTtl  = ttl;
            ReturnChannel          = _RabbitIn.CreateModel();
            ReturnChannelQueueName = $"RPC:{exchangeName}:{connectedExchangeId}";
            ReturnChannel.QueueDeclare(ReturnChannelQueueName, false, false, true, args);
            ReturnChannelConsumer           = new AsyncEventingBasicConsumer(_rpcResponseChannel);
            ReturnChannelConsumer.Received += RpcReturnChannelConsumerOnReceivedAsync;
            ReturnChannel.BasicConsume(ReturnChannelQueueName, true, ReturnChannelConsumer);
            ReturnChannelLatch = new SemaphoreSlim(0, 1);


            VerboseLoggingHandler.Log($"Reply queue created, name='{ReturnChannelQueueName}'");
        }