Apache camel 暂停并恢复骆驼路线

Apache camel 暂停并恢复骆驼路线,apache-camel,fuseesb,jbossfuse,Apache Camel,Fuseesb,Jbossfuse,嗨,我在camel中有一个JMS消费者路由,我的要求是在特定事件(基于some字段值)停止/挂起该路由,然后使用调度器恢复该路由。 为此,我创建了两条路由,一条是原始jms使用者路由,另一条是调度程序路由,它们恢复jms使用者路由,尽管我可以挂起路由,但第二条路由不会恢复挂起的路由,并显示已启动的状态 下面是我的两条路线 原始消费者路线 调度程序路由 请帮助我如何实现上述场景 您需要给它超过1秒的时间。这是一个回退超时,因此如果暂停不能在1秒内发生,则让路由运行。例如,阅读您使用的API的jav

嗨,我在camel中有一个JMS消费者路由,我的要求是在特定事件(基于some字段值)停止/挂起该路由,然后使用调度器恢复该路由。 为此,我创建了两条路由,一条是原始jms使用者路由,另一条是调度程序路由,它们恢复jms使用者路由,尽管我可以挂起路由,但第二条路由不会恢复挂起的路由,并显示已启动的状态

下面是我的两条路线

原始消费者路线 调度程序路由
请帮助我如何实现上述场景

您需要给它超过1秒的时间。这是一个回退超时,因此如果暂停不能在1秒内发生,则让路由运行。例如,阅读您使用的API的javadoc文档,您可以看到这些信息

顺便说一句,还有一个controlbus组件,因此您只需向端点发送消息即可挂起/恢复路由


我尝试增加回退时间限制,但行为没有改变,第一条路由的状态仍然显示为第二条路由中的已启动状态。我不能使用控制总线组件,因为我必须使用camel 2.10 redhat保险丝版本。@Claus Ibsen保险丝6.0.0.Redhat24上有任何受支持的组件吗
from("activeMQ:demo.audit.event1?testConnectionOnStartup=true&acknowledgementModeName=CLIENT_ACKNOWLEDGE")
    .routeId("javadslconsumer")
    .log("before stopping==="+new Date().toString())
    .process(new Processor() {
          @Override
          public void process(final Exchange exchange) throws Exception {
              try {
                  Route route = exchange.getContext().getRoute("javadslconsumer");
                  System.out.println("route.supportsSuspension()"+route.supportsSuspension());
                  exchange.getContext().suspendRoute("javadslconsumer",1l,TimeUnit.SECONDS);
                  // create another helper route, using which we can start or resume this route based 
                  // on the current life cycle phase of this route.    
              } catch (Exception e) {
                  // ignore
                  e.printStackTrace();
                }
            }
        })
    .log("after stopping logs==="+new Date().toString())
    .unmarshal(dataFormat)
    .beanRef("auditProcessor", "getErrorAuditDTO")
    .beanRef("auditProcessor", "processCreateAudit");   
from("timer:dlqscheduler?period=6000&fixedRate=true")
.process(new Processor(){
    @Override
    public void process(Exchange exchange) throws Exception {
        System.out.println("timer process started");
        try {
            exchange.getContext().resumeRoute("javadslconsumer");
            //exchange.getContext().startRoute("javadslconsumer");
        } catch (Exception e) {
            System.out.println("-----d-d-d-d-"+e.getMessage());
        }
        ServiceStatus serviceStatus  = getContext().getRouteStatus("javadslconsumer");
        System.out.println("serviceStatus.isStopped()"+serviceStatus.isStopped()); // showing false instead of true
        System.out.println("serviceStatus.isSuspended()"+serviceStatus.isSuspended()); // showing false instead of true
        System.out.println("serviceStatus"+serviceStatus);// showing started
    }       
})
.log("after resuming the route javadslconsumer");