Tomcat web app with ActiveMQ broker over TCP -


i trying set activemq broker within context of web app hosted in tomcat. additionally, connector want use tcp broker should accessible remote applications.

so far, have done create simple web app local jndi context.xml configuration following:

<resource auth="container"     name="jms/connectionfactory"     type="org.apache.activemq.activemqconnectionfactory"     description="jmsconnection"     factory="org.apache.activemq.jndi.jndireferencefactory"     brokerurl="tcp://localhost:61616"     brokername="mqbroker"/>  <resource auth="container"     name="jms/mqueue"     type="org.apache.activemq.command.activemqqueue"     description="jms queue"     factory="org.apache.activemq.jndi.jndireferencefactory"     physicalname="some.queue"/> 

i have updated web.xml file accordingly , called connection factory servletcontextlistener implementing class follows:

initialcontext context = new initialcontext(); context cntx = (context) context.lookup("java:comp/env"); activemqconnectionfactory factory = (activemqconnectionfactory) cntx.lookup("jms/connectionfactory"); factory.createqueueconnection(); 

when deploying app, exception:

could not connect broker url: tcp://localhost:61616. reason: java.net.connectexception: connection refused

i think because there no configuration broker itself, in online examples see files spring configuration attached brokerurl attribute of resource. issue project environment strictly defined, cannot use spring provide configuration. have seen solutions camel, out of question.

so sum up, questions are:

  1. is possible set activemq broker local web app, can accessed on network remote applications?
  2. is explicit configuration needed broker?
  3. if yes, can done without using spring broker configuration, rather properties file or similar not add dependencies project?

you can have activemq broker embedded in application or stand alone java program. not need spring broker configuration.

http://activemq.apache.org/how-do-i-embed-a-broker-inside-a-connection.html


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -