jetcd how watch directory? when put a key-value in this directory ?
ByteSequence SECURITY_CONFIG_PATH = ByteSequence.fromString("/security_config/bizkey/");
ByteSequence SECURITY_CONFIG_PATH_END = ByteSequence.fromString("/security_config/bizkey/1000");
etcdClient.getWatchClient().watch(SECURITY_CONFIG_PATH, WatchOption.newBuilder().withRange(SECURITY_CONFIG_PATH).build(), new Watch.WatchCallback() {
@Override
public void onWatch(Header header, List<WatchEvent> list) {
System.out.println("watcjh:");
for (WatchEvent event: list){
System.out.println("key:"+event.getKeyValue().getKey().toStringUtf8()+",value:"+event.getKeyValue().getValue().toStringUtf8());
}
}
@Override
public void onResuming() {
}
});