How do Publisher/Subscriber Message Queues Work?
Hi all,
I can't seem to find any documentation on this, but it I want to understand more deeply how messaging queues work.
My understanding is that each node has its own publisher and subscriber queues, and it is up the ROS backend to pull messages from publisher queues and push them onto subscriber queues.
Let's say I have a publisher that publishes int32s at a fast rate into a queue of size 10. When my node runs the publish() function, it will push values onto the end of the queue, [1, 2, 3, 4, 5, ...]. If the queue grows too large, queue_size will drop the values at the front of the queue leaving me with [2, 3, 4, 5, 6, ...]. Similarly, if ROS sends the first message in the queue over the wire that automatically pops it and leaves us with the same message queue of [2, 3, 4, 5, 6, ...].
Now on the subscriber end it seems like the logic is when the callback is called the first value is popped, similarly to the above, if the subscriber queue_size is exceeded, the backend is the one that pops the first values and will append the new one to the end in a FIFO manner.
Is this somewhat correct? Thanks!