How to handle a blocking function inside a node?
Hello,
I am trying to create a node (I am using ROS2 Foxy with Python) that will have a two way communication with RabbitMQ.
My problem is that in order for me to listen to a RabbitMQ queue I have to use a blocking function that stops the rest of my node to keep functioning (for example - the node should also send messages to the RabbitMQ).
To solve this issue, I have considered two options:
- Create two separate nodes, first node to listen to the RabbitMQ queue and the other node for sending messages. This approach seems more straightforward and compatible with the ROS2 framework, but may require more resources with the extra node. (I might be wrong on that one).
- Use threading in my node - I will run a separate thread inside my node to listen to the RabbitMQ queue.
I would appreciate any advice you could provide. Thanks!