Hello community,

we encountered a problem with temporary Queues when using Openwire with 
Artemis.

Situation:
We want to use an Artemis broker with Applications communicating over 
Openwire with JMS.
Specifically, we want to perform request reply using the reply-to field 
and temporary queues.
For the broker we have an Artemis broker (Version 2.37).
The clients use the ActiveMQ classic client libraries.
For the reply we create a temporary queue with: 
org.apache.activemq.ActiveMQSession.createTemporaryQueue()

First scenario: Temp queues working in same JVM:
We have a unit test where we send the request on a queue ("request-queue") 
on the broker and create the temporary queue beforehand as described, to 
receive the reply.
In the Unit test we also subscribe to that "request-queue" and if a 
message is received we send a reply to the temporary queue (specified in 
the JMS-reply-to field).
That works as we would expect and the reply is received on the temporary 
queue.

Second scenario: Temp queues not working in different JVMs:
Now for the part where we encounter the error.
We set up the same scenario as in one, but not in a unit test but with two 
different applications.
So one application with the activeMQ classic libraries that sets a 
temporary queue, set the JMS-reply-to to that queue and send the message 
to a queue ("request-queue") on the broker.
The second application subscribes to that "request-queue" and receives the 
message.
We extract the temporary reply queue with Destination replyDestination = 
msg.getJMSReplyTo();
But when we want to send the message we encounter the following error:

javax.jms.InvalidDestinationException: Cannot publish to a deleted 
Destination: temp-queue://ID:NTNB794-64640-1739355767427-5:1:1
        at 
org.apache.activemq.ActiveMQSession.send(ActiveMQSession.java:1841)
        at 
org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:289)
        at 
org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:224)
        at 
de.systemagmbh.components.bus.activemq.CSysAMQServiceRunnerCallback.sendReply(CSysAMQServiceRunnerCallback.java)
        at 
de.systemagmbh.tools.bus.CSysServiceRunner.run(CSysServiceRunner.java)
        at 
de.systemagmbh.tools.bus.ASysServiceRunnerCallback.startServiceRunner(ASysServiceRunnerCallback.java)
        at 
de.systemagmbh.components.bus.activemq.CSysAMQServiceRunnerCallback.<init>(CSysAMQServiceRunnerCallback.java)
        at 
de.systemagmbh.components.bus.activemq.CSysAMQServiceSubjectDriver.onMessage(CSysAMQServiceSubjectDriver.java)
        at 
org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:1390)
        at 
org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:131)
        at 
org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:202)
        at 
org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:133)
        at 
org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:48)
        at 
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
        at 
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
        at java.base/java.lang.Thread.run(Thread.java:1583)

Have any of you encountered something similar or knows if we do something 
wrong?

Kind regards Maximilian

Reply via email to