}
}
public void createListener(String aDelegateKey, Endpoint endpointToUpdate) throws Exception {
if (getController() instanceof AggregateAnalysisEngineController) {
Delegate delegate = ((AggregateAnalysisEngineController) getController())
.lookupDelegate(aDelegateKey);
if (delegate != null) {
UimaDefaultMessageListenerContainer newListener = new UimaDefaultMessageListenerContainer();
testIfBrokerRunning(delegate.getEndpoint().getServerURI());
ActiveMQConnectionFactory f = new ActiveMQConnectionFactory(delegate.getEndpoint().getServerURI());
newListener.setConnectionFactory(f);
newListener.setMessageListener(this);
newListener.setController(getController());
TempDestinationResolver resolver = new TempDestinationResolver();
resolver.setConnectionFactory(f);
resolver.setListener(newListener);
newListener.setDestinationResolver(resolver);
newListener.setAcceptMessagesWhileStopping(true);
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor executor = new org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor();
executor.setCorePoolSize(delegate.getEndpoint().getConcurrentReplyConsumers());
executor.setMaxPoolSize(delegate.getEndpoint().getConcurrentReplyConsumers());
executor.setQueueCapacity(delegate.getEndpoint().getConcurrentReplyConsumers());
executor.initialize();
newListener.setConcurrentConsumers(delegate.getEndpoint().getConcurrentReplyConsumers());
newListener.setTaskExecutor(executor);
newListener.initialize();
newListener.start();
// Wait until the resolver plugs in the destination
while (newListener.getDestination() == null) {