Implementing a simple message queue
946216Jun 27 2012 — edited Jul 2 2012
My project requires a messgae queue to be implemented which is exposed to outer world for dropping messages.I evaluated various free message queue/message bus options available like MSMQ, ActiveMQ,RabitMQ,ZeroMQ etc but found them either a overkill for my application or lacking the required performance or having a very high learning curve.
So I am building my own message queue. The last area which is to be architected is queue pop area. I need to know as which one of these two is the best optimised way of taking out message from queue:-
1) The consumers should register themselves with queue by imlementing a callback.When any message comes in queue, queue will invoke there specific method along with message.(This will take out processing thing from consumer from consumer but puts the burden on queue as queue has to wait until consumer uses the message and thread of queue becomes free for sending next message). I think, this is one way recommended in Java JMS specifications, though i am not sure.
2) The consumers should register themselves with queue by imlementing a callback.When any message comes in queue, queue will just intimate the consumer with no thread blocking on the queue side. It is consumers duty to then take out the message from queue.
I am not sure which one is best optimised and industry wide implemented in various commmercial/open source offerings.