diff --git a/CHANGELOG.md b/CHANGELOG.md index c959ec2..258ca26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,15 @@ headers that will be sent with every request from a connection. This setting accepts a mapping of header names to `connection.header.Header` objects which can retrieve values from get params, cookies etc. +### Fixed +- The message consumer queue is now declared `exclusive` instead of +`auto_delete`. RabbitMQ 4 refuses to declare a transient non-exclusive queue, +which stopped the consumer before it bound to the exchange, so no triggered +messages were delivered. The queue is private to a single consumer, so +`exclusive` is the correct declaration and also works on RabbitMQ 3. The test +suite pins RabbitMQ 3.13, matching the version our projects run, but the +consumer now works on both 3 and 4. + ## [2.5.0] - 2019-10-02 ### Added - `Hub` objects now have the method `on_ping` that allows you to hook custom diff --git a/docker-compose.yml b/docker-compose.yml index bf4ddca..dea2be8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,8 +1,6 @@ -version: '3.6' - services: rabbitmq: - image: rabbitmq:management + image: rabbitmq:3.13-management ports: - ${RABBIT_MQ_PORT:-5672}:5672 - ${RABBIT_MQ_ADMIN_PORT:-15672}:15672 @@ -31,7 +29,7 @@ services: - 8080:8080 nginx: - image: nginx + image: nginx:1.31 volumes: - ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf ports: diff --git a/high_templar/rabbitmq.py b/high_templar/rabbitmq.py index 8e7e1bf..17078a4 100644 --- a/high_templar/rabbitmq.py +++ b/high_templar/rabbitmq.py @@ -40,8 +40,11 @@ async def run(app): app.logger.debug("create queue {}".format(QUEUE_NAME)) + # Exclusive rather than plain auto_delete: the queue is private + # to this consumer (its name carries a per-process uuid), and + # RabbitMQ 4 refuses to declare a transient non-exclusive queue. queue = await channel.declare_queue( - QUEUE_NAME, auto_delete=True, durable=False + QUEUE_NAME, exclusive=True, durable=False ) await queue.bind(exchange=config['exchange_name'], routing_key='*')