简体   繁体   English

如何在Apache Camel中实现事件驱动的使用者并获取JMS消息

[英]How to implement an event-driven consumer in Apache Camel and get JMS Message

Hi I'm struggling with Apache Camel, 嗨,我在与Apache Camel斗争,

i want the "real" javax.jms.TextMessage in my custom Consumer-Bean. 我想要在我的自定义Consumer-Bean中使用“真实的” javax.jms.TextMessage。 But all I get is the Message-Text as String. 但是我得到的只是消息文本为字符串。

Config: 配置:

     <camelContext xmlns="http://camel.apache.org/schema/spring"> 
     <route id="route_dispatching"> 
        <from uri="activemq:queue:queue.dispatcher.replyqueue"/> 
        <to uri="bean:dispatcherbean"/>
       </route>
     </camelContext>
     <bean id="dispatcherbean" class="com.company.Dispatcher"/>

Code of Dispatcher Bean: 分派器Bean代码:

     public class Dispatcher{
           private static final Log LOG = LogFactory.getLog(Dispatcher.class);
          public void handleEvent(Object eventPayload) throws Exception
          {  
                LOG.info("got an event"); 
          }
     }

The eventPayload Object is of type String and not javax.jms.TextMessage. eventPayload对象的类型为String,而不是javax.jms.TextMessage。 I tried to change uri="activemq:queue to uri="jms:queue, but then I get some Errors about missing Connection Factories :-( 我试图将uri =“ activemq:queue更改为uri =” jms:queue,但是随后我收到一些有关缺少连接工厂的错误消息:-(

Hope someone may help? 希望有人可以帮忙吗?

Regards, Tobi 问候,托比

您是否尝试过在POJO类中将类型从Object更改为javax.jms.TextMessage?

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

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