【问题标题】:Camel Enrichment error: No consumers available on endpoint: Endpoint骆驼浓缩错误:端点上没有可用的消费者:端点
【发布时间】:2014-08-07 17:39:16
【问题描述】:

我正在尝试通过两个队列之间的方法传递我的消息。这是我的路线:

<camelContext xmlns="http://camel.apache.org/schema/spring">
    <route>
        <from uri="jms:queue:testQSource"/>
        <to uri="direct:adder"/>
    </route>
    <route>
        <from uri="direct:adder"/>
        <log message="Routing message from testQSource to testQDestination queue with data ${body}"/>
        <to uri="jms:queue:testQDestination"/>
    </route>
</camelContext>

这是有加法器的类:

package com.example.integration;

public class Modifier {
    public String adder(String words) {
         System.out.println("adder entered");
         return words + 'a';
    }
}

“加法器输入的打印语句从未被打印过,并且消息末尾没有额外的“a”。知道为什么不使用该函数吗?

提前感谢您的帮助!

【问题讨论】:

    标签: routing apache-camel activemq


    【解决方案1】:

    该错误消息意味着您尚未定义要从 direct:adder 消费的路由...因为直接是同步的,所以它要求在调用它时路由/消费者可用...

    http://camel.apache.org/bean.html,它应该看起来像这样......

    <camelContext xmlns="http://camel.apache.org/schema/spring">
        <route>
            <from uri="jms:queue:testQSource"/>
            <to uri="direct:adder"/>
        </route>
        <route>
          <from uri="direct:adder"/>
          <to uri="myBean"/>
          <log message="Routing message from testQSource to testQDestination queue with data ${body}"/>
          <to uri="jms:queue:testQDestination"/>
        </route>
    </camelContext>
    
    <bean id="myBean" class="com.example.integration.Modifier"/>
    

    【讨论】:

    • 感谢您这么快回复!我编辑了我的路线和我的代码,但我遇到了一个问题,它没有进入直接方法。我编辑了我的帖子以反映代码更改。有什么想法吗?
    • 您只需要在直接路由中引用您的修饰符 bean...也更新了我的示例
    • 非常感谢,直接参考解决了我的问题!
    猜你喜欢
    • 1970-01-01
    • 2014-11-11
    • 1970-01-01
    • 1970-01-01
    • 2012-11-05
    • 2017-06-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多