From 5681ede11b10c8ba4708e4bed63a584d68c6e434 Mon Sep 17 00:00:00 2001 From: Evgeni Pandurski Date: Fri, 12 Jul 2024 20:34:26 +0300 Subject: [PATCH] Declare alternate-exchange for creditors_out --- README.md | 2 ++ swpt_stomp/configure_queue.py | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 828c6f4..7586e04 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ Containers started from the generated docker image must have access to the following services: 1. [RabbitMQ] server instance, which acts as broker for SMP messages. + The [rabbitmq_random_exchange plugin] should be enabled. For each peer node, at least one [RabbitMQ queue] must be configured on the broker instance, so that all SMP messages that need to be send to a @@ -211,6 +212,7 @@ How to setup a development environment [RabbitMQ]: https://www.rabbitmq.com/ [RabbitMQ queue]: https://www.cloudamqp.com/blog/part1-rabbitmq-for-beginners-what-is-rabbitmq.html [RabbitMQ exchange]: https://www.cloudamqp.com/blog/part4-rabbitmq-for-beginners-exchanges-routing-keys-bindings.html +[rabbitmq_random_exchange plugin]: https://github.com/rabbitmq/rabbitmq-random-exchange [scripts]: https://github.com/swaptacular/swpt_ca_scripts [Docker Engine]: https://docs.docker.com/engine/ [Docker Compose]: https://docs.docker.com/compose/ diff --git a/swpt_stomp/configure_queue.py b/swpt_stomp/configure_queue.py index 4954976..2ec76c8 100644 --- a/swpt_stomp/configure_queue.py +++ b/swpt_stomp/configure_queue.py @@ -106,8 +106,14 @@ async def bind_queue() -> None: elif owner_node_type == NodeType.CA: assert peer_node_type == NodeType.AA owner_prefix = "ca" + await channel.declare_exchange( + "ca.loopback_filter", "headers", durable=True + ) main_exchange = await channel.declare_exchange( - "creditors_out", "topic", durable=True + "creditors_out", + "topic", + durable=True, + arguments={"alternate-exchange": "ca.loopback_filter"}, ) binding_key = peer_data.debtors_subnet.binding_key else: