[rabbitmq-discuss] using ttl and dead-letter-exchange to retry after a delay, in PHP

Simon MacMullen simon at rabbitmq.com
Wed Oct 2 10:10:35 BST 2013


On 01/10/13 12:39, Dave Alan Caruana wrote:
>                         "x-dead-letter-exchange" => array("S",
> $this->channelname),
>                         "x-message-ttl" => array("I", 5000),
>                         "x-expires" => array("I", 6000)

> $msg -> is the message I want sent with a delay
> $this->channelname would be the channel I want it to go to after the delay
> 'errorXchange' is the dead queue with the ttl & no consumer.

Well, the x-dead-letter-exchange argument takes... an exchange, not a 
channel name. You need to declare another exchange to dead letter 
messages to, then a queue to consume the dead-lettered messages from, 
bind the two, then consume from that.

I'm also not sure I'd call a queue "errorXchange", might be confusing.

Finally, you have set "expires" on your queue - this will cause it to 
delete itself after 6 seconds of inactivity. I doubt you want that.

> I haven't understood how to debug rabbitmq or what is going wrong, and
> there is precious little documentation!

If you haven't read the tutorials I would do so - 
http://www.rabbitmq.com/getstarted.html. And of course see also 
http://www.rabbitmq.com/ttl.html and http://www.rabbitmq.com/dlx.html

Cheers, Simon

-- 
Simon MacMullen
RabbitMQ, Pivotal


More information about the rabbitmq-discuss mailing list