I have cluster of brokers. Two applications exchange messages. The scenario is this:
1) APP1 creates connection to Broker1
2) APP2 creates connection to Broker2
3) APP1 sends message to Queue1 and waits for response from temporary queue
4) APP2 reads message from Queue1 and tries to send response temporary queue defined in request message header
5) TemporaryQueue not found exception is thrown
If both apps are connected to same broker, then it works.
Is it possible to have clusterwide access to Temporary Queues.
The response message should find its way back to Broker1 in this case. How does APP2 read the response queue from the request message and send to this queue? The JMSReplyTo header is the correct mechanism for this. Message.getJMSReplyTo() returns a Destination object. You should be able to send directly to this. See /samples/QueuePTP/RequestReply/Replier.java for an example.
Actually temporary queues were accessible clusterwide if JMSReplyTo header is used.
Testing it with JMS Test Client is what causes the error.
You'll probably find it works with the JMS Test Client if you prefix the temporary queue name with the cluster's routing node name (followed by '::'), e.g.:
Or even just '::' - a short-cut to reference a global queue in the local node/cluster:
This aspect is automatically taken care of if you use JMSReplyTo directly.
Incidentally, note the distiction between a clusterwide queue and a global non-clustered queue:
A clusterwide queue is shared between clustered brokers, so clients connected to any broker in the cluster can send to and receive from it.
A global non-clustered queue (such as a temporary queue) is local to a specific broker and only a locally-connected consumer can receive from it, but by virtue of being global other brokers in the cluster or other nodes can send to it provided they qualify the queue name with a node name.
A clusterwide queue can also be either global or non-global. Making it global allows nodes to send to it.