messageQueue.factory.getConsumerFor: Connect to a queue for reading

Description Usage Arguments Details Value Note Author(s) References See Also Examples

Description

Make a connection to a queue for reading.

The queue can be on a local, or remote host. It is important to know what type of queue it is as the underlying implementation details are different. Currently, only 'activeMQ' and 'rabbitMQ' are supported.

All connections should be closed when no longer needed.

Usage

1
queueAConsumer <- messageQueue.factory.getConsumerFor(url, queue, queueType)

Arguments

url

URL to the machine hosting the queue in the format 'tcp://<hostname>:<port>'

queue

Name of the queue (and/or topic) to connect to on that host. The format of this is dictated by the queue type you are connecting to.

queueType

What type of queue provider are you connecting to? Required because each queue type functions differently under the covers.

Supported Values: 'rabbitMQ' or 'activeMQ'

Details

.

Value

If successful, this method returns an object representing a consumer of a queue. If unsuccessful, this method returns null.

Note

.

Author(s)

Matt MacGillivray

References

.

See Also

messageQueue.consumer.close

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# 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 consumer
queueAconsumer <- messageQueue.factory.getConsumerFor(queueUrl,"queueA","activeMQ")

# retrieve the next available text message
textMessage <- messageQueue.consumer.getNextText(queueAconsumer)

# ... do some stuff ...

# close the consumer
status <- messageQueue.consumer.close(queueAconsumer)

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