我正在学习Camel,遇到了一个问题,如何从流程方法中调用所需的路线?我正在使用 Java JSL。有一堂课
public class PaysRoutBuilder extends Environement {
@Override
public void configure() throws Exception {
getPropertiesComponent();
/* Get token */
from("timer:gettoken?period=20000")
.process(getAuthTokenProcessor)
.to("direct:ssoCall");
from("timer:name?period=20000&fixedRate=true")
.process(searchClientsPropProc)
.choice().when(exchangeProperty(Start.title))
.process(getDBDocumentsProc);
环境类
public abstract class Environement extends RouteBuilder {
Processor searchClientsPropProc = new SearchClientPropsProc();
Processor getDBDocumentsProc = new GetDBDocsProc();
Processor getAuthTokenProcessor = new PrepareAuthTokenHeaders();
}
有一个类添加路由器
public class Setup {
public Main setup(String... args) throws IOException {
Main main = new Main();
main.enableHangupSupport();
RouteBuilder paysBuilder = new PaysRoutBuilder();
main.addRouteBuilder(paysBuilder);
main.addRouteBuilder(new SsoCallRoute());
return main;
}
}
在这里,在某些条件下,我需要在 getDBDocumentsProc 处理器中重新调用“timer:gettoken”路由。
我不知道该怎么做,我尝试了不同的方法,最后一个是这样的,我就是找不到怎么做((
new RouteBuilder() {
@Override
public void configure() throws Exception {
from("time:name").to("time:gettoken");
}
};
请告诉我如何在处理器中调用路由器。