Skip to content

prismskylabs/ProtoQueue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ProtoQueue Build Status Coverage Status

ProtoQueue is a template wrapper around zeromq that simplifies sending and receiving protobuf messages. It abstracts away the messiness of context and port management, allowing you to maintain focus on the semantics of your network topology and message protocol.

Look at how easy it is to pass this message around:

// basic.proto
message Basic {
  required string value = 1;
}
#include <protoqueue.h> // This is the API header
#include <iostream>
#include "basic.pb.h"

int main(int argc, char** argv) {
    // This chooses a port for you and binds a ZMQ_PAIR to it by default
    auto sender = prism::protoqueue::Bind<Basic>();

    // This connects to the same port with a ZMQ_PAIR socket
    auto receiver = prism::protoqueue::Connect<Basic>(sender.get_port()); 

    Basic basic;
    basic.set_value("hello world!");
    sender.Send(basic);

    auto received = receiver.Receive();
    std::cout << received.value() << std::endl; // Prints "hello world!"
}

Without ProtoQueue, you're stuck with this mess.

Requirements

Build

The recommended way to build this library is by using an out of source build directory:

mkdir build
cd build
cmake ..
make

By default, this will build the tests. To run the tests, simply run:

ctest

This project has an embedded source of the googletest framework so it is not explicitly required on your system. To use your system version, set this CMake option:

cmake -DUSE_SYSTEM_GTEST=ON ..

and then run make.

A successful build will result in a single library that you can link against your project.

Contributing

Please fork this repository and contribute back using pull requests. Features can be requested using issues.

About

A simple wrapper for zeromq and protobuf messages

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published