Skip to content

Commit 2082011

Browse files
authored
Allow user to set custom message queue connection args (#13)
* Allow users to set custom arguments for MQ in config * Update config docs
1 parent 0894150 commit 2082011

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ As for the JSON configuration file, details are as follows:
3636
- queue: Queue name
3737
- vhost: Message queue virtual host
3838
- consumer_queue: Queue to consume messages from (for notifications)
39+
- arguments: Connection arguments
3940
- ispyb
4041
- pool: Connection pool size
4142
- overflow: Connection pool overflow max size

config.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@
3030
"port": 5672,
3131
"queue": "processing_recipe",
3232
"vhost": "/",
33-
"consumer_queue": "pato_notification"
33+
"consumer_queue": "pato_notification",
34+
"arguments": {
35+
"x-dead-letter-exchange": ""
36+
}
3437
},
3538
"ispyb": { "pool": 3, "overflow": 6 },
3639
"facility": {

src/pato/utils/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class MQ:
4545
host: str
4646
port: int
4747
queue: str
48+
arguments: dict[str, str | int]
4849
user: str = "guest"
4950
password: str = "guest"
5051
vhost: str = "zocalo"

src/pato/utils/pika.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def consume(
3535
Config.mq.consumer_queue,
3636
exclusive=False,
3737
durable=True,
38-
arguments={"x-queue-type": "quorum"},
38+
arguments=Config.mq.arguments,
3939
)
4040
queue = result.method.queue
4141
self.channel.queue_bind(

0 commit comments

Comments
 (0)