Infinite queries

Hi all,

Is there a way to get an infinite query using influxdb2 reactive client (https://github.com/influxdata/influxdb-client-java/tree/master/client-reactive)?

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 - http://reactivex.io/documentation/operators/repeat.html
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