messageQueue.consumer.getNextText: Retrieve the next available text message

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

Description

For a consumer of a queue, retrieve the next available text message on a queue.

If the next message isn't in text format, it will be skipped and the next message will be checked.

This is a non-blocking method, that is, it will not wait for a message to appear. If no messages are available in the queue (it's empty), this method will return null.

Usage

1
messageText <- messageQueue.consumer.getNextText(consumer)

Arguments

consumer

The consumer object created from messageQueue.factory.getConsumerFor

Details

Retrieves the next available text message in a queue.

Value

Returns non-null text if it was successful. Returns null if no messages were received.

Note

.

Author(s)

Matt MacGillivray

See Also

messageQueue.factory.getConsumerFor

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.