messageQueue.producer.close: Close a producer of a queue

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

Description

Closes and releases memory reserved when this producer was created.

When a queue producer is created, objects are created in the background and exist for the lifetime of that producer. Explicitly closing the producer safely deallocates memory and restores natural order to the world.

Usage

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

Arguments

producer

The producer object created from messageQueue.factory.getProducerFor

Details

.

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

References

.

See Also

messageQueue.factory.getProducerFor

Examples

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

# ... do some stuff ...

# put a message on the queue
textMessage <- "this is the message I want to send"
status <- messageQueue.producer.putText(queueAproducer, textMessage)

# close the producer
status <- messageQueue.producer.close(queueAproducer)

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