发布网友 发布时间:2022-04-24 03:51
共1个回答
热心网友 时间:2023-10-26 03:45
Apache Camel的Header、Property、Body配置示例
<?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: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">
<bean id="echo" class="com.lala.bean.Echo"></bean>
<bean id="bean1" class="com.lala.bean.Bean1"></bean>
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route autoStartup="true">
<from uri="timer://aaa?fixedRate=true&period=60000" />
<process ref="bean1"/>
<!-- 设置所有的headers(会去掉之前的所有header) -->
<setOutHeader headerName="name">
<constant>白展堂</constant>
</setOutHeader>
<!-- 添加一个header -->
<setHeader headerName="id">
<constant>100010</constant>
</setHeader>
<!-- 设置property -->
<setProperty propertyName="type">
<simple>${in.header.id}</simple>
</setProperty>
<!-- 设置body -->
<setBody>
<simple>name:${in.header.name},type:${property.type}</simple>
</setBody>
<process ref="echo"/>
</route>
</camelContext>
</beans>
热心网友 时间:2023-10-26 03:45
Apache Camel的Header、Property、Body配置示例
<?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: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">
<bean id="echo" class="com.lala.bean.Echo"></bean>
<bean id="bean1" class="com.lala.bean.Bean1"></bean>
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route autoStartup="true">
<from uri="timer://aaa?fixedRate=true&period=60000" />
<process ref="bean1"/>
<!-- 设置所有的headers(会去掉之前的所有header) -->
<setOutHeader headerName="name">
<constant>白展堂</constant>
</setOutHeader>
<!-- 添加一个header -->
<setHeader headerName="id">
<constant>100010</constant>
</setHeader>
<!-- 设置property -->
<setProperty propertyName="type">
<simple>${in.header.id}</simple>
</setProperty>
<!-- 设置body -->
<setBody>
<simple>name:${in.header.name},type:${property.type}</simple>
</setBody>
<process ref="echo"/>
</route>
</camelContext>
</beans>
热心网友 时间:2023-10-26 03:45
Apache Camel的Header、Property、Body配置示例
<?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: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">
<bean id="echo" class="com.lala.bean.Echo"></bean>
<bean id="bean1" class="com.lala.bean.Bean1"></bean>
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route autoStartup="true">
<from uri="timer://aaa?fixedRate=true&period=60000" />
<process ref="bean1"/>
<!-- 设置所有的headers(会去掉之前的所有header) -->
<setOutHeader headerName="name">
<constant>白展堂</constant>
</setOutHeader>
<!-- 添加一个header -->
<setHeader headerName="id">
<constant>100010</constant>
</setHeader>
<!-- 设置property -->
<setProperty propertyName="type">
<simple>${in.header.id}</simple>
</setProperty>
<!-- 设置body -->
<setBody>
<simple>name:${in.header.name},type:${property.type}</simple>
</setBody>
<process ref="echo"/>
</route>
</camelContext>
</beans>