I want to use the route of the project I imported in ApacheCamel

Asked 2 years ago, Updated 2 years ago, 28 views

Question

Creating API in ApacheCamel JavaDSL.
An error occurred when I tried to use the route of the project I imported in the following steps.
Could you give me some tips on how to solve the problem, such as using other project routes?

Step

Other settings

·Route part of A project

package jp.co.aaa.route;
public class ARoute extensions RouteBuilder {
  @ Override
  public void configure()throws Exception {
    from ("direct:check")
    .routeId ("check")
    .transform(simple("${body}"));
  }
}

·Calling part of project B

package jp.co.bbb.route;
~~
private void bCheck() {
   from ("direct:bcheck")
   .routeId ("bcheck")
   .to("direct:check");
}

·Add packageScan to the camera-context.xml of project B as follows

<packageScan>
    <package>jp.co.aaa.route</package>
    <package>jp.co.bbb.route</package>
    <includes>**.*</includes>
</packageScan>

Error Contents

org.apache.cxf.interceptor.Fault: No consumers available on endpoint: Endpoint [direct://XXXA root XXX].Exchange [ID-HW3650-3230-1517360482872-41-8] while invoking public abstract java.lang.Object jp.co.XXX.lang] [jXXX.pang]

apache-camel

2022-09-30 14:10

1 Answers

This is self-resolved.

I modified the packageScan in the B project camera-context.xml as follows and successfully loaded it.

<bean id="aRouteBuilder" class="jp.co.aaa.route.ARouteClass"/>
<bean id="bRouteBuilder" class="jp.co.bbb.route.BRouteClass"/> 

<camelContext...>
    <routeBuilder ref="aRouteBuilder"/>
    <routeBuilder ref="bRouteBuilder"/>
...
</camelContext>

Thank you.


2022-09-30 14:10

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.