From 63ff50b82c810567e2a6035fc73eb0e62135517e Mon Sep 17 00:00:00 2001 From: "Jonas L." Date: Sat, 14 Jun 2025 17:56:21 +0200 Subject: [PATCH] feat: rename `airtime-pypo` exchange to `playout` (#3170) ### Description The playout exchange was changed to `fanout` without migrating the previous `direct` exchange. This cause issues during upgrades, such as: ``` amqp.exceptions.PreconditionFailed: Exchange.declare: (406) PRECONDITION_FAILED - inequivalent arg 'type' for exchange 'airtime-pypo' in vhost '/libretime': received 'fanout' but current is 'direct' ``` This is documented upstream in https://www.rabbitmq.com/docs/queues#property-equivalence This change provides an upgrade path by renaming the exchange, and leave the old exchange behind. Loosing messages is not a concern for the playout queue. ### Testing Notes - Checkout version `4.4.0` - Run `make dev` - Checkout 9e55d3bb6f2fa0f9a4dc858359a99e9d50c826a4 - Run `make dev` - See the exception in playout: `docker compose logs -f playout` - Checkout this PR - Run `make dev` - See playout fine working. ### **Links** https://github.com/libretime/libretime/pull/3161 --- legacy/application/models/RabbitMq.php | 4 ++-- playout/libretime_playout/message_handler.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/legacy/application/models/RabbitMq.php b/legacy/application/models/RabbitMq.php index a6303e5b5..86dff6088 100644 --- a/legacy/application/models/RabbitMq.php +++ b/legacy/application/models/RabbitMq.php @@ -55,7 +55,7 @@ class Application_Model_RabbitMq { $md['event_type'] = $event_type; - $exchange = 'airtime-pypo'; + $exchange = 'playout'; $data = json_encode($md, JSON_FORCE_OBJECT); self::sendMessage($exchange, 'fanout', true, $data); } @@ -71,7 +71,7 @@ class Application_Model_RabbitMq public static function SendMessageToShowRecorder($event_type) { - $exchange = 'airtime-pypo'; + $exchange = 'playout'; $now = new DateTime('@' . time()); // in UTC timezone $end_timestamp = new DateTime('@' . (time() + 3600 * 2)); // in UTC timezone diff --git a/playout/libretime_playout/message_handler.py b/playout/libretime_playout/message_handler.py index 5f524b80c..9b870bbf1 100644 --- a/playout/libretime_playout/message_handler.py +++ b/playout/libretime_playout/message_handler.py @@ -27,7 +27,7 @@ class MessageHandler(ConsumerMixin): self.fetch_queue = fetch_queue def get_consumers(self, Consumer, channel): - exchange = Exchange("airtime-pypo", "fanout", durable=True, auto_delete=True) + exchange = Exchange("playout", "fanout", durable=True, auto_delete=True) # RabbitMQ says to avoid temporary queues with well-known names # https://www.rabbitmq.com/docs/queues#shared-temporary-queues # A server named queue that expires is used so that if the service