Commit 928c4d6e authored by Gill Lumer-Klabbers's avatar Gill Lumer-Klabbers
Browse files

Docker for two-way rmq confirmed working

parent 2822d3ad
version: '3'
services:
rmq_server:
container_name: rmq-srv
build:
context: ../
dockerfile: ./docker/rmq-server/rmq_server.Dockerfile
restart: always
network_mode: bridge
ports:
- 5672:5672
- 15672:15672
- 1883:1883
rmq_publisher:
container_name: rmq-pub
build:
context: ../
dockerfile: ./docker/rmq-publisher/rmq_publisher.Dockerfile
depends_on:
- rmq_server
restart: always
network_mode: bridge
rmq_subscriber:
container_name: rmq-sub
build:
context: ../
dockerfile: ./docker/rmq-subscriber/rmq_subscriber.Dockerfile
depends_on:
- rmq_server
restart: always
network_mode: bridge
......@@ -117,7 +117,7 @@ class RabbitMQPublisher(Node):
def init_rabbitmq(self):
self.get_logger().info("Initializing Connection")
time.sle
time.sleep(3)
for i in range(5):
try:
self.rmq_connection = pika.BlockingConnection(
......@@ -147,7 +147,7 @@ class RabbitMQPublisher(Node):
except Exception as err:
if i == 0:
self.get_logger().info("RabbitMQ Initialization failed. Is rabbitmq running?")
self.get_logger().info(err)
self.get_logger().info(str(err))
self.get_logger().info(f"Retrying... (try {i+1} out of 5)")
time.sleep(1)
else:
......
......@@ -102,7 +102,7 @@ class RabbitMQSubscriber(Node):
except Exception as err:
if i == 0:
self.get_logger().info("RabbitMQ Initialization failed. Is rabbitmq running?")
self.get_logger().info(err)
self.get_logger().info(str(err))
self.get_logger().info(f"Retrying... (try {i+1} out of 5)")
time.sleep(1)
else:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment