// URI failoverURI = new
// URI("failover://"+remoteConnector.getServer().getConnectURI());
URI failoverURI = new URI("failover://tcp://localhost:61616");
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(failoverURI);
ActiveMQPrefetchPolicy prefetchPolicy = new ActiveMQPrefetchPolicy();
// Prefetch size must be less than messages in the queue!!
prefetchPolicy.setQueuePrefetch(MSG_COUNT - 10);
factory.setPrefetchPolicy(prefetchPolicy);
Connection connection = factory.createConnection();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer producer = session.createProducer(new ActiveMQQueue("Test"));
for (int idx = 0; idx < MSG_COUNT; ++idx) {