R Bindings for 'ZeroMQ'

Interface to the 'ZeroMQ' lightweight messaging kernel (see < http://www.zeromq.org/> for more information).


Project Status: Active – The project has reached a stable, usable state and is being actively developed. Build Status AppVeyor Build Status Package-License CRAN Downloads

Purpose

rzmq is an R binding for ZMQ.

Features

rzmq is a message queue for serialized R objects.

  • rzmq implements most the standard socket pairs that ZMQ offers.
  • ZMQ devices are not implemented yet, nor is zmq_poll.
  • Look for more features shortly.

Installation

Binary packages for OS-X or Windows can be installed directly from CRAN:

install.packages("rzmq")

Build from source

Installation from source requires ZeroMQ. On Debian or Ubuntu use libzmq3-dev:

sudo apt-get install -y libzmq3-dev

On Fedora we need zeromq-devel:

sudo yum install zeromq-devel

On CentOS / RHEL we install zeromq3-devel via EPEL:

sudo yum install epel-release
sudo yum install zeromq3-devel

On OS-X use zeromq from Homebrew:

brew install zeromq

Usage

A minimal example of remote execution.

execute this R script on the remote server:

#!/usr/bin/env Rscript
library(rzmq)
context = init.context()
socket = init.socket(context,"ZMQ_REP")
bind.socket(socket,"tcp://*:5555")
while(1) {
    msg = receive.socket(socket);
    fun <- msg$fun
    args <- msg$args
    print(args)
    ans <- do.call(fun,args)
    send.socket(socket,ans);
}

and execute this bit locally:

library(rzmq)
 
remote.exec <- function(socket,fun,...) {
    send.socket(socket,data=list(fun=fun,args=list(...)))
    receive.socket(socket)
}
 
substitute(expr)
context = init.context()
socket = init.socket(context,"ZMQ_REQ")
connect.socket(socket,"tcp://localhost:5555")
 
ans <- remote.exec(socket,sqrt,10000)

News

0.9.4

  • Catching signals and interrupts when polling (Michael Schubert #46)

0.9.3

  • Reuse messages in rzmq #39
  • Explicitly ignore SIGWINCH signal when waiting

0.9.2

  • Add XREQ, XREP socket types (Michael Schubert #32)

0.9.1

  • New maintainer: Jeroen Ooms

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("rzmq")

0.9.4 by Jeroen Ooms, 5 months ago


http://github.com/ropensci/rzmq#readme (devel) http://www.zeromq.org (upstream)


Report a bug at http://github.com/ropensci/rzmq/issues


Browse source code at https://github.com/cran/rzmq


Authors: Whit Armstrong [aut] , Michael Schubert [ctb] , Jeroen Ooms [aut, cre]


Documentation:   PDF Manual  


GPL-3 license


System requirements: ZeroMQ >= 3.0.0: libzmq3-dev (deb) or zeromq-devel (rpm)


Imported by clustermq.


See at CRAN