I'm not sure your question makes sense. A message can only be received from the queue by the consumer of the queue. To find out if a message is in the queue, you need to look in the queue. The only way to do this is to be a consumer.
If you really want to be able to have a script that controls the command line interface for the management plugin. This can interrogate the queue, and when it has more than one, you can run a program that will run the consumer from the queue.
None of this makes any sense. If he just sits waiting for the queue and does nothing, he is unlikely to consume any resources, so I donβt see what the problem will be with the user 24/7.
Of course, the consumer does not need to run 24/7, that is, part of the MQ point. It is asynchronous. The consumer does not need to start when the manufacturer writes to the queue. Therefore, you may have a scheduled task that periodically launches your consumer to check and process messages from the queue. But I do not think that this is what you want.
The whole point of listening: do nothing until a message appears, process the message, do nothing until the next message. This is what you want in the first sentence of your question. Why is there a problem with listening?
robthewolf
source share