public bool Equals(RecordedBinding other)
 {
     return(other != null &&
            (Source.Equals(other.Source)) &&
            (Destination.Equals(other.Destination)) &&
            (RoutingKey.Equals(other.RoutingKey)) &&
            (Arguments == other.Arguments));
 }
Exemple #2
0
        public void Subscribe(IConnection connection, IRabbitMQBodySerializer serializer, CancellationToken stoppingToken)
        {
            if (connection == null)
            {
                throw new ArgumentNullException();
            }

            if (serializer == null)
            {
                throw new ArgumentNullException();
            }

            this.bodySerializer = serializer;

            Task.Run(async() =>
            {
                await createChannel(connection, stoppingToken);

                stoppingToken.Register(shutdownProcedure);



                var queueName = channel.QueueDeclare(QueueName, Durable, Exclusive, AutoDelete);

                var messageConsumer = new EventingBasicConsumer(channel);

                messageConsumer.Received += handleReceivedMessage;


                channel.BasicConsume(
                    queue: queueName,
                    autoAck: AutoAck,
                    consumer: messageConsumer
                    );

                channel.BasicQos(prefetchSize: 0, prefetchCount: 1, global: false);

                if (Exchange.Equals("") || RoutingKey.Equals(""))
                {
                    return;
                }

                channel.QueueBind(
                    queue: queueName,
                    routingKey: RoutingKey,
                    exchange: Exchange,
                    arguments: null
                    );
            });
        }
Exemple #3
0
        public bool Equals(RecordedBinding other)
        {
            if (ReferenceEquals(other, null))
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return((Source.Equals(other.Source)) &&
                   (Destination.Equals(other.Destination)) &&
                   (RoutingKey.Equals(other.RoutingKey)) &&
                   (Arguments == other.Arguments));
        }