Closes and releases memory reserved when this consumer was created.
When a queue consumer is created, objects are created in the background and exist for the lifetime of that consumer. Explicitly closing the consumer safely deallocates memory and restores natural order to the world.
status <- messageQueue.consumer.close(consumer)
The consumer object created from
Closes a consumer.
Returns a positive number (i.e. > 0) if it was successful. Returns a negative number (i.e. < 0) if it was unsuccessful.
1 2 3 4 5 6 7 8 9 10 11
# 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") # ... do some stuff ... # close the consumer status <- messageQueue.consumer.close(queueAconsumer)