@Override @Nullable public Topic getTopic() throws JMSException { return (this.target instanceof TopicSubscriber ? ((TopicSubscriber) this.target).getTopic() : null); }
@Override public Topic getTopic() throws JMSException { checkTopicSubscriber(); return ((TopicSubscriber) delegate).getTopic(); }
public Topic getTopic() throws JMSException { return consumer.getTopic(); }
public Topic getTopic() throws JMSException { return (this.target instanceof TopicSubscriber ? ((TopicSubscriber) this.target).getTopic() : null); }
public Topic getTopic() throws JMSException { return ((TopicSubscriber) consumer).getTopic(); } }
@Override public Topic getTopic() throws JMSException { return (this.target instanceof TopicSubscriber ? ((TopicSubscriber) this.target).getTopic() : null); }
@Override @Nullable public Topic getTopic() throws JMSException { return (this.target instanceof TopicSubscriber ? ((TopicSubscriber) this.target).getTopic() : null); }
public Topic getTopic() throws JMSException { checkState(); return ((TopicSubscriber) consumer).getTopic(); } }
public Topic getTopic() throws JMSException { return ((TopicSubscriber) getMessageConsumer()).getTopic(); }
@Override public Topic getTopic() throws JMSException { return ((TopicSubscriber) getMessageConsumer()).getTopic(); }
@Override public Topic getTopic() throws JMSException { return ((TopicSubscriber) getMessageConsumer()).getTopic(); }
/** * Get the topic * @return The topic * @exception JMSException Thrown if an error occurs */ public Topic getTopic() throws JMSException { if (_log.isTraceEnabled()) { _log.trace("getTopic()"); } checkState(); return ((TopicSubscriber)_consumer).getTopic(); } }
public Topic getTopic() throws JMSException { return ((TopicSubscriber) getMessageConsumer()).getTopic(); }
@Override public void run() { log.info("Topic Health Checker is running... "); while (true) { try { subscriber.getTopic(); // health checker runs in every 30s Thread.sleep(30000); } catch (Exception e) { // implies connection is not established // sleep for 5s and retry try { log.info("Health checker failed and will retry to establish a connection after a 5s."); Thread.sleep(5000); break; } catch (InterruptedException ignore) { } } } TopologySubscriber.subscribe(topicName); }
/** * Returns the list of the <code>TopicSubscriber</code> objects * for a specific <code>Topic</code>. * @param topicName the name of the <code>Topic</code> * @return the list of <code>TopicSubscriber</code> objects */ public List getTopicSubscriberList(String topicName) { List resultList = new ArrayList(); for(int ii = 0; ii < topicSubscriberList.size(); ii++) { TopicSubscriber subscriber = (TopicSubscriber)topicSubscriberList.get(ii); try { if(subscriber.getTopic().getTopicName().equals(topicName)) { resultList.add(subscriber); } } catch(JMSException exc) { } } return Collections.unmodifiableList(resultList); }
/** * Returns the list of the <code>TopicSubscriber</code> objects * for a specific <code>Topic</code>. * @param topicName the name of the <code>Topic</code> * @return the list of <code>TopicSubscriber</code> objects */ public List getTopicSubscriberList(String topicName) { List resultList = new ArrayList(); for(int ii = 0; ii < topicSubscriberList.size(); ii++) { TopicSubscriber subscriber = (TopicSubscriber)topicSubscriberList.get(ii); try { if(subscriber.getTopic().getTopicName().equals(topicName)) { resultList.add(subscriber); } } catch(JMSException exc) { } } return Collections.unmodifiableList(resultList); }
/** * Get the topic * * @return The topic * @throws JMSException Thrown if an error occurs */ @Override public Topic getTopic() throws JMSException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getTopic()"); } checkState(); return ((TopicSubscriber) consumer).getTopic(); } }
/** * Get the topic * * @return The topic * @throws JMSException Thrown if an error occurs */ @Override public Topic getTopic() throws JMSException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getTopic()"); } checkState(); return ((TopicSubscriber) consumer).getTopic(); } }
@Test public void testGetTopic() throws Exception { Connection consumerConnection = null; try { consumerConnection = createConnection(); Session consumerSession = consumerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageConsumer topicConsumer = consumerSession.createConsumer(ActiveMQServerTestCase.topic1); Topic t = ((TopicSubscriber) topicConsumer).getTopic(); ProxyAssertSupport.assertEquals(ActiveMQServerTestCase.topic1, t); } finally { if (consumerConnection != null) { consumerConnection.close(); } } }
@Test public void testGetTopicOnClosedConsumer() throws Exception { Connection consumerConnection = null; try { consumerConnection = createConnection(); Session consumerSession = consumerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageConsumer topicConsumer = consumerSession.createConsumer(ActiveMQServerTestCase.topic1); topicConsumer.close(); try { ((TopicSubscriber) topicConsumer).getTopic(); Assert.fail("must throw a JMS IllegalStateException"); } catch (javax.jms.IllegalStateException e) { // OK } } finally { if (consumerConnection != null) { consumerConnection.close(); } } }