else {
throw new IllegalArgumentException("Created JMS Connection is not an EnhancedConnection: " + value);
}
}
connection.start();
DestinationSource source = connection.getDestinationSource();
source.setDestinationListener(new DestinationListener() {
public void onDestinationEvent(DestinationEvent event) {
try {
ActiveMQDestination destination = event.getDestination();
if (destination instanceof ActiveMQQueue) {
ActiveMQQueue queue = (ActiveMQQueue) destination;
if (event.isAddOperation()) {
addQueue(queue);
}
else {
removeQueue(queue);
}
}
}
catch (Exception e) {
LOG.warn("Caught: " + e, e);
}
}
});
Set<ActiveMQQueue> queues = source.getQueues();
for (ActiveMQQueue queue : queues) {
addQueue(queue);
}
}