Thank you for this instruction - i wanted to clear a couple of things up if that is ok.
I have question mainly on ActiveMQBroker.java class. Is this a standalone class? does it inherite from any class? Do i need to follow a specific interface? Do you have a complete example that you can share? Let's say that I am getting a SOAP request, and I want to simply forward that, how does I specify the topic? There seems to be 2 topics that you mention here, but how do i choose from one of these two or maybe many others that I may want to publish to? for example: I get 10 SOAP requests, message1 goes to topic1, message2 to topic2, etc... Where can i embed this logic? Thanks Art Suchitha Koneru (sukoneru) wrote: > > In our application , there are two web apps and the inter web app > communication is via the active mq broker. Out application uses active > mq 4.1.1 , java 1.6 and Tomcat5.5.20 > > 1) The jndi resources for active mq can be specified in > Tomcat/conf/context.xml > > <!-- active mq connection factory --> > <Resource > name="jms/ConnectionFactory" > auth="Container" > type="org.apache.activemq.ActiveMQConnectionFactory" > description="JMS Connection Factory" > factory="org.apache.activemq.jndi.JNDIReferenceFactory" > > > brokerURL="tcp://ipaddress:61616?trace=true&wireFormat.maxInactivityDura > tion=-1" > /> > > > the flag wireFormat.maxInactivityDuration should be set to -1 because > , if there is no activity (exchange os messages via the broker for some > period of Time) , the broker automatically closes down the connection. > > > > <!-- topics --> > > > <Resource name="jms/TopicOne" > auth="Container" > type="org.apache.activemq.command.ActiveMQTopic" > description="the topic against which the client back > end will publish and server back end would subscribe" > > factory="org.apache.activemq.jndi.JNDIReferenceFactory" > physicalName="FOO1.BAR"/> > > > <Resource name="jms/TopicTwo" > auth="Container" > type="org.apache.activemq.command.ActiveMQTopic" > description="the topic against which the server back > end will publish and client back end would subscribe" > > factory="org.apache.activemq.jndi.JNDIReferenceFactory" > physicalName="FOO2.BAR"/> > > 2) I have used broker configuration URI for the broker. The alternative > approache is using an activemq.xml file . If you use active.xml file , > the broker url would be > brokerURL="tcp://localhost?brokerConfig=xbean:file:../../activemq.xml , > provide the relative path to the activemq.xml file , starting from the > bin directory of Tomcat. I am assuming that you are using "startup.bat" > present in the bin directory to start the tomcat server. > > > The pseudo code for starting the broker is > > BrokerService broker = new BrokerService(); > // the connector should have the same contents as the broker url > > broker.addConnector("tcp://ipaddress:61616?trace=true&wireFormat.maxInac > tivityDuration=-1"); > > broker.start(); > > 3) You can place the code for starting the broker in a singleton class . > The Constructor of the singleTonClass should create the broker. There > should also be a synchronized method for shutting down the broker. > For reference let us call this class as ActiveMQBroker.java .Place this > class under shared/classes folder and also place , the active mq jars > in shared/lib; > > When your web app needs to communicate with the broker, it will Create > an instance of single Ton class ActiveMQBroker . The pseudo code to be > placed in web apps to connect to the broker is > > > SingleTonClass.getInstance(); > Ictx = new javax.naming.InitialContext(); > envContext = (Context) > Ictx.lookup("java:comp/env"); > TopicConnectionFactory topicfactory > =(TopicConnectionFactory) conContext.lookup("jms/ConnectionFactory"); > > TopicConnection tConnection = topicfactory.createTopicConnection(); > > // create session > > ActiveMQSession topicSession = (ActiveMQSession ) > HConn.createSession(false, Session.AUTO_ACKNOWLEDGE); > > // create Topic > Topic topic = (Topic)envContext.lookup(jms/TopicTwo); > > > // create either a publisher or subscriber > > topicSession.createSubscriber(topic); > > //In case of the subscriber , please implement the MessageListner > Interface () > > > 4) You can also connect to the broker without using jndi resources. > > > Also these urls would be useful. > http://activemq.apache.org/how-do-i-embed-a-broker-inside-a-connection.h > tml > > http://activemq.apache.org/broker-configuration-uri.html > > http://fabien.carrion.free.fr/tomcat/jndi-jms-examples-howto.xml > > http://activemq.apache.org/setting-up-activemq-with-tomcat-559.html > > Thanks, > Suchitha. > > > > > > > > > > > > > > > > > > > > > > > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Wednesday, August 01, 2007 2:08 AM > To: Suchitha Koneru (sukoneru) > Subject: Need help regarding ActiveMQ with Tomcat > > Hi, > > Hope you are doing fine. Let me introduce myself first I am Shubhendu > Kumar Paul working on Java Platfrom. In my current project I am using > ActiveMQ, and able to run a simple console based application but when I > tried to implement the same at Tomcat 5.5, I am unable to configure it. > At ActiveMQ forum I saw your message, if you don't have any problem, > could you please tell me every configuration step by step or suggest me > from where I can found any sample web based active mq application? Or if > you have a small web based ActiveMQ Hello World! kind of application > could you please send it to me? > > Thanks in Advance. > > Regards, > Shubhendu Kumar Paul > e-mail: [EMAIL PROTECTED] > > -- View this message in context: http://www.nabble.com/RE%3A-Need-help-regarding-ActiveMQ-with-Tomcat-tf4203615s2354.html#a12365971 Sent from the ActiveMQ - User mailing list archive at Nabble.com.