mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-14 20:22:07 +08:00
优化etcd监听节点变化实现
This commit is contained in:
@@ -57,17 +57,7 @@ public class EtcdXmlELParser extends ClassXmlFlowELParser {
|
||||
|
||||
try {
|
||||
String content = etcdParserHelper.getContent();
|
||||
|
||||
Consumer<String> listenerConsumer = t -> {
|
||||
try {
|
||||
parse(t);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
};
|
||||
|
||||
etcdParserHelper.listen(listenerConsumer);
|
||||
|
||||
etcdParserHelper.listen();
|
||||
return content;
|
||||
} catch (Exception e){
|
||||
throw new EtcdException(e.getMessage());
|
||||
|
||||
@@ -145,7 +145,7 @@ public class EtcdParserHelper {
|
||||
/**
|
||||
* 监听 etcd 节点
|
||||
*/
|
||||
public void listen(Consumer<String> parseConsumer) {
|
||||
public void listen() {
|
||||
this.client.watchChildChange(this.etcdParserVO.getChainPath(), (updatePath, updateValue) -> {
|
||||
LOG.info("starting reload flow config... update path={} value={},", updatePath, updateValue);
|
||||
String chainName = updatePath.replace(this.etcdParserVO.getChainPath() + SEPARATOR, "");
|
||||
|
||||
Reference in New Issue
Block a user