From 985c85da59495790610cb06520257a22425e4418 Mon Sep 17 00:00:00 2001 From: Alvar San Martin Date: Tue, 12 May 2026 13:37:48 +0200 Subject: [PATCH] Colas persistentes --- deployment/develop/docker/docker-compose.yaml | 3 + deployment/develop/rabbit/definitions.json | 180 +++++++++--------- .../config/eventBus.config.ts | 4 +- 3 files changed, 96 insertions(+), 91 deletions(-) diff --git a/deployment/develop/docker/docker-compose.yaml b/deployment/develop/docker/docker-compose.yaml index e3e8b7c..81c5529 100644 --- a/deployment/develop/docker/docker-compose.yaml +++ b/deployment/develop/docker/docker-compose.yaml @@ -6,6 +6,8 @@ networks: external: true internal: driver: bridge +volumes: + rabbitmq_data: services: rabbitmq-sim-broker: @@ -28,6 +30,7 @@ services: entrypoint: ["bash", "/usr/local/bin/docker-entrypoint-wrapper.sh"] command: ["rabbitmq-server"] volumes: + - rabbitmq_data:/var/lib/rabbitmq - ./rabbit/docker-entrypoint-wrapper.sh:/usr/local/bin/docker-entrypoint-wrapper.sh:ro - ./rabbitmq_plugins/enabled_plugins:/etc/rabbitmq/enabled_plugins:ro - ./rabbit/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf:ro diff --git a/deployment/develop/rabbit/definitions.json b/deployment/develop/rabbit/definitions.json index d8c3b60..41a9146 100644 --- a/deployment/develop/rabbit/definitions.json +++ b/deployment/develop/rabbit/definitions.json @@ -1,90 +1,92 @@ { - "rabbit_version": "4.2.2", - "rabbitmq_version": "4.2.2", - "product_name": "RabbitMQ", - "product_version": "4.2.2", - "users": [ - { - "name": "RABBITMQ_USER_PLACEHOLDER", - "password": "RABBITMQ_PASSWORD_PLACEHOLDER", - "tags": ["administrator"] - } - ], - "vhosts": [ - { - "name": "sim-vhost" - } - ], - "permissions": [ - { - "user": "RABBITMQ_USER_PLACEHOLDER", - "vhost": "sim-vhost", - "configure": ".*", - "write": ".*", - "read": ".*" - } - ], - "topic_permissions": [], - "parameters": [], - "global_parameters": [ - { - "name": "cluster_name", - "value": "rabbit@a8d5c6e08439" - }, - { - "name": "internal_cluster_id", - "value": "rabbitmq-cluster-id-gXeBLbsUC2W2tU0Bx_QY_w" - } - ], - "policies": [ - { - "vhost": "sim-vhost", - "name": "pol.sim.dlx", - "pattern": "sim.*", - "apply-to": "queues", - "definition": { - "dead-letter-exchange": "sim.dlx" - }, - "priority": 7 - } - ], - "exchanges": [ - { - "name": "sim.exchange", - "vhost": "sim-vhost", - "type": "topic", - "durable": true, - "auto_delete": false, - "internal": false, - "argurments": {} - }, - { - "name": "sim.dlx", - "vhost": "sim-vhost", - "type": "topic", - "durable": true, - "auto_delete": false, - "internal": false, - "argurments": {} - } - ], - "queues": [ - { - "name": "sim.logs", - "vhost": "sim-vhost", - "durable": true, - "auto_delete": false, - "arguments": {} - } - ], - "bindings": [ - { - "source": "sim.exchange", - "vhost": "sim-vhost", - "destination": "sim.logs", - "destination_type": "queue", - "routing_key": "sim.#", - "arguments": {} - } - ] -} \ No newline at end of file + "rabbit_version": "4.2.2", + "rabbitmq_version": "4.2.2", + "product_name": "RabbitMQ", + "product_version": "4.2.2", + "users": [ + { + "name": "RABBITMQ_USER_PLACEHOLDER", + "password": "RABBITMQ_PASSWORD_PLACEHOLDER", + "tags": [ + "administrator" + ] + } + ], + "vhosts": [ + { + "name": "sim-vhost" + } + ], + "permissions": [ + { + "user": "RABBITMQ_USER_PLACEHOLDER", + "vhost": "sim-vhost", + "configure": ".*", + "write": ".*", + "read": ".*" + } + ], + "topic_permissions": [], + "parameters": [], + "global_parameters": [ + { + "name": "cluster_name", + "value": "rabbit@a8d5c6e08439" + }, + { + "name": "internal_cluster_id", + "value": "rabbitmq-cluster-id-gXeBLbsUC2W2tU0Bx_QY_w" + } + ], + "policies": [ + { + "vhost": "sim-vhost", + "name": "pol.sim.dlx", + "pattern": "sim.*", + "apply-to": "queues", + "definition": { + "dead-letter-exchange": "sim.dlx" + }, + "priority": 7 + } + ], + "exchanges": [ + { + "name": "sim.exchange", + "vhost": "sim-vhost", + "type": "topic", + "durable": true, + "auto_delete": false, + "internal": false, + "argurments": {} + }, + { + "name": "sim.dlx", + "vhost": "sim-vhost", + "type": "topic", + "durable": true, + "auto_delete": false, + "internal": false, + "argurments": {} + } + ], + "queues": [ + { + "name": "sim.logs", + "vhost": "sim-vhost", + "durable": true, + "auto_delete": false, + "arguments": {} + } + ], + "bindings": [ + { + "source": "sim.exchange", + "vhost": "sim-vhost", + "destination": "sim.logs", + "destination_type": "queue", + "routing_key": "sim.#", + "arguments": {} + } + ] +} diff --git a/packages/sim-consumidor-objenious/config/eventBus.config.ts b/packages/sim-consumidor-objenious/config/eventBus.config.ts index 131469f..6a7b0cd 100644 --- a/packages/sim-consumidor-objenious/config/eventBus.config.ts +++ b/packages/sim-consumidor-objenious/config/eventBus.config.ts @@ -46,8 +46,8 @@ async function buildQueues(channel: Channel) { await channel.assertExchange(EXCHANGES.DLX, "topic") await channel.assertExchange(EXCHANGES.MAIN, "topic") - await channel.assertQueue(QUEUES.OBJ) - await channel.assertQueue(QUEUES.OBJDLX) + await channel.assertQueue(QUEUES.OBJ, { durable: true }) + await channel.assertQueue(QUEUES.OBJDLX, { durable: true }) await channel.assertQueue(QUEUES.OBJDEL, { durable: true, arguments: {