简体   繁体   中英

How to listen on activemq using camel and Spring?

Following is the spring-config.xml file

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:camel="http://camel.apache.org/schema/spring"
xsi:schemaLocation="
      http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
      http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">


    <camel:camelContext id="camelContextApp" autoStartup="true">
        <camel:route id="firstRoute" autoStartup="true">
            <camel:from uri="activemq:queue:alwin-queue.queue" />
            <camel:process ref="testProcessor" />
        </camel:route>
    </camel:camelContext>


    <bean id="testProcessor" class="com.alwindoss.learncamel.TestProcessor">
    </bean>
    .
    .
    .
    </beans>

Since I have set autoStartup="true" I expect the context to be running. But how do I run the application. Even if I have a main What will I do in the main. Everything I want my application to do is in this spring-config file.

Note: in the TestProcessor::process method I just print a statement

You can use the Main class that comes with camel-spring that will allow you to load and keep running your Camel Spring application. Take a look to this tutorial: http://camel.apache.org/running-camel-standalone-and-have-it-keep-running.html

Camel Maven Archetypes看到骆驼原型弹簧

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM