Interface FluxClient

All Known Implementing Classes:
FluxApiImpl

@ThreadSafe public interface FluxClient
The client that allows perform Flux queries against the InfluxDB /api/v2/query endpoint.
Author:
Jakub Bednar (bednar@github) (01/10/2018 12:17)
  • Method Details

    • query

      @Nonnull List<FluxTable> query(@Nonnull String query)
      Executes the Flux query against the InfluxDB and synchronously map whole response to List<FluxTable>.

      NOTE: This method is not intended for large query results. Use query(String, BiConsumer, Consumer, Runnable) for large data streaming.

      Parameters:
      query - the flux query to execute
      Returns:
      List<FluxTable> which are matched the query
    • query

      @Nonnull <M> List<M> query(@Nonnull String query, @Nonnull Class<M> measurementType)
      Executes the Flux query against the InfluxDB and synchronously map whole response to list of object with given type.

      NOTE: This method is not intended for large query results. Use query(String, Class, BiConsumer, Consumer, Runnable) for large data streaming.

      Parameters:
      query - the flux query to execute
      measurementType - the type of measurement
      Returns:
      List<FluxTable> which are matched the query
    • query

      void query(@Nonnull String query, @Nonnull BiConsumer<Cancellable,FluxRecord> onNext)
      Executes the Flux query against the InfluxDB and asynchronously stream FluxRecords to onNext consumer.
      Parameters:
      query - the flux query to execute
      onNext - the callback to consume the FluxRecord result with capability to discontinue a streaming query
    • query

      <M> void query(@Nonnull String query, @Nonnull Class<M> measurementType, @Nonnull BiConsumer<Cancellable,M> onNext)
      Executes the Flux query against the InfluxDB and asynchronously stream POJO classes to onNext consumer.
      Type Parameters:
      M - the type of the measurement (POJO)
      Parameters:
      query - the flux query to execute
      measurementType - the measurement type (POJO)
      onNext - the callback to consume the FluxRecord result with capability to discontinue a streaming query
    • query

      void query(@Nonnull String query, @Nonnull BiConsumer<Cancellable,FluxRecord> onNext, @Nonnull Consumer<? super Throwable> onError)
      Executes the Flux query against the InfluxDB and asynchronously stream FluxRecords to onNext consumer.
      Parameters:
      query - the flux query to execute
      onNext - the callback to consume FluxRecord result with capability to discontinue a streaming query
      onError - the callback to consume any error notification
    • query

      <M> void query(@Nonnull String query, @Nonnull Class<M> measurementType, @Nonnull BiConsumer<Cancellable,M> onNext, @Nonnull Consumer<? super Throwable> onError)
      Executes the Flux query against the InfluxDB and asynchronously stream POJO classes to onNext consumer.
      Type Parameters:
      M - the type of the measurement (POJO)
      Parameters:
      query - the flux query to execute
      measurementType - the measurement type (POJO)
      onNext - the callback to consume POJO record with capability to discontinue a streaming query
      onError - the callback to consume any error notification
    • query

      void query(@Nonnull String query, @Nonnull BiConsumer<Cancellable,FluxRecord> onNext, @Nonnull Consumer<? super Throwable> onError, @Nonnull Runnable onComplete)
      Executes the Flux query against the InfluxDB and asynchronously stream FluxRecords to onNext consumer.
      Parameters:
      query - the flux query to execute
      onNext - the callback to consume FluxRecord result with capability to discontinue a streaming query
      onError - the callback to consume any error notification
      onComplete - the callback to consume a notification about successfully end of stream
    • query

      <M> void query(@Nonnull String query, @Nonnull Class<M> measurementType, @Nonnull BiConsumer<Cancellable,M> onNext, @Nonnull Consumer<? super Throwable> onError, @Nonnull Runnable onComplete)
      Executes the Flux query and asynchronously stream result as POJO.
      Type Parameters:
      M - the type of the measurement (POJO)
      Parameters:
      query - the flux query to execute
      measurementType - the measurement type (POJO)
      onNext - the callback to consume POJO record with capability to discontinue a streaming query
      onError - the callback to consume any error notification
      onComplete - the callback to consume a notification about successfully end of stream
    • queryRaw

      @Nonnull String queryRaw(@Nonnull String query)
      Executes the Flux query against the InfluxDB and synchronously map whole response to String result.

      NOTE: This method is not intended for large responses, that do not fit into memory. Use queryRaw(String, BiConsumer, Consumer, Runnable) for large data streaming.

      Parameters:
      query - the flux query to execute
      Returns:
      the raw response that matched the query
    • queryRaw

      @Nonnull String queryRaw(@Nonnull String query, @Nullable String dialect)
      Executes the Flux query against the InfluxDB and synchronously map whole response to String result.

      NOTE: This method is not intended for large responses, that do not fit into memory. Use queryRaw(String, String, BiConsumer, Consumer, Runnable) for large data streaming.

      Parameters:
      query - the flux query to execute
      dialect - Dialect is an object defining the options to use when encoding the response. See dialect SPEC..
      Returns:
      the raw response that matched the query
    • queryRaw

      void queryRaw(@Nonnull String query, @Nonnull BiConsumer<Cancellable,String> onResponse)
      Executes the Flux query against the InfluxDB and asynchronously stream response (line by line) to onResponse.
      Parameters:
      query - the flux query to execute
      onResponse - callback to consume the response line by line with capability to discontinue a streaming query
    • queryRaw

      void queryRaw(@Nonnull String query, @Nullable String dialect, @Nonnull BiConsumer<Cancellable,String> onResponse)
      Executes the Flux query against the InfluxDB and asynchronously stream response (line by line) to onResponse.
      Parameters:
      query - the flux query to execute
      dialect - Dialect is an object defining the options to use when encoding the response. See dialect SPEC..
      onResponse - the callback to consume the response line by line with capability to discontinue a streaming query
    • queryRaw

      void queryRaw(@Nonnull String query, @Nonnull BiConsumer<Cancellable,String> onResponse, @Nonnull Consumer<? super Throwable> onError)
      Executes the Flux query against the InfluxDB and asynchronously stream response (line by line) to onResponse.
      Parameters:
      query - the flux query to execute
      onResponse - the callback to consume the response line by line with capability to discontinue a streaming query
      onError - callback to consume any error notification
    • queryRaw

      void queryRaw(@Nonnull String query, @Nullable String dialect, @Nonnull BiConsumer<Cancellable,String> onResponse, @Nonnull Consumer<? super Throwable> onError)
      Executes the Flux query against the InfluxDB and asynchronously stream response (line by line) to onResponse.
      Parameters:
      query - the flux query to execute
      dialect - Dialect is an object defining the options to use when encoding the response. See dialect SPEC..
      onResponse - the callback to consume the response line by line with capability to discontinue a streaming query
      onError - callback to consume any error notification
    • queryRaw

      void queryRaw(@Nonnull String query, @Nonnull BiConsumer<Cancellable,String> onResponse, @Nonnull Consumer<? super Throwable> onError, @Nonnull Runnable onComplete)
      Executes the Flux query against the InfluxDB and asynchronously stream response (line by line) to onResponse.
      Parameters:
      query - the flux query to execute
      onResponse - the callback to consume the response line by line with capability to discontinue a streaming query
      onError - callback to consume any error notification
      onComplete - callback to consume a notification about successfully end of stream
    • queryRaw

      void queryRaw(@Nonnull String query, @Nullable String dialect, @Nonnull BiConsumer<Cancellable,String> onResponse, @Nonnull Consumer<? super Throwable> onError, @Nonnull Runnable onComplete)
      Executes the Flux query against the InfluxDB and asynchronously stream response (line by line) to onResponse.
      Parameters:
      query - the flux query to execute
      dialect - Dialect is an object defining the options to use when encoding the response. See dialect SPEC..
      onResponse - the callback to consume the response line by line with capability to discontinue a streaming query The callback call contains the one line of the response.
      onError - callback to consume any error notification
      onComplete - callback to consume a notification about successfully end of stream
    • ping

      @Nonnull Boolean ping()
      Check the status of InfluxDB Server.
      Returns:
      Boolean.TRUE if server is healthy otherwise return Boolean.FALSE
    • version

      @Nonnull String version()
      Returns the version of the connected InfluxDB Server.
      Returns:
      the version String, otherwise unknown.
    • getLogLevel

      @Nonnull LogLevel getLogLevel()
      Gets the LogLevel that is used for logging requests and responses.
      Returns:
      the LogLevel that is used for logging requests and responses
    • setLogLevel

      @Nonnull FluxClient setLogLevel(@Nonnull LogLevel logLevel)
      Sets the log level for the request and response information.
      Parameters:
      logLevel - the log level to set.
      Returns:
      the FluxClient instance to be able to use it in a fluent manner.
    • close

      void close()
      Shutdown and close the client.