activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tejas13 <tejas.sawa...@tcs.com>
Subject Re: Active Durable Subscriber status automatically changing to offline Durable Subscriber [5.14.1 Most Stable Version]
Date Wed, 12 Jul 2017 07:02:28 GMT
Yes JMX Still shown connection is open. I am not getting any exception for 
same. Previously I was receiving exception for same, So that time 
connection automatically get reestablished. 

Thanks & Regards,
Tejas Ramchandra Sawant
Tata Consultancy Services Ltd.
QBPL, Phase-2, Hinjewadi
Pune, Maharashtra.
cell : +91-8055946458
Mailto: tejas.sawant3@tcs.com
Website:http://www.tcs.com

____________________________________________
Experience certainty.        IT Services
                       Business Solutions
                       Consulting
____________________________________________ 



From:   "Tim Bain [via ActiveMQ]" <ml+s2283324n4728484h55@n4.nabble.com>
To:     tejas13 <tejas.sawant3@tcs.com>
Date:   07/12/2017 12:34 PM
Subject:        Re: Active Durable Subscriber status automatically 
changing to offline Durable Subscriber [5.14.1 Most Stable Version]



When your subscriber shows as being offline, does JMX still show that the 
connection is open? Or are you indeed closing the connection? 

Tim 

On Jul 12, 2017 12:39 AM, "tejas13" <[hidden email]> wrote: 

