[zeromq-dev] Publish to and Read from a buffer

Brett Viren brett.viren at gmail.com
Wed Mar 18 19:17:48 CET 2020

Ziang Gao <ziang.gao at aerodefense.tech> writes:

> In this case, are there any libraries or modules you can recommend
> that can create a queue right after connecting the port?

I use C++ so would probably use simply a std::deque or std::vector as a

Inside the main loop of some class servicing the SUB I'd do like this

  while (true) {
    // push back the message, maybe to a per-topic container
    // check if enough is queue, maybe per topic
    auto topics_ready = check_queues();
    if (topics_ready) { 

Hopefully the method names are evocative enough to know what they might
be implemented as.

If this were not inside a "device" but directly in the final consumer
then mentally change "public_queues()" to be named "process_queues()".

> Or as you suggested, defining queues within forwarder would
> be a better design? And how to achieve it?

Again, it really depends on many things.  I will typically try a few
implementations and benchmark or otherwise evaluate the results.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20200318/7678f9c4/attachment.sig>

More information about the zeromq-dev mailing list