[ 
https://issues.apache.org/jira/browse/ARTEMIS-1773?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Justin Bertram resolved ARTEMIS-1773.
-------------------------------------
    Resolution: Not A Problem

> Trying to send to an existing temp queue fails after a "reconnect"
> ------------------------------------------------------------------
>
>                 Key: ARTEMIS-1773
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-1773
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>    Affects Versions: 2.5.0
>            Reporter: Mario Hochreiter
>            Priority: Major
>
> Following code as reference:
> {code:java}
> import org.apache.activemq.ActiveMQConnectionFactory;
> import javax.jms.Connection;
> import javax.jms.ConnectionFactory;
> import javax.jms.MessageConsumer;
> import javax.jms.MessageProducer;
> import javax.jms.Session;
> import javax.jms.TemporaryQueue;
> import javax.jms.TextMessage;
> public class TemporaryQueueExample {
>     public static void main(final String[] args) throws Exception {
>         Connection consumeConnection = null;
>         Connection produceConnection = null;
>         try {
>             ConnectionFactory cf = new 
> ActiveMQConnectionFactory("tcp://localhost:61616");
>             consumeConnection = cf.createConnection();
>             produceConnection = cf.createConnection();
>             consumeConnection.start();
>             produceConnection.start();
>             Session consumeSession = consumeConnection.createSession(false, 
> Session.AUTO_ACKNOWLEDGE);
>             Session produceSession = produceConnection.createSession(false, 
> Session.AUTO_ACKNOWLEDGE);
>             TemporaryQueue tempQueue = consumeSession.createTemporaryQueue();
>             System.out.println("Temporary queue is created: " + tempQueue);
>             MessageProducer messageProducer = 
> produceSession.createProducer(tempQueue);
>             TextMessage message = produceSession.createTextMessage("This is a 
> text message");
>             messageProducer.send(message);
>             System.out.println("Sent message: " + message.getText());
>             MessageConsumer messageConsumer = 
> consumeSession.createConsumer(tempQueue);
>             message = (TextMessage) messageConsumer.receive(5000);
>             System.out.println("Received message: " + message.getText());
>             // close
>             messageProducer.close();
>             produceSession.close();
>             produceConnection.close();
>             produceConnection = new 
> ActiveMQConnectionFactory("tcp://localhost:61616").createConnection();
>             produceSession = produceConnection.createSession(false, 
> Session.AUTO_ACKNOWLEDGE);
>             messageProducer = produceSession.createProducer(tempQueue);
>             TextMessage message2 = produceSession.createTextMessage("This is 
> anoter text message");
>             messageProducer.send(message2);
>             System.out.println("Sent message: " + message2.getText());
>             message = (TextMessage) messageConsumer.receive(5000);
>             System.out.println("Received message: " + message.getText());
>         } finally {
>             if (produceConnection != null) {
>                 produceConnection.close();
>             }
>             if (consumeConnection != null) {
>                 consumeConnection.close();
>             }
>         }
>     }
> }
> {code}
> Above code fails randomly (not always) when trying to send a message to the 
> temp queue created by the "consumeSession". It fails either on the first
> {code:java}
> messageProduer.send(message);
> {code}
> or on the second 
> {code:java}
> messageProduer.send(message2);
> {code}
> The exception is:
> {code:java}
> javax.jms.InvalidDestinationException: Cannot publish to a deleted 
> Destination: temp-queue://ID:XXXX
> {code}
> It only failed with the following combination of server/client libs:
> * Artemis Server 2.3.0 or 2.5.0 and activemq-client library 5.15.3 or 5.14.5
>  
> When using ActiveMQ as a JMS server all worked fine. Also when using 
> {{org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory}} together 
> with Artemis Server 2.5.0 all worked fine.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to