Uploaded image for project: 'James Server'
  1. James Server
  2. JAMES-3694

Add a TTL on RabbitMQ queues

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Done
    • 3.6.0
    • 3.7.0
    • None
    • None

    Description

      In our production environments we encountered some strange phenomenons: some queues marked as autodelete (like for the mailbox eventBus) are still present while having no consumers with a consequent number of messages in it.

      Checking the RabbitMQ doc https://www.rabbitmq.com/queues.html#temporary-queues

      ```
      An auto-delete queue will be deleted when its last consumer is cancelled (e.g. using the basic.cancel in AMQP 0-9-1) or gone (closed channel or connection, or lost TCP connection with the server).

      If a queue never had any consumers, for instance, when all consumption happens using the basic.get method (the "pull" API), it won't be automatically deleted. For such cases, use exclusive queues or queue TTL.
      ```

      Could we be sometimes after some issues in a case where that queue never had any consumers?

      For this, I propose to add a TTL to the queue https://www.rabbitmq.com/ttl.html#queue-ttl. According to the doc, even if there was no consumer to the queue, it will be deleted after the ttl if we set this up.

      Of course it should be a configurable optional field in rabbitmq.properties file. Something like this:

      ```
      notification.queue.ttl=3600000 # unit in ms
      ```
      The unit is in ms, so the default would be 3600000ms -> 1h

      Attachments

        Activity

          People

            Unassigned Unassigned
            rcordier René Cordier
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 2h 20m
                2h 20m