brokerService1.setBrokerName("one");
brokerService1.setUseJmx(false);
brokerService1
.setPersistenceAdapter(new MemoryPersistenceAdapter());
brokerService1.addConnector("nio://0.0.0.0:61616");
final NetworkConnector network1 = brokerService1
.addNetworkConnector("static:(tcp://localhost:51515)");
network1.setName("network1");
network1.setDynamicOnly(true);
network1.setNetworkTTL(3);
network1.setPrefetchSize(networkBridgePrefetch);
network1.setConduitSubscriptions(false);
network1.setDecreaseNetworkConsumerPriority(false);
network1.setDispatchAsync(false);
brokerService1.start();
}
{
brokerService2 = new BrokerService();
brokerService2.setBrokerName("two");
brokerService2.setUseJmx(false);
brokerService2
.setPersistenceAdapter(new MemoryPersistenceAdapter());
brokerService2.addConnector("nio://0.0.0.0:51515");
final NetworkConnector network2 = brokerService2
.addNetworkConnector("static:(tcp://localhost:61616)");
network2.setName("network1");
network2.setDynamicOnly(true);
network2.setNetworkTTL(3);
network2.setPrefetchSize(networkBridgePrefetch);
network2.setConduitSubscriptions(false);
network2.setDecreaseNetworkConsumerPriority(false);
network2.setDispatchAsync(false);
brokerService2.start();
}
final ExecutorService pool = Executors.newSingleThreadExecutor();
final ActiveMQConnectionFactory connectionFactory1 = new ActiveMQConnectionFactory(
"vm://one");