protected ActiveMQConnectionFactory createConnectionFactory() throws Exception {
// START SNIPPET: bean
// configure the connection factory using
// normal Java Bean property methods
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
connectionFactory.setUseEmbeddedBroker(true);
// configure the embedded broker using an XML config file
// which is either a URL or a resource on the classpath
connectionFactory.setBrokerXmlConfig("file:src/sample-conf/bdb-example.xml");
// you only need to configure the broker URL if you wish to change the
// default connection mechanism, which in this test case we do
connectionFactory.setBrokerURL("vm://localhost");
// END SNIPPET: bean
return connectionFactory;
}