CZTop is a CZMQ binding for Ruby. It is based on czmq-ffi-gen, the generated low-level FFI binding of CZMQ and has a focus on being easy to use for Rubyists (POLS) and providing first class support for security mechanisms (like CURVE).
Here's an overview of the core classes:
- Poller (based on
- REQ < Socket
- REP < Socket
- ROUTER < Socket
- DEALER < Socket
- PUSH < Socket
- PULL < Socket
- PUB < Socket
- SUB < Socket
- XPUB < Socket
- XSUB < Socket
- PAIR < Socket
- STREAM < Socket
- CLIENT < Socket
- SERVER < Socket
- RADIO < Socket
- DISH < Socket
- SCATTER < Socket
- GATHER < Socket
- Padded < Z85
More information in the API documentation.
- Ruby-like API
- method names
- sending a message via a socket is done with
socket << "simple message"
socket << ["multi", "frame", "message"]
#x=methods instead of
#set_x(e.g. socket options)
#where it makes sense (e.g. on a Message, Config, or Certificate)
- no manual error checking needed
- if there's an error, an appropriate exception is raised
- of course, no manual dealing with the ZMQ context
- easy security
Socket#CURVE_server!(cert)on the server
Socket#CURVE_client!(client_cert, server_cert)on the client
- socket types as Ruby classes
- no need to manually pass type constants
- but you can:
#subscribeonly exists on
- CZMQ >= 4.2
- ZMQ >= 4.3
On Ubuntu 20.04+:
$ sudo apt install libczmq-dev
On macOS using Homebrew, run:
$ brew install czmq
- MRI (2.6, 2.7, 3.0)
- Rubinius (HEAD)
- JRuby 9000 (HEAD)
To use this gem, add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install cztop
The API should be fairly straight-forward to anyone who is familiar with CZMQ and Ruby. The following API documentation is currently available:
- YARD API documentation (release)
Feel free to start a wiki page.
CZTop is just a convenience layer on top of the thin czmq-ffi-gen library.
Make sure to check out the perf directory for latency and throughput measurement scripts.
See the examples directory for some examples.
Bug reports and pull requests are welcome on GitHub at https://github.com/paddor/cztop.
To run the tests before/after you made any changes to the source and have
created a test case for it, use
The gem is available as open source under the terms of the ISC License. See the LICENSE file.