示例#1
0
        private void SubsManager_OnEventAdded(object sender, ISubscription subscription)
        {
            var type = subscription.Type;

            Task.Factory.StartNew(() =>
            {
                if (!_persistentConnection.IsConnected)
                {
                    _persistentConnection.TryConnect();
                }

                using (var channel = _persistentConnection.CreateChannel())
                {
                    channel.QueueBind(
                        queue: _queueName,
                        exchange: BROKER_NAME,
                        routingKey: _eventNameTypeResolver.GetEventName(type),
                        arguments: null
                        );
                }
            });
        }