1
votes

is it possible to embed a JMS HornetQ server on a Java application using configuration files not located on the classpath?

The EmbeddedHornetQ class have a method called setConfigResourcePath which receives a string representing a classpath resource like it's described on it's javadoc:

/**
    * Classpath resource for hornetq server config.  Defaults to 'hornetq-configuration.xml'.
    *
    * @param filename
    */
   public void setConfigResourcePath(String filename)
   {
      configResourcePath = filename;
   }

Is it possible to embed it using some other external folder to get these configuration files?

1

1 Answers

0
votes

Sure in My book "HornetQ messaging developers' guide" I gave a full working example.

http://www.packtpub.com/hornetq-messaging-developers-guide/book

Basically you need to create a JMSCOnfiguration object define the queues and the properties and then using a code like

EmbeddedJMS jmsServer = new EmbeddedJMS();
jmsServer.setConfiguration(configuration);
jmsServer.setJmsConfiguration(jmsConfig);
jmsServer.start();

Piero Giacomelli