From 33ac4931f623b76bc9321fb60abb129a637ee318 Mon Sep 17 00:00:00 2001
From: Erik Reid <erik.reid@geant.org>
Date: Sat, 24 May 2025 18:38:19 +0200
Subject: [PATCH] bugfix for routing keys introduced in mypy refactoring

---
 mapping_provider/backends/rmq/queue.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/mapping_provider/backends/rmq/queue.py b/mapping_provider/backends/rmq/queue.py
index f772ab9..a53cb79 100644
--- a/mapping_provider/backends/rmq/queue.py
+++ b/mapping_provider/backends/rmq/queue.py
@@ -74,7 +74,7 @@ def setup_channel(
     queue_declare: bool = True,
     exclusive: bool = False,
     single_active_consumer: bool = False,
-    routing_keys: str | Sequence[str | None] | None = None,
+    routing_keys: Sequence[str] = [],
     prefetch_count: int | None = None,
     force_quorum_queue: bool = False,
 ) -> tuple[BlockingChannel, str | None]:
@@ -142,8 +142,11 @@ def setup_channel(
 
     assert queue_name, "queue name must not be empty here"
  
-    if routing_keys is None or isinstance(routing_keys, str):
-        routing_keys = [routing_keys]
+    if not routing_keys:
+        # in case no routing keys are provided (as for fanout exchanges),
+        # ensure the queue is still bound to the exchange
+        routing_keys = [None]
+
     for rk in routing_keys:
         channel.queue_bind(exchange=exchange_name, queue=queue_name, routing_key=rk)
 
-- 
GitLab