private ActiveMQConnectionFactory createActiveMqConnectionFactory() throws Exception {
ActiveMQConnectionFactory activeMqConnectionFactory = new ActiveMQConnectionFactory(
"failover:" + service.getTransportConnectors().get(0).getConnectUri().toString());
activeMqConnectionFactory.setWatchTopicAdvisories(false);
ActiveMQPrefetchPolicy prefetchPolicy = new ActiveMQPrefetchPolicy();
prefetchPolicy.setDurableTopicPrefetch(2);
prefetchPolicy.setOptimizeDurableTopicPrefetch(2);
activeMqConnectionFactory.setPrefetchPolicy(prefetchPolicy);
activeMqConnectionFactory.setClientID(CLIENT_ID);
return activeMqConnectionFactory;
}