Description Details Author(s) References Examples
This package creates a simple way to interact with message queues regardless of the underlying provider of the queue (activeMQ or rabbitMQ).
The idea is to provide this basic functionality such that R doesn't need to deal with the specifics of queues or their underlying implementation differences.
Provides a simple way to PUT a text message on a queue and GET a text message from a queue.
Package: | messageQueue |
Type: | Package |
Version: | 1.0 |
Date: | 2012-10-24 |
License: | GPL |
.
Matt MacGillivray Maintainer: Matt MacGillivray <matthew.macgillivray@cornell.edu>
RabbitMQ - http://www.rabbitmq.com/ ActiveMQ - http://activemq.apache.org/ rJava - http://www.rforge.net/rJava/ Writing Java Extensions - http://cran.r-project.org/web/packages/helloJavaWorld/vignettes/helloJavaWorld.pdf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | # Basic example using all functions
# NOTE: I can't get the example to run via the build server automatically, so I'm commenting it out
# NORMALLY, this url would be of the form 'tcp://host:61616', but for testing, activeMQ provides
# a local/internal queue that works by default
queueUrl <- "vm://localhost?broker.persistent=false"
# create a queue producer
queueAproducer <- messageQueue.factory.getProducerFor(queueUrl,"queueA","activeMQ")
# ... do some stuff ...
# put a message on the queue
textMessage <- "this is the message I want to send"
status <- messageQueue.producer.putText(queueAproducer, textMessage)
# close the producer
status <- messageQueue.producer.close(queueAproducer)
# create a queue consumer
queueAconsumer <- messageQueue.factory.getConsumerFor(queueUrl,"queueA","activeMQ")
# retrieve the next available text message
textMessage <- messageQueue.consumer.getNextText(queueAconsumer)
cat(textMessage)
# ... do some stuff ...
# close the consumer
status <- messageQueue.consumer.close(queueAconsumer)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.