Ziang Gao <[email protected]> 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
queue.
Inside the main loop of some class servicing the SUB I'd do like this
pseudocode:
while (true) {
sock.recv(msg);
// push back the message, maybe to a per-topic container
queue_message(msg);
// check if enough is queue, maybe per topic
auto topics_ready = check_queues();
if (topics_ready) {
publish_queues(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.
-Brett.
signature.asc
Description: PGP signature
_______________________________________________ zeromq-dev mailing list [email protected] https://lists.zeromq.org/mailman/listinfo/zeromq-dev
