How can catch put and delete events with Watch?
See original GitHub issueI made a watch with jetcd 0.5.0, and process event with LoggingWatchListener. but It only call when any event complete, how can do like etcdctl:
Here is my code:
public void keepWatch(String key){
if (watchMap.containsKey(key)==false) {
Watch watch = etcdClient.getWatchClient();
ByteSequence keyBS = ByteSequence.from(key, StandardCharsets.UTF_8);
Watch.Watcher watcher=watch.watch(
keyBS,
WatchOption.DEFAULT,
new LoggingWatchListener());
log.debug("watch on key[{}]",key);
}
else{
log.debug("we had watched on key[{}]",key);
}
}
class LoggingWatchListener implements Watch.Listener {
@Override
public void onNext(WatchResponse response) {
log.info("watch[listener] - nextEvent");
for(WatchEvent event:response.getEvents()){
log.debug("watch[listener] - nextEvent - type:{}, KV:{}, PreKV:{}",
event.getEventType(),event.getKeyValue(),event.getPrevKV()
);
}
}
@Override
public void onError(Throwable throwable) {
log.error("watch[listener] - errorEvent - something wrong: {}",throwable.getMessage(),throwable);
}
@Override
public void onCompleted() {
log.debug("watch[listener] - completedEvent");
}
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:14
Top Results From Across the Web
Check and update your calendar on Apple Watch
Delete an event you created: Tap an event, tap Delete, then tap Delete again. If this is a recurring event, you can delete...
Read more >How To Delete Calendar Events On iPhone - YouTube
0:00 Intro0:07 Deleting calendar events0:38 Deleting recurring event0:43 Deleting singular eventIn this video, we will show you how to ...
Read more >Delete Multiple Events at Once on Google Calendar - YouTube
How to bulk delete multiple events at once on Google Calendar. Deleting recurring events is easy and bulk deleting single events is possible ......
Read more >Unable to delete a calendar event on Galaxy phone or tablet
Open the Calendar app, and tap the repeating event. Tap Delete, and then tap All events in series. Related ...
Read more >Kubernetes API Concepts
Clients can send a list or a get and then make a follow-up watch request. ... the Kubernetes API provides a watch event...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I translated groove to java class, this doesn’t work for me.
logging output without any listener’s event:
etcd server output:
Btw, which etcdServer version are your? I tried 3.3.25 and 3.4.13.
I have the same issue. I tried to put and get values and it works well, but Watch doesnt works - Watch.Listener doesn’t fires when I put a value. I use 0.5.0 version. P.S. Also tried to add Watch and test it using etcdctl tool on the same server - works fine.