Beispiel #1
0
        public RpcMessagePublisher(
            string brokerName,
            RpcConsumerSettings settings,
            IRpcClient client)
        {
            Check.NotNullOrWhiteSpace(brokerName, nameof(brokerName));
            Check.NotNull(settings, nameof(settings));
            Check.NotNull(client, nameof(client));

            this.BrokerName       = brokerName;
            this.RequestQueueKey  = settings.RequestQueueKey;
            this.RequestQueueName = settings.RequestQueueName;
            this.ContentType      = settings.ContentType;
            this.Client           = client;
        }
Beispiel #2
0
        public RpcClient(string brokerName, RpcConsumerSettings consumerSettings, IModel channel)
        {
            Check.NotNullOrWhiteSpace(brokerName, nameof(brokerName));
            Check.NotNull(consumerSettings, nameof(consumerSettings));
            Check.NotNull(channel, nameof(channel));

            _brokerName       = brokerName;
            _consumerSettings = consumerSettings;

            Channel        = channel;
            ReplyConsumer  = new EventingBasicConsumer(channel);
            ReplyQueueName = Channel.QueueDeclare().QueueName;

            // Pending requests by correlation value.
            _pendingRpcRequests = new ConcurrentDictionary <string, RpcPendingRequest>();

            ConsumeReplyQueue();
        }