Esempio n. 1
0
        public Task UnbindQueueAsync(QueueConfiguration queue, ExchangeConfiguration exchange, string routingKey)
        {
            var scheduled = new ScheduledUnbindQueueTask
            {
                Queue      = queue,
                Exchange   = exchange,
                RoutingKey = routingKey
            };

            _topologyTasks.Enqueue(scheduled);
            EnsureWorker();
            return(scheduled.TaskCompletionSource.Task);
        }
Esempio n. 2
0
        public Task UnbindQueueAsync(string queue, string exchange, string routingKey, IDictionary <string, object> arguments)
        {
            var scheduled = new ScheduledUnbindQueueTask
            {
                Queue      = queue,
                Exchange   = exchange,
                RoutingKey = routingKey,
                Arguments  = arguments
            };

            _topologyTasks.Enqueue(scheduled);
            EnsureWorker();
            return(scheduled.TaskCompletionSource.Task);
        }
Esempio n. 3
0
        private void UnbindQueueFromExchange(ScheduledUnbindQueueTask bind)
        {
            _logger.LogInformation($"解绑队列'{bind.Queue.FullQueueName}'从交换器'{bind.Exchange.ExchangeName}'且路由值为'{bind.RoutingKey}'");

            var channel = GetOrCreateChannel();

            channel.QueueUnbind(
                queue: bind.Queue.FullQueueName,
                exchange: bind.Exchange.ExchangeName,
                routingKey: bind.RoutingKey,
                arguments: null
                );
            var bindKey = $"{bind.Queue.FullQueueName}_{bind.Exchange.ExchangeName}_{bind.RoutingKey}";

            if (_queueBinds.Contains(bindKey))
            {
                _queueBinds.Remove(bindKey);
            }
        }
Esempio n. 4
0
        private void UnbindQueueFromExchange(ScheduledUnbindQueueTask bind)
        {
            _logger.Info("Unbinding queue {queueName} from exchange {exchangeName} with routing key {routingKey}", bind.Queue, bind.Exchange, bind.RoutingKey);

            var channel = GetOrCreateChannel();

            channel.QueueUnbind(
                queue: bind.Queue,
                exchange: bind.Exchange,
                routingKey: bind.RoutingKey,
                arguments: bind.Arguments
                );
            var bindKey = CreateBindKey(bind);

            if (_queueBinds.Contains(bindKey))
            {
                _queueBinds.Remove(bindKey);
            }
        }
Esempio n. 5
0
		private void UnbindQueueFromExchange(ScheduledUnbindQueueTask bind)
		{
			_logger.LogInformation($"Unbinding queue '{bind.Queue.FullQueueName}' from exchange '{bind.Exchange.ExchangeName}' with routing key '{bind.RoutingKey}'");

			var channel = GetOrCreateChannel();
			channel.QueueUnbind(
				queue: bind.Queue.FullQueueName,
				exchange: bind.Exchange.ExchangeName,
				routingKey: bind.RoutingKey,
				arguments: null
			);
			var bindKey = $"{bind.Queue.FullQueueName}_{bind.Exchange.ExchangeName}_{bind.RoutingKey}";
			if (_queueBinds.Contains(bindKey))
			{
				_queueBinds.Remove(bindKey);
			}
		}
Esempio n. 6
0
		public Task UnbindQueueAsync(QueueConfiguration queue, ExchangeConfiguration exchange, string routingKey)
		{
			var scheduled = new ScheduledUnbindQueueTask
			{
				Queue = queue,
				Exchange = exchange,
				RoutingKey = routingKey
			};
			_topologyTasks.Enqueue(scheduled);
			EnsureWorker();
			return scheduled.TaskCompletionSource.Task;
		}
Esempio n. 7
0
 private static string CreateBindKey(ScheduledUnbindQueueTask bind)
 {
     return(CreateBindKey(bind.Queue, bind.Exchange, bind.RoutingKey, bind.Arguments));
 }