Robert said:
Adding to that, application architectural wise I do not see the benefit
of having multiple queues if you want to read from all of them and treat
objects identically anyway. This is a typical scenario where a single
queue is sufficient and in fact the most efficient design. At the
moment I cannot think of a reason why multiple queues must be there.
Boris, can you elaborate?
Kind regards
robert
Suppose you have 1000 devices which are being sent messages, every
device has its own queue. devices are independent so the messages to
them must be processed in parallel. Processing message in one device
should not stop processing others. However as along as you cannot create
1000 threads, there is a thread pool where every thread waits for
message to device X to arrive on one of the 1000 queues and processed it
in context of device X. If some thread is processing message which was
sent to device X then the queue X is excluded from thread pool to
prevent parallel executing of message on the device by two different
threads.
You don't want to use one queue, because when two messages are sent to
one device one after another then all other messages will wait because
second message will not be processed till first one is processed.
Now once again the question. How do I do select from multiple queues?
in Win32 there's WaitForMultipleObjects
in Java there's Selector and Pipes
in Ruby there's ???