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.
messageText <- messageQueue.consumer.getNextText(consumer)
The consumer object created from
Retrieves the next available text message in a queue.
Returns non-null text if it was successful. Returns null if no messages were received.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.