!--a11y-->
Creating Temporary Destinations 
You can dynamically create destinations that last as long as the lifetime of the connection, known as temporary destinations. Consumers of temporary destinations can be created only from the same connection that created the destination.
The temporary destinations:
● Are intended to facilitate a simple request/reply mechanism.
● Represent a message queue or topic to which a producer can send and from which a consumer can receive messages.
● Exist only for the lifetime of the connection in which they are created.
● Are deleted when the connection is closed, and all messages inside the destination are lost.
● Are not intended to survive a server failure.
● Only consumers created in the same connection as the temporary destination can receive messages from it, although all producers can send messages to it.

Although you can easily create temporary destinations dynamically without the help of an administrator, they require as many resources on the provider side as regular destinations, so avoid using temporary destinations extensively.
Use the following source code:

// create a new temporary queue Queue queue = session.createTemporaryQueue(); // create a new temporary topic Topic topic = session.createTemporaryTopic(); |