문제

I'm trying to understand how Camel works reading some books (Camel in Actions) and some tutorial but there is something that I actually don't understand. Basically I've to process some messages sent from a web application to to some Rabbit queues any time users click on a web page o make a particular action.

I'll create a Maven project and defining a configuration route to handle this process. My doubt are related to the execution of that process. If I understand well, when I run using

maven camel:run

it creates an instance of CamelContext and process the queue. But it's not clear if the process will stay alive waiting for new messages on queue or not. Have I to create something that actively checks for new messages on queue something like a listener or a daemon or it is possible to configure it using Spring?

thanks for your time!
Andrea

도움이 되었습니까?

해결책

if your application defines a camel-jms route, then it will create a listener on your queue that will be active until you terminate your maven came:run process

for more information on using the maven camel plugin, see this page: http://camel.apache.org/camel-maven-plugin.html

다른 팁

As long as the context is up and running and you've defined the queue as the entry point for your route it should continue to listen for messages and process them. Something like:

<camel:camelContext xmlns="http://camel.apache.org/schema/spring" id="echoContext">

       <route id="echoJmsConsumeRoute">
           <from uri="activemq:queue:xxx.xxx.xxx.xxx.testqueue"/>
           <to uri="log:echo?level=DEBUG"/>
       </route>
</camel:camelContext>

If you kill the maven process, of course, the JVM will terminate.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top