简体   繁体   中英

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?

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

see http://camel.apache.org/bean.html , it should look something like this...

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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