Skip to content

Instantly share code, notes, and snippets.

@mseemann
Created September 3, 2021 15:03
Show Gist options
  • Save mseemann/9be889af256a37952dec0b185a3c9279 to your computer and use it in GitHub Desktop.
Save mseemann/9be889af256a37952dec0b185a3c9279 to your computer and use it in GitHub Desktop.
MongoStats
Query tailQ = new Query().addCriteria(Criteria.where("ns").is("streams.user"));
reactiveMongoTemplate.tail(tailQ, OplogEntry.class, "oplog.rs")
.retryWhen(Retry.indefinitely().doAfterRetryAsync(signal -> Mono.delay(Duration.ofSeconds(10)).then()))
.subscribe(entry -> {
log.info("tailed entry: {}", entry);
lastOplogAt.set(entry.ts().getTime() * 1000L);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment