Hello,
I am using activemq as a dependency in a web app. My web app is deployed
to a jetty server which is run through maven by issuing "mvn jetty:run".
Of course, one part of the web app is to create and start a broker. I am
doing this through ActiveMQConnectionFactory (as described at the last
part of
http://activemq.apache.org/how-do-i-embed-a-broker-inside-a-connection.html,
titled "Using ActiveMQConnectionFactory"):
String brokerURI = "vm://testBroker?broker.persistent=false";
ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory(brokerURI);
Connection connection = cf.createConnection();
connection.start();
Now, since I am running my web web app through maven, and activemq is
used as a library (not as a standalone app), I don't have an
activemq.xml configuration file. So, I don't know where to
activate/enable StatisticsBrokerPlugin as described at
http://activemq.apache.org/statisticsplugin.html:
<broker ...>
<plugins>
statisticsBrokerPlugin/>
</plugins>
</broker>
Also, since I am using ActiveMQConnectionFactory to create and start the
broker, I can't take advantage of setting the plugin through BrokerService:
BrokerPlugin plugin = new StatisticsBrokerPlugin();
BrokerPlugin[] plugins = {plugin};
BrokerService broker = new BrokerService();
try {
broker.addConnector(brokerURI);
broker.setPlugins(plugins);
broker.start();
} catch (Exception e) {
e.printStackTrace();
}
Now, my questions are:
1. How will I be able to set the StatisticsBrokerPlugin with the above
scenario?
2. Is there a way to get a reference to the broker to be able to set the
plugin?
3. Is there a way to add and use activemq.xml if it is used as a library
and run through maven? Set in pom.xml?
Please help. I really need this to work.
Thanks in advance.
-don