> 
> Hi All, 
> 
> Thank in Advance. 
> 
> Previously we were using version 5.12.0. That time my code was working 
> fine. 
> Subscriber never get offline automatically. 
> 
> Recently we upgraded to version 5.14.5 as most stable version and new 
> features 
> 
> I found that my Active Durable Subscriber status is changing 
automatically 
> to offline Durable Subscriber. 
> 
> I am using below code for connection. 
> 
> public class ReceiverFor_ECRE_TO_SEQ_Topic { 
>         private static final Logger logger = 
> Logger.getLogger(ReceiverFor_ECRE_TO_SEQ_Topic.class); 
> 
>         private TopicSession qsen = null; 
>         private String JNDI_PROVIDER_URL = null; 
>         private String topicName = null; 
>         private String jmsUid = null; 
>         private String jmsPwd = null; 
>         private Topic topic = null; 
>         private ConnectionFactory connFactory; 
>         private TopicConnection queueConn; 
> 
>         public ReceiverFor_ECRE_TO_SEQ_Topic(String topicName, String 
> JNDI_PROVIDER_URL, String jmsUid, String jmsPwd) { 
>                 this.topicName = topicName; 
>                 this.JNDI_PROVIDER_URL = JNDI_PROVIDER_URL; 
>                 this.jmsUid = jmsUid; 
>                 this.jmsPwd = jmsPwd; 
>         } 
> 
>         public void listenTopic() { 
>                 try { 
>                         Properties env = new Properties(); 
>                         env.put(Context.INITIAL_CONTEXT_FACTORY, 
> Constants.INITIAL_CONTEXT_FACTORY); 
>                         env.put(Context.PROVIDER_URL, 
> System.getProperty(Context.PROVIDER_URL, 
> JNDI_PROVIDER_URL)); 
>                         env.put(Context.SECURITY_PRINCIPAL, jmsUid); 
>                         env.put(Context.SECURITY_CREDENTIALS, jmsPwd); 
> env.setProperty("prefetchPolicy.durableTopicPrefetch", 
> "1000"); 
>                         InitialContext inictx = new InitialContext(env); 

> 
>                         // lookup the queue object 
>                         topic = (Topic) inictx.lookup(topicName); 
>                         // lookup the topic connection factory 
>                         connFactory = (ConnectionFactory) 
> inictx.lookup(Constants.CONN_FACTORY); 
> 
>                         // System.out.println("1"); 
>                         if (setupJMS()) { 
> 
>                                 isJMSConnected = true; 
>                                 /* 
>                                  * while(true) { } 
>                                  */ 
>                         } else { 
> 
>                                 listenTopic(); 
> 
>                         } 
>                 } catch (NamingException ex) { 
>                         // ex.printStackTrace(); 
>                         logger.error("Unable to connect Server for ECRE 
> Topic"); 
> 
>                         try { 
>                                 Thread.sleep(5000); 
>                                 listenTopic(); 
>                         } catch (InterruptedException ex1) { 
>                                 // ex.printStackTrace(); 
>                                 logger.error("Unable to connect  Server 
> for ECRE Topic"); 
>                         } 
>                 } 
>         } 
> 
>         public boolean setupJMS() 
>         { 
>                 try { 
> 
>                         // create a queue connection 
>                         String consumerName = 
> ResourceBundleHelper.applicationData.get(ApplicationConstants.ECRE_TO_ 
> SEQ_TOPIC_CONSUMER_Id); 
> 
>                         queueConn = (TopicConnection) 
> connFactory.createConnection(); 
>                         queueConn.setClientID(consumerName); 
> 
>                         // create a queue session 
>                         // if (null == this.qsen) 
>                         { 
>                                 this.qsen = 
queueConn.createTopicSession( 
> false, 
> Session.CLIENT_ACKNOWLEDGE); 
>                         } 
>                         this.queueConn.setExceptionListener(new 
> ConnectionExceptionListner()); 
>                         MessageListenerFor_ECRE_TO_SEQ_Topic temp = new 
> MessageListenerFor_ECRE_TO_SEQ_Topic(); 
>                         // create a queue subscriber 
> 
>                         // MessageConsumer queueReceiver = 
> qsen.createConsumer(topic); 
>                         MessageConsumer queueReceiver = 
> qsen.createDurableSubscriber(topic, 
>                                         consumerName); 
> 
>                         queueReceiver.setMessageListener(temp); 
>                         queueConn.start(); 
>                 } catch (Exception e) 
>                 { 
>                         logger.error(" ReceiverFor_ECRE_TO_SEQ_Topic 
Setup 
> JMS Exception -" + 
> e.getMessage()); 
> 
>                         //System.gc(); 
>                         try 
>                         { 
>                                 Thread.sleep(60000); 
>                         } 
>                         catch(Exception er) 
>                         { 
>                                 logger.error("Exception occured in 
> Thread.sleep"); 
>                         } 
>                         return false; 
>                 } 
>                 return true; 
>         } 
> 
>         private volatile boolean isJMSConnected = false; 
> 
>         private class ConnectionExceptionListner implements 
> ExceptionListener { 
>                 @Override 
>                 public void onException(JMSException exception) { 
>                         isJMSConnected = false; 
> 
>                         while (true) { 
>                                 cleanUp(); 
>                                 isJMSConnected = setupJMS(); 
> 
>                                 if (isJMSConnected) 
>                                 { 
>                                                 return; 
>                                 } else { 
> 
>                                         try { 
>                                                 //System.gc(); 
> 
>                                                 Thread.sleep(2*60*1000); 

>                                         } catch (Exception e) { 
>                                                 System.out.println(" 
> "+e.getMessage()); 
>                                         } 
>                                 } 
>                         } 
>                 } 
>         } 
> 
>         private void cleanUp() { 
>                 try { 
>                         this.queueConn.setExceptionListener(null); 
>                 } catch (Exception e) { 
>                         // System.out.println("Exception in cleanUP()" + 

> e.getMessage()); 
>                         logger.error(" ReceiverFor_ECRE_TO_SEQ_Topic 
> Exception in JMS cleanUP()" 
> + e.getMessage()); 
> 
>                 } 
>                 try { 
>                         this.queueConn.close(); 
>                 } catch (Exception e) { 
>                         // System.out.println("Exception in connection 
> close()" + 
>                         // e.getMessage()); 
>                         logger.error(" ReceiverFor_ECRE_TO_SEQ_Topic 
> Exception in JMS connection 
> close()" + e.getMessage()); 
> 
>                 } 
>         } 
> 
> } 
> 
> 
> 
> 
> -- 
> View this message in context: http://activemq.2283324.n4. 
> nabble.com/Active-Durable-Subscriber-status-automatically-changing-to- 
> offline-Durable-Subscriber-5-14-1-Most-St-tp4728482.html 
> Sent from the ActiveMQ - User mailing list archive at Nabble.com. 
> 



If you reply to this email, your message will be added to the discussion 
below:
http://activemq.2283324.n4.nabble.com/Active-Durable-Subscriber-status-automatically-changing-to-offline-Durable-Subscriber-5-14-1-Most-St-tp4728482p4728484.html


To unsubscribe from Active Durable Subscriber status automatically 
changing to offline Durable Subscriber [5.14.1 Most Stable Version], click 
here.
NAML 
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you






--
View this message in context: http://activemq.2283324.n4.nabble.com/Active-Durable-Subscriber-status-automatically-changing-to-offline-Durable-Subscriber-5-14-1-Most-St-tp4728482p4728485.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message