简体   繁体   English

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

[英]How to consume message from the endpoint in Apache Camel?

I had created a message with a topic name and set some information with key/value pair and sent the message to the MessageBus (ie, produced the message to an endPoint - in my case endpoint is a messageBus). 我创建了一个带有主题名称的消息,并使用键/值对设置了一些信息,然后将该消息发送到MessageBus(即,将消息生成到endPoint-在我的情况下,端点是messageBus)。

How can consume the message from that endPoint? 如何使用来自该端点的消息? I know the uri, endpoint. 我知道uri,终点。 what configurations needs to be done for my consumer ( any camel XML changes to done ?). 需要为我的使用者完成哪些配置(对骆驼XML所做的任何更改?)。

Please help. 请帮忙。

see the camel-jms page for details, but you basically need to do some basic Spring XML to configure the ActiveMQ connection and then establish your route... 有关详细信息,请参见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>

see these unit test for more information... 有关更多信息,请参见这些单元测试。

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/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 https://svn.apache.org/repos/asf/camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/jmsRouteUsingSpring.xml

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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