Close a consumer of a queue

Share:

Description

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.

Usage

1
status <- messageQueue.consumer.close(consumer)

Arguments

consumer

The consumer object created from messageQueue.factory.getConsumerFor

Details

Closes a consumer.

Value

Returns a positive number (i.e. > 0) if it was successful. Returns a negative number (i.e. < 0) if it was unsuccessful.

Note

.

Author(s)

Matt MacGillivray

See Also

messageQueue.factory.getConsumerFor

Examples

 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)