Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set Message TTL to one hour RabbitMQ

How can I set the message TTL ( Not the Queue ) from either the

  • Exchange ( The exchange sends to multiple queues )
  • Message ( when publishing the message )
  • Queue ( On the queue itself but again this is the Message TTL and not the Queue TTL )

I'm running RabbitMQ 3.x, Symfony 2.1.x and the RabbitMqBundle.

What I've tried:

  • Setting the Message TTL when I make the queue itself from the RabbitMQ Admin UI

I set the message properties to 'x-message-ttl' => 3600000. In the RabbitMQ config it looks like this:

{
    "name": "blah_queue",
    "vhost": "foobar",
    "durable": true,
    "auto_delete": false,
    "arguments": {
            'x-message-ttl' => 3600000
    }
},

this is the error I get:

PRECONDITION_FAILED - inequivalent arg 'x-message-ttl'for queue

I tried setting in the config.yml ( symfony / https://github.com/videlalvaro/RabbitMqBundle / README )

this gives a bunch of errors with the AMQP library the bundle uses.

I tried modifying the AMQP library itself to allow the x-message-ttl message properties and I get an exception Error sending data.

Has anyone set the Message TTL using the RabbitMQBundle?

queue_options:    {name: 'blah_queue', arguments: {'x-message-ttl' => 3600000}}
like image 554
Phill Pafford Avatar asked Nov 04 '22 06:11

Phill Pafford


1 Answers

queue_options:    {name: 'blah_queue', arguments: {'x-message-ttl' : ['I', '3600000']}}
like image 177
james_t Avatar answered Nov 09 '22 15:11

james_t