protected MessageConsumer createMessageConsumer(Session session, Destination destination) throws JMSException{
return session.createConsumer(destination);
}
protected ActiveMQConnectionFactory createGenericClusterFactory(String brokerName) throws JMSException {
BrokerContainer container = new BrokerContainerImpl(brokerName);
ZeroconfDiscoveryAgent agent = new ZeroconfDiscoveryAgent();
agent.setType(getClass().getName() + ".");
container.setDiscoveryAgent(agent);
String url = "tcp://localhost:0";
container.addConnector(url);
container.addNetworkConnector(new DiscoveryNetworkConnector(container));
container.start();
//embedded brokers are resolved by url - so make url unique
//this confused me tests for a while :-)
return new ActiveMQConnectionFactory(container,"vm://"+brokerName);
}