Camel sql component cron schedule customization

久未见 提交于 2020-01-25 12:42:51

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!