在特定时间运行quartz
骆驼路线(cron-job
)时,会生成约1MB的文件并将其上传到FTP。
它低于错误,并且是间歇性(有时直到过程结束我都不会出错)。
在本地无法重现该问题几乎成为不可能。但是,如果我尝试在进行中的cron-job
中更新骆驼路线,则会抛出完全相同的错误,
我该如何解决?
错误:
[ERROR] org.apache.camel.component.quartz2.CamelJob - Error processing exchange. Exchange[ID-sw-prod-esb-01-40406-1534255789208-0-272116]. Caused by: [org.quartz.JobExecutionException - java.util.concurrent.RejectedExecutionException]
[INFO ] 2018-07-06T10:20:11,772 [test-camel-quartz-scheduler-instance-camel-1_Worker-9] [{cId=a6b1a4d6-7df3-40a3-8a70-b57aa}] org.quartz.core.JobRunShell - Job DEFAULT.quartz-endpoint528 threw a JobExecutionException:
org.quartz.JobExecutionException: java.util.concurrent.RejectedExecutionException
at org.apache.camel.component.quartz.QuartzEndpoint.onJobExecute(QuartzEndpoint.java:147) ~[camel-quartz-2.19.0.jar:2.19.0]
at org.apache.camel.component.quartz.CamelJob.execute(CamelJob.java:63) ~[camel-quartz-2.19.0.jar:2.19.0]
at org.quartz.core.JobRunShell.run(JobRunShell.java:223) [quartz-1.8.6.jar:?]
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549) [quartz-1.8.6.jar:?]
Caused by: java.util.concurrent.RejectedExecutionException
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:428) ~[camel-core-2.19.0.jar:2.19.0]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:198) ~[camel-core-2.19.0.jar:2.19.0]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:120) ~[camel-core-2.19.0.jar:2.19.0]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:83) ~[camel-core-2.19.0.jar:2.19.0]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:198) ~[camel-core-2.19.0.jar:2.19.0]
at org.apache.camel.processor.loadbalancer.QueueLoadBalancer.process(QueueLoadBalancer.java:44) ~[camel-core-2.19.0.jar:2.19.0]
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109) ~[camel-core-2.19.0.jar:2.19.0]
at org.apache.camel.processor.loadbalancer.LoadBalancerSupport.process(LoadBalancerSupport.java:97) ~[camel-core-2.19.0.jar:2.19.0]
at org.apache.camel.component.quartz.QuartzEndpoint.onJobExecute(QuartzEndpoint.java:143) ~[camel-quartz-2.19.0.jar:2.19.0]
... 3 more
路由定义XML:
<?xml version="1.0" encoding="UTF-8"?>
<routes xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="quartz://Test/DataUpload?cron=0 50 15 ? * * *&trigger.timeZone=Asia/Calcutta" />
<log message="Starting here" />
<to uri="bean:SomeProcessor" />
<log message="after processor" />
<split>
<simple>${body}</simple>
<to uri="bean:TransformProcessor" />
</split>
<log message="ending here" />
</route>
</routes>
编辑:
在分析日志时,我可以看到日志“从这里开始”,并且当它进入SomeProcessor.java时,也没有例外,但是日志“在处理器之后”没有打印。
SomeProcessor.java
Map<String, String> searchAttributes = buildSearchFilterAttr(exchange);
Set<Order> orderSet = new HashSet<Order>();
logger.info("fetching {}", searchAttributes);
try {
dataSet = cleint.someAPI(....);
logger.info("total number {} ", dataSet.size());//300
exchange.getIn().setBody(dataSet);
} catch (IOException | BadRequestException ex) {
logger.error("error");
throw new SomeCustomException(errMsg, ex);
}