private void OnSubscriptionManagerEventAdded(object _, string eventName)
        {
            using (var channel = _connection.CreateModel())
            {
                channel.QueueDeclare(eventName, true, false, false);

                channel.QueueBind(
                    queue: eventName,
                    exchange: _connection.Config.ConsumerExchange,
                    routingKey: eventName
                    );

                CreateConsumer(_consumerChannel, eventName);
            }
        }
Exemple #2
0
        void OnSubscriptionManagerEventAdded(object _, EventEventArgs @event)
        {
            if (!_connection.IsConnected)
            {
                _connection.TryConnect();
            }

            using (var channel = _connection.CreateModel())
            {
                channel.QueueBind(
                    queue: _queueName,
                    exchange: ExchangeName,
                    routingKey: @event.EventName
                    );
            }
        }
Exemple #3
0
        void OnSubscriptionManagerEventRemoved(object _, EventEventArgs @event)
        {
            if (!_connection.IsConnected)
            {
                _connection.TryConnect(ResiliencePolicies.ConnectionPolicyFactory);
            }

            using (var channel = _connection.CreateModel())
            {
                if (!_subscriptionManager.IsEmpty)
                {
                    return;
                }

                _consumerChannel.Close();
            }
        }