如何在Apache Camel中使用来自端点的消息?

时间:2011-12-23 12:56:08

标签: apache apache-camel

我创建了一个带有主题名称的消息,并使用键/值对设置了一些信息,并将消息发送到MessageBus(即,将消息生成到endPoint - 在我的案例中,端点是messageBus)。

如何使用该endPoint的消息?我知道uri,端点。需要为我的消费者做什么配置(任何camel XML更改要完成?)。

请帮忙。

1 个答案:

答案 0 :(得分:0)

有关详细信息,请参阅camel-jms页面,但您基本上需要执行一些基本的Spring XML来配置ActiveMQ连接,然后建立您的路由......

from("activemq:queue:inboundQueue").bean(MyConsumerBean.class);

<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
    <property name="connectionFactory">
        <bean class="org.apache.activemq.ActiveMQConnectionFactory">
            <property name="brokerURL" value="vm://localhost?broker.persistent=false&broker.useJmx=false"/>
        </bean>
    </property>
</bean>

请参阅这些单元测试以获取更多信息......

https://svn.apache.org/repos/asf/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteTest.java

https://svn.apache.org/repos/asf/camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/jmsRouteUsingSpring.xml

相关问题