Hi all,
Is there a way to get an infinite query using influxdb2 reactive client (influxdb-client-java/client-reactive at master · influxdata/influxdb-client-java · GitHub)?
I need to start a stream that never ends and at every event, do an action in a thread in backgroud.
Is there a way to do this?
Thank you
Hello @vladbragoi,
Welcome! We don’t have an example for that, but I think it could be done by a repeat
operator - ReactiveX - Repeat operator
Does that help?
If you end up figuring it out, would you mind sharing your code here for other users? If not, let me know if I need to dig deeper.
Thanks!
I wrote something like this:
queryReactiveApi.query(queryString, "myOrg")
.subscribeOn(Schedulers.from(executorService))
.buffer(10)
.repeat()
.subscribe(
records -> { /* doSomethingWith(records)*/ },
System.err::println);
but I was forced to instantiate an executor service in order to make the main thread waiting until the query was running. If you have any suggestion, i’d be happy to implement your solution.
Thank you