问题
As I have looked , camel sql-component is not supporting cron expressions
but fixed delays etc. I have checked source code of the component but I could not find an easy way to customize it. Is there any other way to make it or should I extend all component, endpoint , consumer and producer in order to make it?
Thanks
回答1:
See the documentation about polling consumer: http://camel.apache.org/polling-consumer.html at the section further below for scheduled poll consumers.
You can configure to use a different scheduler such as spring/quartz2 that has cron capabilities.
I blogged about how to do this: http://www.davsclaus.com/2013/08/apache-camel-212-even-easier-cron.html but it should work with the sql component also.
回答2:
I second @Neron's comment above. I believe this is a bug in the camel-sql compnent. I am currently using version 2.16.2, but I don't see any changes in a higher version that would have resolved this.
For those interested, you can work around this by creating a subclass of the SQLComponent like this.
public class SQLComponentPatched extends SqlComponent {
@Override
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
Endpoint endpoint = super.createEndpoint(uri, remaining, parameters);
setProperties(endpoint, parameters);
return endpoint;
}
}
来源:https://stackoverflow.com/questions/36937279/camel-sql-component-cron-schedule-customization