in uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/UimaDefaultMessageListenerContainer.java [372:465]
private void handleTempQueueFailure(Throwable t) {
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) {
if ( controller != null ) {
UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, CLASS_NAME.getName(),
"handleTempQueueFailure", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
"UIMAEE_service_exception_WARNING", controller.getComponentName());
}
UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, this.getClass().getName(),
"handleTempQueueFailure", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
"UIMAJMS_jms_listener_failed_WARNING",
new Object[] { getDestination(), getBrokerUrl(), t });
}
// Check if the failure is due to the failed connection. Spring (and ActiveMQ) dont seem to
// provide
// the cause. Just the top level IllegalStateException with a text message. This is what we need
// to
// check for.
ActiveMQConnection conn = null;
try {
conn = (ActiveMQConnection)getSharedConnection();
} catch( Exception exx ) { // shared connection may not exist yet if a broker is not up
}
if (t instanceof InvalidDestinationException ) {
destroy();
if ( getMessageListener() instanceof JmsInputChannel ) {
try {
// ((JmsInputChannel)getMessageListener()).createListenerOnTempQueue(getConnectionFactory());
} catch( Exception e) {
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) {
UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, CLASS_NAME.getName(),
"handleTempQueueFailure", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
"UIMAJMS_exception__WARNING", e);
}
}
}
return;
}
if ( (conn != null && conn.isTransportFailed() ) ||
t instanceof javax.jms.IllegalStateException
&& t.getMessage().equals("The Consumer is closed")) {
if (controller != null && controller instanceof AggregateAnalysisEngineController) {
// If endpoint not set, this is a temp reply queue listener.
if ( endpoint == null ) {
destroy();
return;
}
String delegateKey = ((AggregateAnalysisEngineController) controller)
.lookUpDelegateKey(endpoint.getEndpoint());
try {
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
UIMAFramework.getLogger(CLASS_NAME).logrb(
Level.INFO,
this.getClass().getName(),
"handleTempQueueFailure",
JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
"UIMAJMS_stopping_listener_INFO",
new Object[] { controller.getComponentName(), endpoint.getDestination(),
delegateKey });
}
// Stop current listener
handleListenerFailure();
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
if ( controller != null ) {
UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, this.getClass().getName(),
"handleTempQueueFailure", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
"UIMAJMS_stopped_listener_INFO",
new Object[] { controller.getComponentName(), endpoint.getDestination() });
}
}
} catch (Exception e) {
if ( controller != null ) {
UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, CLASS_NAME.getName(),
"handleTempQueueFailure", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
"UIMAEE_service_exception_WARNING", controller.getComponentName());
}
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) {
UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, CLASS_NAME.getName(),
"handleTempQueueFailure", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
"UIMAJMS_exception__WARNING", e);
}
}
}
} else if (disableListener(t)) {
handleQueueFailure(t);
} else {
}
}