rzmq v0.9.6

0

Monthly downloads

0th

Percentile

R Bindings for 'ZeroMQ'

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

Readme

rzmq

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)

Functions in rzmq

Name Description
send.socket send a message.
send.multipart Send multipart ZMQ message.
receive.multipart Receive multipart ZMQ message
poll.socket Polls a list of sockets, waiting for the presence of a nonblocking read, write, or error event.
zmq.version get version of libzmq
zmq.error get libzmq error numbers and error strings
bind.socket Create an endpoint for accepting connections and bind it to the socket referenced by the socket argument.
connect.socket Connect the socket referenced by the socket argument to the endpoint specified by the endpoint argument.
socket.options set a socket option.
init.context initailize zmq context and zmq socket
receive.socket Receive a message from the socket referenced by the socket argument.
init.message create a message object.
No Results!

Last month downloads

Details

License GPL-3
SystemRequirements ZeroMQ >= 3.0.0: libzmq3-dev (deb) or zeromq-devel (rpm)
URL http://github.com/ropensci/rzmq#readme (devel) http://www.zeromq.org (upstream)
BugReports http://github.com/ropensci/rzmq/issues
NeedsCompilation yes
Packaged 2019-03-01 17:07:50 UTC; jeroen
Repository CRAN
Date/Publication 2019-03-01 21:50:09 UTC

Include our badge in your README

[![Rdoc](http://www.rdocumentation.org/badges/version/rzmq)](http://www.rdocumentation.org/packages/rzmq)