项目T的环境是springboot2.2+dubbo2.7,部署了6个节点,有一个定时任务只能在1个节点上跑但又要开4个线程进行加速,所以想把定时任务从spring schedule改造为分布式定时任务框架——Elastic-Job
最先引入elasticjob3,但其要求的curator版本是5.2.0,与dubbo2.7的要求curator的版本是2.8.0相冲突
尝试一:dubbo2.7升级到3.0,elasticjob3降级到elastic-job2,curator2.10.0
<dependency>
<groupId>com.github.kuhn-he</groupId>
<artifactId>elastic-job-lite-spring-boot-starter</artifactId>
<version>2.1.53</version>
</dependency>
问题:org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.dangdang.elasticjob.lite.autoconfigure.ElasticJobAutoConfiguration': Invocation of init method failed; nested exception is com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
elastic-job2可能只能在springboot.4下面运行才正常
接下来的尝试思路:dubbo3.0,elasticjob3,curator5.2.0
使用dubbo的扩展机制SPI,自定义Curator5ZookeeperClient
参考:
https://my.oschina.net/roccn/blog/847220
http://git.oschina.net/roccn/roc-dubbo