Praveen created ARTEMIS-2719:
--------------------------------

             Summary: Closing TopicConnection is removing the Topic
                 Key: ARTEMIS-2719
                 URL: https://issues.apache.org/jira/browse/ARTEMIS-2719
             Project: ActiveMQ Artemis
          Issue Type: Bug
    Affects Versions: 2.8.1
            Reporter: Praveen


Short Summary:  In Wildlfy17 which has ActiveMQ artemis 2.8.1, when I connect 
to the topic and disconnect, it is removing the Topic.

 

Details:

 

standalone.xml has the below configuration;

<subsystem xmlns="urn:jboss:domain:messaging-activemq:7.0">
 <server name="default">
 <journal type="ASYNCIO" file-size="102400" min-files="2"/>
 <shared-store-master/>
 <security-setting name="#">
 <role name="User" send="true" consume="true" create-non-durable-queue="true" 
delete-non-durable-queue="true"/>
 </security-setting>
 <address-setting name="#" dead-letter-address="jms.queue.DLQ" 
expiry-address="jms.queue.ExpiryQueue" redelivery-delay="0" 
max-size-bytes="10485760" page-size-bytes="5485760" address-full-policy="PAGE" 
message-counter-history-day-limit="10" redistribution-delay="0"/>
 <remote-connector name="netty" socket-binding="messaging"/>
 <remote-connector name="netty-throughput" 
socket-binding="messaging-throughput">
 <param name="batch-delay" value="50"/>
 </remote-connector>
 <in-vm-connector name="in-vm" server-id="0"/>
 <remote-acceptor name="netty" socket-binding="messaging"/>
 <remote-acceptor name="netty-throughput" socket-binding="messaging-throughput">
 <param name="batch-delay" value="50"/>
 <param name="direct-deliver" value="false"/>
 </remote-acceptor>
 <in-vm-acceptor name="in-vm" server-id="0"/>
 <jms-topic name="LCSTopic" entries="LCSTopic topic/LCSTopic 
java:jboss/exported/jms/topic/LCSTopic"/>
 <connection-factory name="InVmConnectionFactory" 
entries="java:/ConnectionFactory" connectors="in-vm"/>
 <connection-factory name="RemoteConnectionFactory" 
entries="java:jboss/exported/jms/RemoteConnectionFactory" connectors="netty" 
ha="true" client-failure-check-period="10" retry-interval="1000" 
reconnect-attempts="10" failover-on-initial-connection="true" 
use-global-pools="false" thread-pool-max-size="100"/>
 <pooled-connection-factory name="activemq" entries="java:/JmsXA" 
connectors="in-vm" block-on-non-durable-send="false" 
block-on-durable-send="false" transaction="xa" min-pool-size="2" 
use-auto-recovery="false" max-pool-size="100"/>
 </server>
 </subsystem>

 

 

The program that is deleting the Topic:

 

public class JMSTest {    Logger log = Logger.getLogger(JMSTest.class); private 
TopicConnection mTopicConnection;
 public static void main(String[] args) \{ JMSTest test = new JMSTest(); if 
(args.length == 1) { try { test.doTest(args[0]); } catch (Exception e) \{ 
e.printStackTrace(); } } else \{ System.out.println("JMSTest FQDN:port"); 
System.out.println("    test out JMS queue persistance on given EDMServer"); 
System.err.println("    Plese provide a FSDN:port of the EDMServer"); } }
 private void doTest(String hostName) throws Exception { log.debug("Starting 
doTest, get new LoginData");
 Connector connector = null; try {             Login login = new Login(); 
log.debug("--> start Login.doBatchLogin");            connector = 
login.doBatchLogin(org.apache.log4j.Logger.getLogger(JMSTest.class), "admin", 
"admin".toCharArray(), hostName,                    "JMSTest", 
(SessionEndedHandler)null);
 initNotificationListener("Client_"+(new Random().nextInt())); 
removeNotificationConsumer(); } catch (Exception e) \{ log.error("Could not 
authenticate: Exception: " + e.getClass().getName() + ", " + e.getMessage()); } 
finally \{ connector.logout(); } }
 private void initNotificationListener(String clientId) throws Exception {
 try { Connector connector = Connector.getInstance(); mTopicConnection = 
connector.createTopicConnection(); mTopicConnection.setExceptionListener(new 
JMSExceptionListener()); TopicSession topicSession = 
mTopicConnection.createTopicSession(false, QueueSession.AUTO_ACKNOWLEDGE); 
mTopicConnection.start();
 Topic lcsTopic = connector.createTopic("LCSTopic"); 
topicSession.createConsumer(lcsTopic, "JMSCorrelationID = '" + clientId + "'"); 
} catch (Exception e) \{ System.err.println("Internal error: " + 
e.getMessage()); e.printStackTrace(); try { if (mTopicConnection != null) { 
mTopicConnection.close(); } } catch (JMSException e1) \{ 
System.err.println("Topic close error: "+ e1.getMessage()); 
e.printStackTrace(); }
 throw new Exception(e.getMessage(), e); } }
 public void removeNotificationConsumer() {
 if (mTopicConnection != null) {
 try \{ mTopicConnection.close(); mTopicConnection = null; } catch 
(JMSException e) \{ System.err.println("Internal error: " + e.getMessage()); 
e.printStackTrace(); } }
 }    public class JMSExceptionListener implements ExceptionListener {
        @Override        public void onException(JMSException e) \{            
System.err.println("Internal error: " + e.getMessage());            
e.printStackTrace();        }    } }



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to