Просмотр исходного кода

Added queue type config for topic, values are classic and quorum

Tuna Celik 1 год назад
Родитель
Сommit
22c843c49c
4 измененных файлов с 14 добавлено и 2 удалено
  1. 6 0
      DOCUMENTATION.md
  2. 2 1
      config
  3. 4 0
      radicale/config.py
  4. 2 1
      radicale/hook/rabbitmq/__init__.py

+ 6 - 0
DOCUMENTATION.md

@@ -855,6 +855,12 @@ RabbitMQ topic to publish message.
 
 Default:
 
+#### rabbitmq_topic
+
+RabbitMQ queue type for the topic.
+
+Default: classic
+
 ## Supported Clients
 
 Radicale has been tested with:

+ 2 - 1
config

@@ -125,4 +125,5 @@
 # Value: none | rabbitmq
 #type = none
 #rabbitmq_endpoint =
-#rabbitmq_topic =
+#rabbitmq_topic =
+#rabbitmq_queue_type = classic

+ 4 - 0
radicale/config.py

@@ -223,6 +223,10 @@ DEFAULT_CONFIG_SCHEMA: types.CONFIG_SCHEMA = OrderedDict([
         ("rabbitmq_topic", {
             "value": "",
             "help": "topic to declare queue",
+            "type": str}),
+        ("rabbitmq_queue_type", {
+            "value": "",
+            "help": "queue type for topic declaration",
             "type": str})])),
     ("web", OrderedDict([
         ("type", {

+ 2 - 1
radicale/hook/rabbitmq/__init__.py

@@ -12,6 +12,7 @@ class Hook(hook.BaseHook):
         super().__init__(configuration)
         self._endpoint = configuration.get("hook", "rabbitmq_endpoint")
         self._topic = configuration.get("hook", "rabbitmq_topic")
+        self._queue_type = configuration.get("hook", "rabbitmq_queue_type")
         self._encoding = configuration.get("encoding", "stock")
 
         self._make_connection_synced()
@@ -23,7 +24,7 @@ class Hook(hook.BaseHook):
         self._channel = connection.channel()
 
     def _make_declare_queue_synced(self):
-        self._channel.queue_declare(queue=self._topic, durable=True)
+        self._channel.queue_declare(queue=self._topic, durable=True, arguments={"x-queue-type": self._queue_type})
 
     def notify(self, notification_item):
         if isinstance(notification_item, HookNotificationItem):