我目前正在尝试将apace camel spring路由到我的项目中,并且遇到了一些问题。我可以让CamelContext在我运行程序时自动启动但是我一直在弄乱:
共有0条路线,其中0条已开始。 Apache Camel 2.6.0(CamelContext:camel-1)在0.790秒内启动
这在日志记录中显示。
我会发布“骆驼语境”,也许有人可以指出我误入歧途的地方。我现在迷失了,我真的想要掌握这项技术,因为它听起来非常强大。我希望这是一个简单的解决方案!如果您还有其他需要,请告诉我。
<?xml version="1.0" encoding="UTF-8"?>
<spring:beans xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://camel.apache.org/schema/spring"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:alch="http://service.alchemy.kobie.com/"
xsi:schemaLocation="http://www.springframework.org/schema/beans classpath:META-INF/spring/spring-beans.xsd
http://camel.apache.org/schema/spring classpath:META-INF/spring/camel-spring.xsd">
<!-- load properties -->
<spring:bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<spring:property name="locations" value="file:backend.properties" />
</spring:bean>
<spring:bean id="properties"
class="org.apache.camel.component.properties.PropertiesComponent">
<spring:property name="location" value="file:backend.properties" />
</spring:bean>
<spring:bean id="jmsConnectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
<spring:property name="brokerURL" value="tcp://0.0.0.0:61616?useLocalHost=true" />
</spring:bean>
<spring:bean id="pooledConnectionFactory"
class="org.apache.activemq.pool.PooledConnectionFactory">
<spring:property name="maxConnections" value="8" />
<spring:property name="maximumActive" value="500" />
<spring:property name="connectionFactory" ref="jmsConnectionFactory" />
</spring:bean>
<spring:bean id="jmsConfig"
class="org.apache.camel.component.jms.JmsConfiguration">
<spring:property name="connectionFactory" ref="pooledConnectionFactory"/>
<spring:property name="transacted" value="false"/>
<spring:property name="concurrentConsumers" value="1"/>
</spring:bean>
<spring:bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent">
<spring:property name="configuration" ref="jmsConfig"/>
</spring:bean>
<!-- Loaded Beans -->
<spring:bean id="ExactTargetBean" class="com.backend.trigger.TargetBean" />
<spring:bean id="TriggerEmailRequestBean" class="com.requests.TriggerEmailRequest" />
<!-- Camel configuration -->
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route id="genericMessageHandler" streamCache="true">
<from uri = "activemq:topic:Test.topic"/>
<multicast>
<to uri = "TargetIntegration" />
</multicast>
</route>
<route>
<from uri="TargetIntegration" />
<setProperty propertyName="apiuser">
<simple>${properties:et.username}</simple>
</setProperty>
<setProperty propertyName="password">
<simple>${properties:et.password}</simple>
</setProperty>
<setProperty propertyName="triggerName">
<constant>WelcomeEmail</constant>
</setProperty>
<setProperty propertyName="email">
<constant>patrick@test.com</constant>
</setProperty>
<setProperty propertyName="firstName">
<constant>Patrick</constant>
</setProperty>
<setProperty propertyName="lastName">
<constant>Archambeau</constant>
</setProperty>
<to uri = "xslt:xslt/target-integration.xsl" />
<log message="Transformed Message : ${in.body}" />
<setBody>
<simple>qf=xml&xml=${in.body}</simple>
</setBody>
<setHeader headerName="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
<setHeader headerName="Content-type">
<constant>application/x-www-form-urlencoded</constant>
</setHeader>
<setHeader headerName="Connection">
<simple>close</simple>
</setHeader>
<log message="Transformed Message : ${in.body}" />
<to uri = "{{et.integration.url}}" />
<log message="Transformed Message : ${in.body}" />
</route>
</camelContext>