【问题标题】:how to calculate the starting time and end time for apache camel router?如何计算apache骆驼路由器的开始时间和结束时间?
【发布时间】:2017-08-14 01:16:27
【问题描述】:

我正在尝试捕获 apache 骆驼路由器的开始时间和结束时间。 我们使用骆驼进行消息传递,我们已经实现了肥皂服务,石英在骆驼路由器中,如下所示

public class BbdDmsBatchRoute extends RouteBuilder{



    @BeanInject
    private BbdImageProcessorBean bbdImageProcessorBean;

    @BeanInject
    private SwtDEAStockProcessorBean swtDEAStockProcessorBean;

    @Value("${bbd.batch.enabled}")
    private String isBatchEnabled;

    @Value("${bbd.dmsStockBatch.interval}")
    private String bbdDmsBatchInterval ;

    private static final Logger LOG = LoggerFactory.getLogger(BbdDmsBatchRoute.class);

    @Override
    public void configure() throws Exception {

        //***********Batch Job to get BBD images**************//
                //  This Batch Job will run based on time given in properties file for "bbd.batch.interval" property (bbd.batch.interval=0+0+12+1/1+*+?+*)   
                LOG.info("BBD Batch Job Cron expression {}",bbdDmsBatchInterval);

                from("quartz2://STouchDmsBatch/bbdDailyJob?cron="+ bbdDmsBatchInterval)
                .choice()            
                 .when(simple(isBatchEnabled))
                    .doTry()
                    .bean(bbdImageProcessorBean, "bbdReRunDmsBatchInvocation") 
                    .split(bodyAs(List.class))                          //Split each object in list and process in parallel
                    //.executorServiceRef("executerRefProfile").parallelProcessing()                    
                    .to("direct:batchJobRouteUnitWork")
                    .end()
                    .endDoTry()
                    .doCatch(Exception.class)
                    .to("direct:BbdReRunError")
                    .end();


        }
}

我想计算我的quartz2:StouchDmsBatch 被触发时的开始时间和路线无任何异常完成时的结束时间。

我红了几个例子,告诉使用camel拦截器,EventSupport等。 我想知道有没有人实施过同样的? 有人可以帮我吗?

【问题讨论】:

    标签: spring apache-camel


    【解决方案1】:

    参考这个 .. 如果您只想在某个时间点捕获当前时间,然后在某处的日志记录中使用它.. 您可以将当前时间存储在交换属性中,然后在您喜欢的任何地方使用它..

    How to time portions of an apache camel route?

    【讨论】:

      【解决方案2】:

      您可以将此类添加为 bean。然后启用您感兴趣的事件。然后,您可以看到每个步骤需要多长时间。 http://camel.apache.org/eventnotifier-to-log-details-about-all-sent-exchanges.html

      【讨论】:

      • @什么?说真的。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-22
      • 2021-04-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-22
      相关资源
      最近更新 更多