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
This commit is contained in:
Jonas L. 2025-06-14 17:56:21 +02:00 committed by GitHub
parent 0b02ebf1b6
commit 63ff50b82c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -55,7 +55,7 @@ class Application_Model_RabbitMq
{ {
$md['event_type'] = $event_type; $md['event_type'] = $event_type;
$exchange = 'airtime-pypo'; $exchange = 'playout';
$data = json_encode($md, JSON_FORCE_OBJECT); $data = json_encode($md, JSON_FORCE_OBJECT);
self::sendMessage($exchange, 'fanout', true, $data); self::sendMessage($exchange, 'fanout', true, $data);
} }
@ -71,7 +71,7 @@ class Application_Model_RabbitMq
public static function SendMessageToShowRecorder($event_type) public static function SendMessageToShowRecorder($event_type)
{ {
$exchange = 'airtime-pypo'; $exchange = 'playout';
$now = new DateTime('@' . time()); // in UTC timezone $now = new DateTime('@' . time()); // in UTC timezone
$end_timestamp = new DateTime('@' . (time() + 3600 * 2)); // in UTC timezone $end_timestamp = new DateTime('@' . (time() + 3600 * 2)); // in UTC timezone

View File

@ -27,7 +27,7 @@ class MessageHandler(ConsumerMixin):
self.fetch_queue = fetch_queue self.fetch_queue = fetch_queue
def get_consumers(self, Consumer, channel): 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 # RabbitMQ says to avoid temporary queues with well-known names
# https://www.rabbitmq.com/docs/queues#shared-temporary-queues # https://www.rabbitmq.com/docs/queues#shared-temporary-queues
# A server named queue that expires is used so that if the service # A server named queue that expires is used so that if the service