messageQueue-package: Allow R to put and get messages from message queues...

Description Details Author(s) References Examples

Description

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.

Details

Package: messageQueue
Type: Package
Version: 1.0
Date: 2012-10-24
License: GPL

.

Author(s)

Matt MacGillivray Maintainer: Matt MacGillivray <matthew.macgillivray@cornell.edu>

References

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

Examples

 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)

messageQueue documentation built on May 2, 2019, 4:45 p.m.