开发者

Message queue, c++ multi thread

I looking for cross platform multithread message queue implementation on c++ (not slot/signal) . Better if it 开发者_Go百科based on subject-observer pattern.


ZeroMQ looks like it may be what you are looking for.

It is well documented with lots of examples, such as this one: http://www.zeromq.org/blog:multithreaded-server , which may be what you are trying to implement.


Take a look to the "ISL" open source project (stands for an "Internet Server Library", C++), which SVN-repository is located on http://svn.storozhilov.com/isl/ - isl::AbstractMessageBroker class is a good candidate for a basement of your job. This is quite simple but extensible skeleton for any message broker subsystem (DBus, JMS, AMQP, etc.). Each client is served by 2 threads from the pre-started thread's pool: one is for receiving message from the transport and processing message and another is for sending message to transport. So, actually in order to implement your messaging system you have to override at least following three virtual methods:

    isl::AbstractMessageBroker::receiveMessage(...);
    isl::AbstractMessageBroker::processMessage(...);
    isl::AbstractMessageBroker::sendMessage(...);

Example of use is in trunk/examples/EchoMessageBroker directory. Responses client with echoed message, terminates connection on "bye\r\n" message, terminates itself on SIGINT.


You can try out Apache ActiveMQ. http://activemq.apache.org. Quite robust.We use it for a FIX messaging platform, quite responsive and easy to configure also.


Have a look at Intel's Open Source lib Threading Building Blocks. They are cross-platform and last time I looked they had lock-free containers.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