Git Product home page Git Product logo

azmq's Introduction

AZMQ Boost Asio + ZeroMQ

Welcome

The azmq library provides Boost Asio style bindings for ZeroMQ

This library is built on top of ZeroMQ's standard C interface and is intended to work well with C++ applications which use the Boost libraries in general, and Asio in particular.

The main abstraction exposed by the library is azmq::socket which provides an Asio style socket interface to the underlying zeromq socket and interfaces with Asio's io_service(). The socket implementation participates in the io_service's reactor for asynchronous IO and may be freely mixed with other Asio socket types (raw TCP/UDP/Serial/etc.).

Building and installation

Building requires a recent version of CMake (2.8.12 or later for Visual Studio, 2.8 or later for the rest), and a C++ compiler which supports C++11. Currently this has been tested with -

  • Xcode 5.1 on OS X 10.8
  • Xcode 6 on OS X 10.9
  • Xcode 6.4 on OS X 10.10
  • Xcode 7.1 on OS X 10.11
  • GCC 4.8 + Boost 1.48 on CentOS 6
  • GCC 4.8 + Boost 1.53 on CentOS 7
  • GCC 4.8 on Arch Linux and Ubuntu
  • GCC 4.8 on Ubuntu
  • GCC 5.3 + Boost 1.60 on Ubuntu
  • Microsoft Visual Studio 2013 on Windows Server 2008 R2

Library dependencies are -

  • Boost 1.48 or later
  • ZeroMQ 4.0.x

Tests and example code require -

  • Boost 1.54 or later

To build on Linux / OS X -

$ mkdir build && cd build
$ cmake ..
$ make
$ make test
$ make install

To build on Windows -

> mkdir build
> cd build
> cmake ..
> cmake --build . --config Release
> ctest . -C Release

You can also open Visual Studio solution from build directory after invoking CMake.

To change the default install location use -DCMAKE_INSTALL_PREFIX when invoking CMake.

To change where the build looks for Boost and ZeroMQ use -DBOOST_ROOT=<my custom Boost install> and -DZMQ_ROOT=<my custom ZeroMQ install> when invoking CMake. Or set BOOST_ROOT and ZMQ_ROOT environment variables.

Packaging via CPack

Building and packaging -

> mkdir build
> cd build
> cmake -DAZMQ_NO_TESTS=1 [email protected] ..
> cpack -G TGZ
> cpack -G RPM
> cpack -G DEB

Example Code

This is an azmq version of the code presented in the ZeroMQ guide at http://zeromq.org/intro:read-the-manual

#include <azmq/socket.hpp>
#include <boost/asio.hpp>
#include <array>

namespace asio = boost::asio;

int main(int argc, char** argv) {
    asio::io_service ios;
    azmq::sub_socket subscriber(ios);
    subscriber.connect("tcp://192.168.55.112:5556");
    subscriber.connect("tcp://192.168.55.201:7721");
    subscriber.set_option(azmq::socket::subscribe("NASDAQ"));

    azmq::pub_socket publisher(ios);
    publisher.bind("ipc://nasdaq-feed");

    std::array<char, 256> buf;
    for (;;) {
        auto size = subscriber.receive(asio::buffer(buf));
        publisher.send(asio::buffer(buf));
    }
    return 0;
}

Further examples may be found in doc/examples

Build status

AZMQ build status

Copying

Use of this software is granted under the the BOOST 1.0 license (same as Boost Asio). For details see the file `LICENSE-BOOST_1_0 included with the distribution.

Contributing

AZMQ uses the C4.1 (Collective Code Construction Contract) process for contributions. See the accompanying CONTRIBUTING file for more information.

azmq's People

Contributors

rodgert avatar oliora avatar hintjens avatar aboseley avatar dkl avatar timblechmann avatar xaqq avatar sphaero avatar dnadlinger avatar zachwhaley avatar toresbe avatar slepasteur avatar ricnewton avatar rascani avatar vinipsmaker2 avatar markus-t314 avatar knoerleman avatar jvanns avatar jflemer-ndp avatar c-rack avatar ahundt avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.