Cannot find any routes with this RouteBuilder reference: RouteBuilderRef[routebuilderOne]
構成に基づいてルート ビルダーを配線しようとすると、例外が発生 します。
Route Builder 1のクラスファイル
import org.apache.camel.spring.SpringRouteBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
public class RoutebuilderOne extends SpringRouteBuilder {
@Value("${routebuilder.stream.one}")
private boolean autoStartupRouteOne;
@Override
public void configure() throws Exception {
from(source1).autoStartup(autoStartupRouteOne).split().method("splitLogic","splitMethod").to(destination1);
}
}
Route builder 2のクラスファイル
import org.apache.camel.spring.SpringRouteBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
public class RoutebuilderTwo extends SpringRouteBuilder {
@Value("${routebuilder.stream.two}")
private boolean autoStartupRouteTwo;
@Override
public void configure() throws Exception {
from(source2).autoStartup(autoStartupRouteTwo).to(destination2);
}
}
Camel コンテキスト ファイル
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
<camelContext xmlns="http://camel.apache.org/schema/spring">
<routeBuilder ref="routebuilderOne"/>
<routeBuilder ref="routebuilderTwo"/>
</camelContext>
<context:component-scan
base-package="com.hurix.routebuilders" />
</beans>
autoStartupRouteOne,autoStartupRouteTwo
プロパティ ファイルの as の値
autoStartupRouteOne = false
autoStartupRouteTwo = true
条件に基づくルート選択を実現する他の方法はありますか?