You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can fork a Watcher and use it to get notified only when the specific part of the file is changed.
CentralDogmaclient = ...
// watcher is get notified when "ab.json" file is changed.Watcher<JsonNode> watcher = client.fileWatcher("myProject", "myRepo",
Query.ofJson("/ab.json"));
// aChild is get notified only when the property "/a" is changed.Watcher<String> aChild = watcher.newChild(jsonNode -> jsonNode.at("/a").asText());
aChild.watch((rev, a) -> {
// This will be triggered if '/a' is changed.
});
// bChild is get notified only when the property "/a" is changed.Watcher<String> bChild = watcher.newChild(jsonNode -> jsonNode.at("/b").asText());
bChild.watch((rev, b) -> {
// This will be triggered if '/b' is changed.
});
You can make separate Watchers to achieve the same behavior.
Watcher<String> aWatcher = client.fileWatcher("myProject", "myRepo",
Query.ofJsonPath("/ab.json", "$.a"));
aWatcher.watch((rev, a) -> {
// This will be triggered if '/a' is changed.
});
Watcher<String> bWatcher = client.fileWatcher("myProject", "myRepo",
Query.ofJsonPath("/ab.json", "$.b"));
bWatcher.watch((rev, b) -> {
// This will be triggered if '/b' is changed.
});
However, these Watchers make separate watch requests to the server meanwhile the previous example makes only one watch request and notifies according to the Function.
Bug fix
You will get 204 No Content when attempting to get the directory content. #414#442