|
Boost Users : |
Subject: Re: [Boost-users] Asio and ZeroMQ
From: Akira Takahashi (faithandbrave_at_[hidden])
Date: 2012-10-10 21:27:08
Hi, Matthias
2012/2/8 Matthias Vallentin <vallentin_at_[hidden]>:
> 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;
> }
>
...
I cannot find this library. Did move repository?
>>========================
Akira Takahashi
mailto:faithandbrave_at_[hidden]
site: https://sites.google.com/site/faithandbrave/about/en
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