diff --git a/mapping_provider/backends/rmq/queue.py b/mapping_provider/backends/rmq/queue.py index f772ab9cdd5be9f5b38a95294c208445136d50f7..a53cb79f898206213d9eed8000453579df282fa4 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)