我是 Apache Camel 框架的新手。我已将下面的 camelcontext bean(即 ID 为 camel)注入 CreationImpl,并且能够从该 camelcontext 对象访问端点和路由。我想知道如何触发任务。不知道方法对不对?请建议。
<camel:camelContext id="camel">
<camel:jmxAgent id="agent" createConnector="true" usePlatformMBeanServer="true" connectorPort="1516" registryPort="1515" />
<camel:endpoint id="email" uri="${email}" />
<camel:route errorHandlerRef="createErrorHandler" id="createRoute">
<camel:from uri="direct:startReading"/>
<camel:doTry>
<camel:bean ref="creationProcessor" method="method1"/>
<camel:bean ref="creationFilter" method="method2"/>
<camel:bean ref="creatorFeedback" method="method3"/>
<camel:bean ref="creatorFeedback" method="method4"/>
<camel:doCatch>
<camel:exception>java.lang.Exception</camel:exception>
<camel:bean ref="creatorFeedback" method="method5"/>
</camel:doCatch>
</camel:doTry>
</camel:route>
</camel:camelContext>
public class CreationImpl{
private CamelContext camelContext;
public void migrate{
//how to trigger the route after getting camelcontext object
}
}
提前致谢。