activemq-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mario Hochreiter (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ARTEMIS-1773) Trying to send to an existing temp queue fails after a "reconnect"
Date Wed, 23 May 2018 11:11:00 GMT

    [ https://issues.apache.org/jira/browse/ARTEMIS-1773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16487089#comment-16487089
] 

Mario Hochreiter commented on ARTEMIS-1773:
-------------------------------------------

Hi Justin

Thx for your answer. But shouldn't this local list at some point in time contain then the
temp destination? If i try to do the sending of the message in a loop the problem remains
for the entire loop duration. Meaning if the problem existed in the beginning it stays. That
means for me either it is a visibility problem or the temporary destination is not at all
known in the producer session for a reason unknown to me.

> 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)

Mime
View raw message