Class FluxApiImpl

All Implemented Interfaces:
FluxClient

public class FluxApiImpl extends AbstractQueryApi implements FluxClient
Author:
Jakub Bednar (bednar@github) (03/10/2018 14:20)
  • Constructor Details

  • Method Details

    • query

      @Nonnull public List<FluxTable> query(@Nonnull String query)
      Description copied from interface: FluxClient
      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 FluxClient.query(String, BiConsumer, Consumer, Runnable) for large data streaming.

      Specified by:
      query in interface FluxClient
      Parameters:
      query - the flux query to execute
      Returns:
      List<FluxTable> which are matched the query
    • query

      @Nonnull public <M> List<M> query(@Nonnull String query, @Nonnull Class<M> measurementType)
      Description copied from interface: FluxClient
      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 FluxClient.query(String, Class, BiConsumer, Consumer, Runnable) for large data streaming.

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

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

      public <M> void query(@Nonnull String query, @Nonnull Class<M> measurementType, @Nonnull BiConsumer<Cancellable,M> onNext)
      Description copied from interface: FluxClient
      Executes the Flux query against the InfluxDB and asynchronously stream POJO classes to onNext consumer.
      Specified by:
      query in interface FluxClient
      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

      public void query(@Nonnull String query, @Nonnull BiConsumer<Cancellable,FluxRecord> onNext, @Nonnull Consumer<? super Throwable> onError)
      Description copied from interface: FluxClient
      Executes the Flux query against the InfluxDB and asynchronously stream FluxRecords to onNext consumer.
      Specified by:
      query in interface FluxClient
      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

      public <M> void query(@Nonnull String query, @Nonnull Class<M> measurementType, @Nonnull BiConsumer<Cancellable,M> onNext, @Nonnull Consumer<? super Throwable> onError)
      Description copied from interface: FluxClient
      Executes the Flux query against the InfluxDB and asynchronously stream POJO classes to onNext consumer.
      Specified by:
      query in interface FluxClient
      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

      public void query(@Nonnull String query, @Nonnull BiConsumer<Cancellable,FluxRecord> onNext, @Nonnull Consumer<? super Throwable> onError, @Nonnull Runnable onComplete)
      Description copied from interface: FluxClient
      Executes the Flux query against the InfluxDB and asynchronously stream FluxRecords to onNext consumer.
      Specified by:
      query in interface FluxClient
      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

      public <M> void query(@Nonnull String query, @Nonnull Class<M> measurementType, @Nonnull BiConsumer<Cancellable,M> onNext, @Nonnull Consumer<? super Throwable> onError, @Nonnull Runnable onComplete)
      Description copied from interface: FluxClient
      Executes the Flux query and asynchronously stream result as POJO.
      Specified by:
      query in interface FluxClient
      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 public String queryRaw(@Nonnull String query)
      Description copied from interface: FluxClient
      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 FluxClient.queryRaw(String, BiConsumer, Consumer, Runnable) for large data streaming.

      Specified by:
      queryRaw in interface FluxClient
      Parameters:
      query - the flux query to execute
      Returns:
      the raw response that matched the query
    • queryRaw

      @Nonnull public String queryRaw(@Nonnull String query, @Nullable String dialect)
      Description copied from interface: FluxClient
      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 FluxClient.queryRaw(String, String, BiConsumer, Consumer, Runnable) for large data streaming.

      Specified by:
      queryRaw in interface FluxClient
      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

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

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

      public void queryRaw(@Nonnull String query, @Nonnull BiConsumer<Cancellable,String> onResponse, @Nonnull Consumer<? super Throwable> onError)
      Description copied from interface: FluxClient
      Executes the Flux query against the InfluxDB and asynchronously stream response (line by line) to onResponse.
      Specified by:
      queryRaw in interface FluxClient
      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

      public void queryRaw(@Nonnull String query, @Nullable String dialect, @Nonnull BiConsumer<Cancellable,String> onResponse, @Nonnull Consumer<? super Throwable> onError)
      Description copied from interface: FluxClient
      Executes the Flux query against the InfluxDB and asynchronously stream response (line by line) to onResponse.
      Specified by:
      queryRaw in interface FluxClient
      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

      public void queryRaw(@Nonnull String query, @Nonnull BiConsumer<Cancellable,String> onResponse, @Nonnull Consumer<? super Throwable> onError, @Nonnull Runnable onComplete)
      Description copied from interface: FluxClient
      Executes the Flux query against the InfluxDB and asynchronously stream response (line by line) to onResponse.
      Specified by:
      queryRaw in interface FluxClient
      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

      public void queryRaw(@Nonnull String query, @Nullable String dialect, @Nonnull BiConsumer<Cancellable,String> onResponse, @Nonnull Consumer<? super Throwable> onError, @Nonnull Runnable onComplete)
      Description copied from interface: FluxClient
      Executes the Flux query against the InfluxDB and asynchronously stream response (line by line) to onResponse.
      Specified by:
      queryRaw in interface FluxClient
      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 public Boolean ping()
      Description copied from interface: FluxClient
      Check the status of InfluxDB Server.
      Specified by:
      ping in interface FluxClient
      Returns:
      Boolean.TRUE if server is healthy otherwise return Boolean.FALSE
    • version

      @Nonnull public String version()
      Description copied from interface: FluxClient
      Returns the version of the connected InfluxDB Server.
      Specified by:
      version in interface FluxClient
      Returns:
      the version String, otherwise unknown.
    • getLogLevel

      @Nonnull public LogLevel getLogLevel()
      Description copied from interface: FluxClient
      Gets the LogLevel that is used for logging requests and responses.
      Specified by:
      getLogLevel in interface FluxClient
      Returns:
      the LogLevel that is used for logging requests and responses
    • setLogLevel

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

      public void close()
      Closes the client, initiates shutdown, no new running calls are accepted during shutdown.
      Specified by:
      close in interface FluxClient