[英]Apache Camel quartz2 timer starting multiple exchanges
I have an application that creates routes to connect to a REST endpoint and process the responses for several vendors.我有一个应用程序可以创建路由以连接到 REST 端点并处理多个供应商的响应。 Each route is triggered with a quartz2 timer.每条路线都由一个 quartz2 计时器触发。 Recently when the timer fires it creates multiple exchanges instead of just one and I cannot determine what is causing it.最近,当计时器触发时,它会创建多个交换而不是一个,我无法确定是什么原因造成的。
The method that creates the routes is here:创建路由的方法在这里:
public String generateRoute(String vendorId) {
routeBuilders.add(new RouteBuilder() {
@Override
public void configure() throws Exception {
System.out.println("Building REST input route for vendor " + vendorId);
String vendorCron = vendorProps.getProperty(vendorId + ".rest.cron");
String vendorEndpoint = vendorProps.getProperty(vendorId + ".rest.endpoint");
String vendorAuth = vendorProps.getProperty(vendorId + ".rest.auth");
int vendorTimer = Integer.valueOf(vendorId) * 10000;
GsonDataFormat format = new GsonDataFormat(RestResponse.class);
from("quartz2://timer" + vendorId + "?cron=" + vendorCron)
.routeId("Rte-vendor" + vendorId)
.streamCaching()
.log("Starting route " + vendorId)
.setHeader("Authorization",constant(vendorAuth))
.to("rest:get:" + vendorEndpoint)
.to("direct:processRestResponse")
.end();
};
});
return "direct:myRoute." + vendorId;
and a sample 'vendorCron' string is一个示例“vendorCron”字符串是
"*+5+*+*+*+?&trigger.timeZone=America/New_York".
When the quartz route fires I see this type of output in the log当石英路由触发时,我在日志中看到这种类型的输出
15:39| INFO | CamelLogger.java 159 | Starting route 4
15:39| INFO | CamelLogger.java 159 | Starting route 4
15:39| INFO | CamelLogger.java 159 | Starting route 4
15:39| INFO | CamelLogger.java 159 | Starting route 4
15:39| INFO | CamelLogger.java 159 | Starting route 4
15:39| INFO | CamelLogger.java 159 | Starting route 4
15:39| INFO | CamelLogger.java 159 | Starting route 4
15:39| INFO | CamelLogger.java 159 | Starting route 4
15:39| INFO | CamelLogger.java 159 | Starting route 4
15:39| INFO | CamelLogger.java 159 | Starting route 4
When I should ( and used to) only see one of these.当我应该(并且曾经)只看到其中之一时。
Any ideas what would cause this?有什么想法会导致这种情况吗?
Thanks!谢谢!
This is because of your vendorCron
这是因为你的vendorCron
I was staring so hard I missed the obvious.我盯着看太难了,以至于错过了显而易见的东西。 I need a 0 in the seconds place of the cron expression.我需要在 cron 表达式的秒数处有一个 0。
Thank you for the time.谢谢你的时间。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.