|
View:
New views
10 Messages
—
Rating Filter:
Alert me
|
|
|
JBoss + ActiveMQ + Camel + NewbieHello forum,
I am a newbie to ActiveMQ and Camel and I have a few questions which I am unable to fathom out myself. Firstly I will explain what I am trying to achieve. I need to create a messaging system over internet protocols. The messages need to be filtered based on content and sent to the appropiate Queue/Topic. I want to use ActiveMQ as my messaging provider and Camel to do the filtering/re-routing etc... All this then needs to sit in JBoss. A client application will connect to the Queues/Topics and download the messages. In time this will also need to send messages back to the server. I have ActiveMQ installed in JBoss 4.2.2.GA and it works fine. How do I get intergrate Camel into it? I understand that this is already included in ActiveMQ but I can't see how to control Camel routing. I created an MBean to sit in JBoss and configure a simple routing based on some example code from the fuse project. I have noticed that this uses CamelContext.start(). I don't want the MBean to do this, I want JBoss to start this up. When this is called I get multiple exception messages, one of which is: Failed to start ActiveMQ JMS Message Broker. Reason: javax.management.InstanceAlreadyExistsException: JBoss has already started ActiveMQ! I never wanted Camel to start it also. Is there a way of attaching Camel to the current ActiveMQ broker? I appologies if this is confusing, like I say I am a newbie and maybe barking up the wrong tree. Best Regards Chris Mitchell |
|
|
Re: JBoss + ActiveMQ + Camel + NewbieHi
Camel is shipped out of the box with ActiveMQ. There should be an active mq configuraiton file that is a spring XML file. In this XML file you just add a camelcontext and then you get Camel started. If not mistaking there might be a Camel sample already in this file. Something like this: http://activemq.apache.org/xml-configuration.html And a bit info on this FAQ http://activemq.apache.org/how-should-i-package-applications-using-camel-and-activemq.html On Tue, Jun 16, 2009 at 5:36 PM, chu_man_fu <cem@...> wrote: > > Hello forum, > > I am a newbie to ActiveMQ and Camel and I have a few questions which I am > unable to fathom out myself. > Firstly I will explain what I am trying to achieve. I need to create a > messaging system over internet protocols. The messages need to be filtered > based on content and sent to the appropiate Queue/Topic. > I want to use ActiveMQ as my messaging provider and Camel to do the > filtering/re-routing etc... All this then needs to sit in JBoss. A client > application will connect to the Queues/Topics and download the messages. In > time this will also need to send messages back to the server. > I have ActiveMQ installed in JBoss 4.2.2.GA and it works fine. > How do I get intergrate Camel into it? I understand that this is already > included in ActiveMQ but I can't see how to control Camel routing. I > created > an MBean to sit in JBoss and configure a simple routing based on some > example code from the fuse project. I have noticed that this uses > CamelContext.start(). I don't want the MBean to do this, I want JBoss to > start this up. When this is called I get multiple exception messages, one > of > which is: > > Failed to start ActiveMQ JMS Message Broker. Reason: > javax.management.InstanceAlreadyExistsException: > > JBoss has already started ActiveMQ! I never wanted Camel to start it also. > > Is there a way of attaching Camel to the current ActiveMQ broker? > > I appologies if this is confusing, like I say I am a newbie and maybe > barking up the wrong tree. > > Best Regards > Chris Mitchell > -- > View this message in context: > http://www.nabble.com/JBoss-%2B-ActiveMQ-%2B-Camel-%2B-Newbie-tp24056976p24056976.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus |
|
|
Re: JBoss + ActiveMQ + Camel + NewbieThanks for the reply.
When looking at the the second link I noticed this: "If you want to include some Java routing rules, then just add your jar to somewhere inside ActiveMQ's lib directory." Where is this lib directory. In my JBoss deploy directory I have a dir called activemq-ra-1.4.rar as explained here http://activemq.apache.org/integrating-apache-activemq-with-jboss.html. This doesn't contain a lib directory or an activemq.xml file. Is it a case of dropping any jars in the activemq-ra-1.4.rar dir or the activemq.xml file to get this to work?
|
|
|
Re: JBoss + ActiveMQ + Camel + NewbieOn Wed, Jun 17, 2009 at 12:25 PM, chu_man_fu <cem@...> wrote:
> > Thanks for the reply. > > When looking at the the second link I noticed this: > "If you want to include some Java routing rules, then just add your jar to > somewhere inside ActiveMQ's lib directory." > Well you could forget about this and use the Spring XML file to do your routing rules. Try to get a simple sample working, eg using a timer to print to a log or something else. > > Where is this lib directory. In my JBoss deploy directory I have a dir > called activemq-ra-1.4.rar as explained here > http://activemq.apache.org/integrating-apache-activemq-with-jboss.html > http://activemq.apache.org/integrating-apache-activemq-with-jboss.html . > This doesn't contain a lib directory or an activemq.xml file. Is it a case > of dropping any jars in the activemq-ra-1.4.rar dir or the activemq.xml > file > to get this to work? > I guess this is more a question to JBoss how to deploy .jar files that Resource Adapters (ra) can see and use. That can be tricky as classloading and classpath in J2EE containers can be a nightmare. > > > Claus Ibsen-2 wrote: > > > > Hi > > Camel is shipped out of the box with ActiveMQ. > > > > There should be an active mq configuraiton file that is a spring XML > file. > > In this XML file you just add a camelcontext and then you get Camel > > started. > > If not mistaking there might be a Camel sample already in this file. > > > > Something like this: > > http://activemq.apache.org/xml-configuration.html > > > > And a bit info on this FAQ > > > http://activemq.apache.org/how-should-i-package-applications-using-camel-and-activemq.html > > > > > > > > On Tue, Jun 16, 2009 at 5:36 PM, chu_man_fu <cem@...> wrote: > > > >> > >> Hello forum, > >> > >> I am a newbie to ActiveMQ and Camel and I have a few questions which I > am > >> unable to fathom out myself. > >> Firstly I will explain what I am trying to achieve. I need to create a > >> messaging system over internet protocols. The messages need to be > >> filtered > >> based on content and sent to the appropiate Queue/Topic. > >> I want to use ActiveMQ as my messaging provider and Camel to do the > >> filtering/re-routing etc... All this then needs to sit in JBoss. A > client > >> application will connect to the Queues/Topics and download the messages. > >> In > >> time this will also need to send messages back to the server. > >> I have ActiveMQ installed in JBoss 4.2.2.GA and it works fine. > >> How do I get intergrate Camel into it? I understand that this is already > >> included in ActiveMQ but I can't see how to control Camel routing. I > >> created > >> an MBean to sit in JBoss and configure a simple routing based on some > >> example code from the fuse project. I have noticed that this uses > >> CamelContext.start(). I don't want the MBean to do this, I want JBoss to > >> start this up. When this is called I get multiple exception messages, > one > >> of > >> which is: > >> > >> Failed to start ActiveMQ JMS Message Broker. Reason: > >> javax.management.InstanceAlreadyExistsException: > >> > >> JBoss has already started ActiveMQ! I never wanted Camel to start it > >> also. > >> > >> Is there a way of attaching Camel to the current ActiveMQ broker? > >> > >> I appologies if this is confusing, like I say I am a newbie and maybe > >> barking up the wrong tree. > >> > >> Best Regards > >> Chris Mitchell > >> -- > >> View this message in context: > >> > http://www.nabble.com/JBoss-%2B-ActiveMQ-%2B-Camel-%2B-Newbie-tp24056976p24056976.html > >> Sent from the Camel - Users mailing list archive at Nabble.com. > >> > >> > > > > > > -- > > Claus Ibsen > > Apache Camel Committer > > > > Open Source Integration: http://fusesource.com > > Blog: http://davsclaus.blogspot.com/ > > Twitter: http://twitter.com/davsclaus > > > > > > -- > View this message in context: > http://www.nabble.com/JBoss-%2B-ActiveMQ-%2B-Camel-%2B-Newbie-tp24056976p24070733.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus |
|
|
Re: JBoss + ActiveMQ + Camel + NewbieWould it be fair in saying that not many people intergrate ActiveMQ and Camel into JBoss?
Is it quicker/better/easier to use the standalone ActiveMQ server or an embedded solution? Whats the difference between using Camel and Spring? I though Camel was built using the Spring framework.
|
|
|
Re: JBoss + ActiveMQ + Camel + NewbieOn Wed, Jun 17, 2009 at 1:32 PM, chu_man_fu <cem@...> wrote:
> > Would it be fair in saying that not many people intergrate ActiveMQ and Camel > into JBoss? I do think many use ActiveMQ as a JMS broker. So there should be a fair share of users with JBoss. But deploying as a resource adapter is the J2ee land and people are migrating away from this to lighter alternatives. If you use resource adapter then you cannot as a standalone ActiveMQ borker just toss in your own .jars in a /lib folder. Then you need to figure out how to get that deployed in j2ee JBoss server and that is well JBoss specific. As Camel is very agile you can use a plain proven WAR deployment for your routing. What you need in your WAR is just camel + activemq client jars Then you can keep the AMQ broker (AMQ server) as a resoruce adapter in JBoss. And you routes deployed as a WAR file. Then they are nicely separated. How to use Camel as WAR http://camel.apache.org/tutorial-on-using-camel-in-a-web-application.html And to get the ActiveMQ client and needed .jars you just use maven to depend on <dependency> <groupId>org.apache.activemq</groupId> <artifactId>activemq-camel</artifactId> <version>5.2.0</version> </dependency> See more here: http://camel.apache.org/activemq.html > > Is it quicker/better/easier to use the standalone ActiveMQ server or an > embedded solution? It really depends on a use-case basis. Often the operations team and companies have invested into existing hardware and software. So sometimes throwing in a new server platform they should figure out to host and start/stop/maintain is not always ideal. So if you use JBoss and have AMQ embedded as a resource adapter, that is perfect. > > Whats the difference between using Camel and Spring? I though Camel was > built using the Spring framework. Camel leverages spring where it makes sense instead of building our own. But Camel is very light-weight and the camel-core is not dependent on Spring at all. In fact camel-core.jar only requires commons-logging.jar for logging. You can run Camel 100% standalone or how you like it. http://camel.apache.org/running-camel-standalone.html But combining Camel and Spring is very much used. So you can use Spring as the IoC container. http://camel.apache.org/spring.html Camel uses spring-jms, spring-mail, spring-tx etc. instead of writing it ourself. So when you use JMS its spring-jms under the covers. But people that are into Guice for instance, then Camel also integrates well with Guice http://camel.apache.org/guice.html > > > Claus Ibsen-2 wrote: > > > > On Wed, Jun 17, 2009 at 12:25 PM, chu_man_fu <cem@...> wrote: > > > >> > >> Thanks for the reply. > >> > >> When looking at the the second link I noticed this: > >> "If you want to include some Java routing rules, then just add your jar > >> to > >> somewhere inside ActiveMQ's lib directory." > >> > > > > Well you could forget about this and use the Spring XML file to do your > > routing rules. > > Try to get a simple sample working, eg using a timer to print to a log or > > something else. > > > > > > > >> > >> Where is this lib directory. In my JBoss deploy directory I have a dir > >> called activemq-ra-1.4.rar as explained here > >> http://activemq.apache.org/integrating-apache-activemq-with-jboss.html > >> http://activemq.apache.org/integrating-apache-activemq-with-jboss.html . > >> This doesn't contain a lib directory or an activemq.xml file. Is it a > >> case > >> of dropping any jars in the activemq-ra-1.4.rar dir or the activemq.xml > >> file > >> to get this to work? > >> > > > > I guess this is more a question to JBoss how to deploy .jar files that > > Resource Adapters (ra) > > can see and use. That can be tricky as classloading and classpath in J2EE > > containers can be a nightmare. > > > > > > > > > >> > >> > >> Claus Ibsen-2 wrote: > >> > > >> > Hi > >> > Camel is shipped out of the box with ActiveMQ. > >> > > >> > There should be an active mq configuraiton file that is a spring XML > >> file. > >> > In this XML file you just add a camelcontext and then you get Camel > >> > started. > >> > If not mistaking there might be a Camel sample already in this file. > >> > > >> > Something like this: > >> > http://activemq.apache.org/xml-configuration.html > >> > > >> > And a bit info on this FAQ > >> > > >> http://activemq.apache.org/how-should-i-package-applications-using-camel-and-activemq.html > >> > > >> > > >> > > >> > On Tue, Jun 16, 2009 at 5:36 PM, chu_man_fu <cem@...> wrote: > >> > > >> >> > >> >> Hello forum, > >> >> > >> >> I am a newbie to ActiveMQ and Camel and I have a few questions which I > >> am > >> >> unable to fathom out myself. > >> >> Firstly I will explain what I am trying to achieve. I need to create a > >> >> messaging system over internet protocols. The messages need to be > >> >> filtered > >> >> based on content and sent to the appropiate Queue/Topic. > >> >> I want to use ActiveMQ as my messaging provider and Camel to do the > >> >> filtering/re-routing etc... All this then needs to sit in JBoss. A > >> client > >> >> application will connect to the Queues/Topics and download the > >> messages. > >> >> In > >> >> time this will also need to send messages back to the server. > >> >> I have ActiveMQ installed in JBoss 4.2.2.GA and it works fine. > >> >> How do I get intergrate Camel into it? I understand that this is > >> already > >> >> included in ActiveMQ but I can't see how to control Camel routing. I > >> >> created > >> >> an MBean to sit in JBoss and configure a simple routing based on some > >> >> example code from the fuse project. I have noticed that this uses > >> >> CamelContext.start(). I don't want the MBean to do this, I want JBoss > >> to > >> >> start this up. When this is called I get multiple exception messages, > >> one > >> >> of > >> >> which is: > >> >> > >> >> Failed to start ActiveMQ JMS Message Broker. Reason: > >> >> javax.management.InstanceAlreadyExistsException: > >> >> > >> >> JBoss has already started ActiveMQ! I never wanted Camel to start it > >> >> also. > >> >> > >> >> Is there a way of attaching Camel to the current ActiveMQ broker? > >> >> > >> >> I appologies if this is confusing, like I say I am a newbie and maybe > >> >> barking up the wrong tree. > >> >> > >> >> Best Regards > >> >> Chris Mitchell > >> >> -- > >> >> View this message in context: > >> >> > >> http://www.nabble.com/JBoss-%2B-ActiveMQ-%2B-Camel-%2B-Newbie-tp24056976p24056976.html > >> >> Sent from the Camel - Users mailing list archive at Nabble.com. > >> >> > >> >> > >> > > >> > > >> > -- > >> > Claus Ibsen > >> > Apache Camel Committer > >> > > >> > Open Source Integration: http://fusesource.com > >> > Blog: http://davsclaus.blogspot.com/ > >> > Twitter: http://twitter.com/davsclaus > >> > > >> > > >> > >> -- > >> View this message in context: > >> http://www.nabble.com/JBoss-%2B-ActiveMQ-%2B-Camel-%2B-Newbie-tp24056976p24070733.html > >> Sent from the Camel - Users mailing list archive at Nabble.com. > >> > >> > > > > > > -- > > Claus Ibsen > > Apache Camel Committer > > > > Open Source Integration: http://fusesource.com > > Blog: http://davsclaus.blogspot.com/ > > Twitter: http://twitter.com/davsclaus > > > > > > -- > View this message in context: http://www.nabble.com/JBoss-%2B-ActiveMQ-%2B-Camel-%2B-Newbie-tp24056976p24071711.html > Sent from the Camel - Users mailing list archive at Nabble.com. > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus |
|
|
Re: JBoss + ActiveMQ + Camel + NewbieI've stucked at configuration point, an idea is almost the same:
JBOSS 5 + ActvieMQ integration + Camel under ActiveMQ configuration file. So: Jboss 5.1.0 + ActiveMQ 5.3.0, jboss rar: jboss-5.1.0/server/default/deploy/activemq-ra.rar broker config file: jboss-5.1.0/server/default/deploy/activemq-ra.rar/broker-config.xml jboss resource adapter config file: jboss-5.1.0/server/default/deploy/activemq-ra.rar/ra.xml if I use the followin string in ra.xml: <config-property-value>xbean:broker-config.xml</config-property-value> than I get: WARN [ActiveMQResourceAdapter] Could not start up embeded ActiveMQ Broker 'xbean:broker-config.xml': The configuration has no BrokerService instance for resource: xbean:broker-config.xml in another case if I try to use file link: <config-property-value>xbean:file:///broker-config.xml</config-property-value> I get sometimes the same error as above, sometimes IOException/FileNotFoundException, I've tried different combinations, symlinks etc, but I never got this broker running under Jboss5. |
|
|
Re: JBoss + ActiveMQ + Camel + NewbieOn Mon, Oct 26, 2009 at 9:58 AM, Matvey <matteo@...> wrote:
> > I've stucked at configuration point, an idea is almost the same: > JBOSS 5 + ActvieMQ integration + Camel under ActiveMQ configuration file. > > So: Jboss 5.1.0 + ActiveMQ 5.3.0, > jboss rar: > > jboss-5.1.0/server/default/deploy/activemq-ra.rar > > broker config file: > jboss-5.1.0/server/default/deploy/activemq-ra.rar/broker-config.xml > > jboss resource adapter config file: > jboss-5.1.0/server/default/deploy/activemq-ra.rar/ra.xml > > if I use the followin string in ra.xml: > <config-property-value>xbean:broker-config.xml</config-property-value> > > than I get: > WARN [ActiveMQResourceAdapter] Could not start up embeded ActiveMQ Broker > 'xbean:broker-config.xml': The configuration has no BrokerService instance > for resource: xbean:broker-config.xml > > in another case if I try to use file link: > <config-property-value>xbean:file:///broker-config.xml</config-property-value> > I get sometimes the same error as above, sometimes > IOException/FileNotFoundException, I've tried different combinations, > symlinks etc, but I never got this broker running under Jboss5. > Hi Can you ask in the ActiveMQ user forum and/or search that forum as its more of an AMQ question than Camel. > > -- > View this message in context: http://www.nabble.com/JBoss-%2B-ActiveMQ-%2B-Camel-%2B-Newbie-tp24056976p26056245.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus |
|
|
Re: JBoss + ActiveMQ + Camel + NewbieActually my idea was to start ActiveMQ + Camel under Jboss and this topic was exactly about it.
I've found where the problem was, at least with Jboss 5.1.0 + ActiveMQ 5.3 + Camel 2.0 + Spring 2.5 you need to explicitly write xmlns in beans definition in your broker-config.xml aslo, params from /META-INF/ra.xml (ActiveMQ Resource Adapter) <config-property> <config-property-name>BrokerXmlConfig</config-property-name> <config-property-type>java.lang.String</config-property-type> <config-property-value>xbean:broker-config.xml</config-property-value> </config-property> and the broker-config.xml should contain following: <broker xmlns="http://activemq.apache.org/schema/core" useJmx="true" useShutdownHook="false" id="broker" name="bruce.broker"> ... xmlns is important, otherwise you can not get your broker via Spring, you should have spreang-beansxxx.jar in your classpath as well. if you need to include camel configuration file - do it just with resource import: <import resource="camel.xml" /> in camel.xml you may specify your routes, for example: <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> <!-- You can use a <packages> element for each root package to search for Java routes --> <packageScan> <packages>org.foo.bar</packages> </packageScan> <!-- You can use Spring XML syntax to define the routes here using the <route> element --> <route> <from uri="activemq:TEST.FOO1"/> <to uri="activemq:TEST.FOO"/> </route> <!-- TEST TIMER ROUTE --> <route> <from uri="timer://foo?fixedRate=true&period=1000"/> <to uri="activemq:TEST.FOO"/> </route> </camelContext> <!-- configure the camel activemq component to use the current broker --> <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent"> <property name="brokerURL" value="tcp://localhost:61616"/> </bean> </beans> |
|
|
Re: JBoss + ActiveMQ + Camel + NewbieHi
Thanks a lot for sharing your findings and solution. I have created a FAQ pointing to this discussion. http://cwiki.apache.org/confluence/display/CAMEL/How+do+I+run+ActiveMQ+and+Camel+in+JBoss On Mon, Oct 26, 2009 at 3:30 PM, Matvey <matteo@...> wrote: > > Actually my idea was to start ActiveMQ + Camel under Jboss and this topic was > exactly about it. > > I've found where the problem was, at least with Jboss 5.1.0 + ActiveMQ 5.3 + > Camel 2.0 + Spring 2.5 you need to explicitly write xmlns in beans > definition in your broker-config.xml > > aslo, params from /META-INF/ra.xml (ActiveMQ Resource Adapter) > <config-property> > <config-property-name>BrokerXmlConfig</config-property-name> > <config-property-type>java.lang.String</config-property-type> > > <config-property-value>xbean:broker-config.xml</config-property-value> > </config-property> > > > and the broker-config.xml should contain following: > <broker xmlns="http://activemq.apache.org/schema/core" useJmx="true" > useShutdownHook="false" id="broker" name="bruce.broker"> > ... > xmlns is important, otherwise you can not get your broker via Spring, you > should have spreang-beansxxx.jar in your classpath as well. > > if you need to include camel configuration file - do it just with resource > import: > <import resource="camel.xml" /> > > in camel.xml you may specify your routes, for example: > > > <beans > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://camel.apache.org/schema/spring > http://camel.apache.org/schema/spring/camel-spring.xsd"> > <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> > > <!-- You can use a <packages> element for each root package to > search for Java routes --> > <packageScan> > <packages>org.foo.bar</packages> > </packageScan> > > <!-- You can use Spring XML syntax to define the routes here using > the <route> element --> > <route> > <from uri="activemq:TEST.FOO1"/> > <to uri="activemq:TEST.FOO"/> > </route> > <!-- TEST TIMER ROUTE --> > > <route> > <from uri="timer://foo?fixedRate=true&period=1000"/> > <to uri="activemq:TEST.FOO"/> > </route> > > > </camelContext> > > <!-- configure the camel activemq component to use the current broker > --> > <bean id="activemq" > class="org.apache.activemq.camel.component.ActiveMQComponent"> > <property name="brokerURL" value="tcp://localhost:61616"/> > </bean> > </beans> > > > > -- > View this message in context: http://www.nabble.com/JBoss-%2B-ActiveMQ-%2B-Camel-%2B-Newbie-tp24056976p26060885.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus |
| Free embeddable forum powered by Nabble | Forum Help |