|
Boost Users : |
Subject: Re: [Boost-users] Asio and ZeroMQ
From: asif saeed (asif.lse2_at_[hidden])
Date: 2012-02-08 00:23:48
Hi Matthias,
I was actually looking for ASIO support in ZeroMQ. Thank you. But does your
library provide what you say? I mean does it really use ZeroMQ on edges and
use ASIO on a binary component level for distributed systems? I am looking
for something like that and doing this myself would be the last option due
to time constraints.
Many thanks in advance if you continue to work on this :)
-Asif
On Wed, Feb 8, 2012 at 5:15 AM, Matthias Vallentin <
vallentin_at_[hidden]> wrote:
> A while ago, Maciej Gajewski started an effort to use Asio to observe a
> ZeroMQ
> socket [1]. Based on his code, I put together a thin library that wraps the
> implementation details. Since other have requested a working example, here
> it
> is now at github:
>
> https://github.com/mavam/bmq
>
> Any feedback is highly appreciated. A basic usage example looks like this:
>
> #include <boost/asio/io_service.hpp>
> #include <bmq.h>
>
> int main()
> {
> boost::asio::io_service io;
> bmq::context ctx(1);
> bmq::component c(ctx, io);
>
> auto sink = c.add_sink(ZMQ_PAIR, "inproc://x");
> c.subscribe(sink, [](bmq::message&& msg)
> {
> std::string str(static_cast<char*>(msg.data()), msg.size());
> std::cout << str << std::endl;
> });
>
> auto source = c.add_source(ZMQ_PAIR, "inproc://x");
>
> bmq::message msg(const_cast<char*>("foo"), 3, nullptr);
> source->send(msg);
>
> // Execute message handler.
> io.poll();
>
> return 0;
> }
>
> At this point, the library is really thin and only provides very
> rudimentary
> wrapping of ZeroMQ. In the future, I plan to extend it in order to
> facilitate
> applications that build on message-passing. The dataflow abstraction I
> envision
> is essentially a directed graph, where nodes represent components and edges
> communication links. 0mq provides the edges and the Asio handles
> asynchronous
> event processing at the component level. The motiviation is that this model
> lends itself well for scaling out distributed systems over large clusters.
>
> Matthias
>
> [1] http://permalink.gmane.org/gmane.network.zeromq.devel/9538
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net