R package for ZMQ
C++ R Makefile
Latest commit 2d3b437 Dec 23, 2015 @armstrtw Merge pull request #20 from mschubert/master
use platform-specific endian encoding
Permalink
Failed to load latest commit information.
R use platform-specific endian encoding Nov 1, 2015
inst
man add disconnect.socket May 11, 2015
src point -I../inst to inst instead of inst/cppzmq Nov 2, 2015
tests Added unit tests for poll.socket. Aug 4, 2012
.Rbuildignore add README.rst to buildignore Nov 28, 2014
.gitignore initial add Sep 26, 2011
.gitmodules remove inst/cppzmq submodule Nov 2, 2015
DESCRIPTION
NAMESPACE add disconnect.socket May 11, 2015
README.rst misc update README.rst Sep 28, 2011

README.rst

Introduction

Date: Sept 27, 2011
Authors: Whit Armstrong
Contact: armstrong.whit@gmail.com
Web site:http://github.com/armstrtw/rzmq
License:GPL-3

Purpose

rzmq is an R binding for ZMQ (http://www.zeromq.org/).

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.

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)