如何在骆驼上下文中删除所有路线

时间:2018-11-09 16:29:31

标签: apache-camel spring-camel camel-ftp

如何在骆驼上下文中删除所有路线定义...类似

context.removeRouteDefinitions(context.getRouteDefinitions());

2 个答案:

答案 0 :(得分:1)

 context.removeRouteDefinitions(new ArrayList(context.getRouteDefinitions()));

答案 1 :(得分:0)

请尝试通过您的路线将此方法称为bean方法:

  public void removeRoutes(Exchange exchange) {
            new Thread(() -> {
                try {
 exchange.getContext().stopRoute("currentRoute");
 exchange.getContext().removeRouteDefinitions(context.getRouteDefinitions());

                } catch (Exception e) {
                    e.printStackTrace();
                }
            }).start();
   }