简体   繁体   English

骆驼浓缩错误:终结点上没有消费者:终结点

[英]Camel Enrichment error: No consumers available on endpoint: Endpoint

I'm trying to put my message through a method between two queues. 我正在尝试通过两个队列之间的方法发送消息。 This is my route: 这是我的路线:

<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>

Here is the class that has adder: 这是具有加法器的类:

package com.example.integration;

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

The "adder entered print statement isn't ever being printed and the message doesn't have an extra "a" on the end. Any ideas why the function isn't being used? “ adder输入的打印语句永远不会被打印,并且消息的末尾没有多余的” a“。为什么不使用该功能,您知道吗?

Thanks in advance for all your help! 预先感谢您的所有帮助!

that error message means you haven't defined a route to consume from direct:adder ...because direct is synchronous, it requires a route/consumer be available at the time it's invoked... 该错误消息表示您尚未定义要从direct:adder使用的路由...由于direct是同步的,因此它在被调用时需要一个可用的路由/消费者...

see http://camel.apache.org/bean.html , it should look something like this... 看到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"/>

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

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