Discussion:
[rabbitmq-discuss] durable queues on fanout exchange not durable
pann
2013-12-03 09:46:56 UTC
Permalink
Hi,

I am having trouble getting my queues durable on my fanout exchange.
What I am trying to accomplish is the following:

* One producer, submitting messages to the exchange. The producer is not
aware of how many subscribers there will be.
* Multiple subscribers that creates their on queues. These queues should be
durable. If a subscriber needs to be restarted, the queue should survive in
order not to lose the messages.

The problem is that the queues do not survive the restart unless they are
also declared on the producer side. However that is not possible since the
producer is not aware of how many consumers there will be.

The queues are created on the consumer side like this:
$ch->queue_declare($queue, false, true, false, false);
$ch->exchange_declare($exchange, 'fanout', false, true, false);
$ch->queue_bind($queue, $exchange);

and I only declare the exchange on the producer side:
$ch->exchange_declare($exchange, 'fanout', false, true, false);

I am probably missing something rather simple, but I have not been able to
find the answer by googling the problem.

/PA






--
View this message in context: http://rabbitmq.1065348.n5.nabble.com/durable-queues-on-fanout-exchange-not-durable-tp31781.html
Sent from the RabbitMQ mailing list archive at Nabble.com.
woodslee
2013-12-03 10:02:04 UTC
Permalink
Hi pann

I think this is impossible.
If you declared a durable queue, whatever in producer or comsumer,once it is declared, it will be persistent in disk,and even you need not declare it later anymore.
I think you can view the state of the queue in rabbitMQ web UI. If it is durable, the flag will be the letter of "D"

----- Original Message -----
From: pann
To: rabbitmq-discuss
Sent: 2013-12-03, 17:46:56
Subject: [rabbitmq-discuss] durable queues on fanout exchange not durable


Hi,

I am having trouble getting my queues durable on my fanout exchange.
What I am trying to accomplish is the following:

* One producer, submitting messages to the exchange. The producer is not
aware of how many subscribers there will be.
* Multiple subscribers that creates their on queues. These queues should be
durable. If a subscriber needs to be restarted, the queue should survive in
order not to lose the messages.

The problem is that the queues do not survive the restart unless they are
also declared on the producer side. However that is not possible since the
producer is not aware of how many consumers there will be.

The queues are created on the consumer side like this:
$ch->queue_declare($queue, false, true, false, false);
$ch->exchange_declare($exchange, 'fanout', false, true, false);
$ch->queue_bind($queue, $exchange);

and I only declare the exchange on the producer side:
$ch->exchange_declare($exchange, 'fanout', false, true, false);

I am probably missing something rather simple, but I have not been able to
find the answer by googling the problem.

/PA






--
View this message in context: http://rabbitmq.1065348.n5.nabble.com/durable-queues-on-fanout-exchange-not-durable-tp31781.html
Sent from the RabbitMQ mailing list archive at Nabble.com.
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20131203/ab286b4e/attachment.html>
Alvaro Videla
2013-12-03 16:26:36 UTC
Permalink
Hi,

It seems you are using php-amqplib, if that's the case, the way you
are declaring the queues seems to be correct.

To debug this I would start by running a script that just declares the
queue as durable and the query RabbitMQ via the command line to check
the queue properties.

For example, I've just ran the following script, which creates a
durable queue called messages:

https://github.com/videlalvaro/php-amqplib/blob/master/demo/amqp_consumer.php

And then I've got this result:

$ ./sbin/rabbitmqctl list_queues name durable
Listing queues ...
msgs true
...done.

Note that queue durability is not related to exchange durability.

Regards,

Alvaro
Post by woodslee
Hi pann
I think this is impossible.
If you declared a durable queue, whatever in producer or comsumer,once it is
declared, it will be persistent in disk,and even you need not declare it
later anymore.
I think you can view the state of the queue in rabbitMQ web UI. If it is
durable, the flag will be the letter of "D"
----- Original Message -----
From: pann
To: rabbitmq-discuss
Sent: 2013-12-03, 17:46:56
Subject: [rabbitmq-discuss] durable queues on fanout exchange not durable
Hi,
I am having trouble getting my queues durable on my fanout exchange.
* One producer, submitting messages to the exchange. The producer is not
aware of how many subscribers there will be.
* Multiple subscribers that creates their on queues. These queues should be
durable. If a subscriber needs to be restarted, the queue should survive in
order not to lose the messages.
The problem is that the queues do not survive the restart unless they are
also declared on the producer side. However that is not possible since the
producer is not aware of how many consumers there will be.
$ch->queue_declare($queue, false, true, false, false);
$ch->exchange_declare($exchange, 'fanout', false, true, false);
$ch->queue_bind($queue, $exchange);
$ch->exchange_declare($exchange, 'fanout', false, true, false);
I am probably missing something rather simple, but I have not been able to
find the answer by googling the problem.
/PA
--
http://rabbitmq.1065348.n5.nabble.com/durable-queues-on-fanout-exchange-not-durable-tp31781.html
Sent from the RabbitMQ mailing list archive at Nabble.com.
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Loading...