Programming with Big Data -- Interface to ZeroMQ
'ZeroMQ' is a well-known library for high-performance
asynchronous messaging in scalable, distributed applications. This
package provides high level R wrapper functions to easily utilize
'ZeroMQ'. We mainly focus on interactive client/server programming
frameworks. For convenience, a minimal 'ZeroMQ' library (4.1.0 rc1)
is shipped with 'pbdZMQ', which can be used if no system installation
of 'ZeroMQ' is available. A few wrapper functions compatible with
'rzmq' are also provided.
pbdZMQ is an R package providing a simplified interface to ZeroMQ with a focus on client/server programming frameworks. Notably, pbdZMQ should allow for the use of ZeroMQ on Windows platforms.
The package contains 3 separate interfaces:
- One modeled after the ZeroMQ C interface (see help("czmq"))
- One modeled after the PyZMQ interface (see help("pyzmq"))
- One modeled after the rzmq interface (see help("rzmq"))
The primary focus of pbdZMQ is for building client/server interfaces for R. An example of this can be found in the pbdCS package, which uses this model to control batch MPI servers interactively. There are also several illustrative examples in the pbdZMQ package vignette.
The basic idea is that you need a server R process, and a separate client R process. For demonstration/simplicity, assume they are both running on the same machine. The server we describe here is very basic. You can see a more detailed example in the pbdZMQ package vignette.
Save the following as, say,
server.r and run it in batch by
Rscript server.r from a terminal.
library(pbdZMQ) context = zmq$Context() socket = context$socket("ZMQ_REP") socket$bind("tcp://*:55555") cat("Client command: ") msg <- socket$receive() cat(msg, "\n") socket$send("Message received!")
From an interactive R session (not in batch), enter the following:
library(pbdZMQ) context = zmq$Context() socket = context$socket("ZMQ_REQ") socket$connect("tcp://localhost:55555") socket$send("1+1") socket$receive()
If all goes well, your message should be sent from the client to the server, before your server terminates.
For an example of how to do this more persistently, see the pbdZMQ package vignette.
- R version 3.0.0 or higher.
- Linux, Mac OSX, Windows, or FreeBSD.
- libzmq >= 4.0.4.
- Solaris 10 requiring external libzmq 4.0.7 and OpenCSW.
A distribution of libzmq is shipped with pbdZMQ for convenience. However,
if you already have a system installation of ZeroMQ, then it is simple
to use that with pbdZMQ. Full details on installation and troubleshooting
can be found in the package vignette, located at
inst/doc/pbdMPI-guide.pdf of the pbdZMQ source tree.
The package can be installed from the CRAN via the usual
install.packages("pbdZMQ"), or via the devtools package:
pbdMPI is authored and maintained by:
- Wei-Chen Chen
- Drew Schmidt
- Christian Heckendorf
- George Ostrouchov
With additional contributions from:
- Whit Armstrong (some functions are modified from rzmq for backwards compatibility)
- Brian Ripley (C code of shellexec)
- The R Core team (some functions are modified from the R source code)
For the distribution of ZeroMQ that is shipped with pbdZMQ, you can find details of authorship and copyright in
inst/zmq_copyright/ of the pbdZMQ source tree, or under
zmq_copyright/ of a binary installation of pbdZMQ.
Functions in pbdZMQ
|Socket Functions||Socket Functions|
|Poll Functions||Poll Functions|
|Initial Control Functions||Initial controls in pbdZMQ|
|pbdZMQ-package||Programming with Big Data -- Interface to ZeroMQ|
|shellexec.wcc||Shell Execution via cmd windows|
|ZMQ Control Environment||Sets of controls in pbdZMQ.|
|ZMQ Control Functions||Sets of controls in pbdZMQ.|
|Message Function||Message Functions|
|Send Receive Functions||Send Receive Functions|
|Context Functions||Context Functions|
|Send Receive Multiple Raw Buffers||Send Receive Multiple Raw Buffers|
|Set Control Functions||Set controls in pbdZMQ|
|File Transfer Functions||File Transfer Functions|
|Wrapper Functions for rzmq||All Wrapper Functions for rzmq|
|Utility Functions||Utility Functions|
|C-like Wrapper Functions for ZeroMQ||The C-like ZeroMQ Interface|
|New Poll Functions||New Poll Functions|
|PyZMQ-like Interface||R6 ZMQ Interface|
|address||Form an Address/Endpoint|
Last month downloads
|Copyright||See files AUTHORS, COPYING, COPYING.LESSER, and MAINTAINERS in pbdZMQ/inst/zmq_copyright/ for the ZeroMQ source files in src/zmq_src/ which are under GPL-3.|
|SystemRequirements||Linux, Mac OSX, and Windows, or ZeroMQ library >= 4.0.4. Solaris 10 needs ZeroMQ library 4.0.7 and OpenCSW.|
|MailingList||Please send questions and comments regarding pbdR to RBigData@gmail.com|
|Packaged||2016-05-19 22:02:56 UTC; snoweye|
Include our badge in your README