Class InfluxDBClientFactory

java.lang.Object
com.influxdb.client.InfluxDBClientFactory

public final class InfluxDBClientFactory extends Object
The Factory that create an instance of a InfluxDB 2.x client.
Author:
Jakub Bednar (bednar@github) (05/09/2018 10:04)
  • Method Details

    • create

      @Nonnull public static InfluxDBClient create()
      Create an instance of the InfluxDB 2.x client that is configured via influx2.properties. The influx2.properties has to be located on classpath.
      Returns:
      client
    • create

      @Nonnull public static InfluxDBClient create(@Nonnull String connectionString)
      Create an instance of the InfluxDB 2.x client. The url could be a connection string with various configurations.

      e.g.: "http://localhost:8086?readTimeout=5000&connectTimeout=5000&logLevel=BASIC

      Parameters:
      connectionString - connection string with various configurations.
      Returns:
      client
    • create

      @Nonnull public static InfluxDBClient create(@Nonnull String url, @Nonnull String username, @Nonnull char[] password)
      Create an instance of the InfluxDB 2.x client.

      The username/password auth is based on HTTP "Basic" authentication. The authorization expires when the time-to-live (TTL) (default 60 minutes) is reached and client produces UnauthorizedException.

      The url could be a connection string with various configurations. For more info see: InfluxDBClientOptions.Builder.connectionString(String).

      Parameters:
      url - url the url to connect to InfluxDB (required). Example: http://localhost:8086?readTimeout=5000
      username - the username to use in the basic auth
      password - the password to use in the basic auth
      Returns:
      client
      See Also:
    • create

      @Nonnull public static InfluxDBClient create(@Nonnull String url, @Nonnull char[] token)
      Create an instance of the InfluxDB 2.x client.

      The url could be a connection string with various configurations. For more info see: InfluxDBClientOptions.Builder.connectionString(String).

      Parameters:
      url - url the url to connect to InfluxDB (required). Example: http://localhost:8086?readTimeout=5000
      token - the token to use for the authorization
      Returns:
      client
      See Also:
    • create

      @Nonnull public static InfluxDBClient create(@Nonnull String url, @Nonnull char[] token, @Nullable String org)
      Create an instance of the InfluxDB 2.x client.

      The url could be a connection string with various configurations. For more info see: InfluxDBClientOptions.Builder.connectionString(String).

      Parameters:
      url - url the url to connect to InfluxDB (required). Example: http://localhost:8086?readTimeout=5000
      token - the token to use for the authorization
      org - the name of an organization
      Returns:
      client
      See Also:
    • create

      @Nonnull public static InfluxDBClient create(@Nonnull String url, @Nonnull char[] token, @Nullable String org, @Nullable String bucket)
      Create an instance of the InfluxDB 2.x client.

      The url could be a connection string with various configurations. For more info see: InfluxDBClientOptions.Builder.connectionString(String).

      Parameters:
      url - url the url to connect to InfluxDB (required). Example: http://localhost:8086?readTimeout=5000
      token - the token to use for the authorization
      org - the name of an organization
      bucket - the name of a bucket
      Returns:
      client
      See Also:
    • createV1

      @Nonnull public static InfluxDBClient createV1(@Nonnull String url, @Nullable String username, char[] password, @Nonnull String database, @Nullable String retentionPolicy)
      Create an instance of the InfluxDB 2.x client to connect into InfluxDB 1.8.

      The url could be a connection string with various configurations. For more info see: InfluxDBClientOptions.Builder.connectionString(String).

      Parameters:
      url - the url to connect to InfluxDB 1.8 (required). http://localhost:8086?readTimeout=5000
      username - authorization username
      password - authorization password
      database - database name
      retentionPolicy - retention policy
      Returns:
      client
    • createV1

      @Nonnull public static InfluxDBClient createV1(@Nonnull String url, @Nullable String username, char[] password, @Nonnull String database, @Nullable String retentionPolicy, @Nullable WriteConsistency consistency)
      Create an instance of the InfluxDB 2.x client to connect into InfluxDB 1.8.

      The url could be a connection string with various configurations. For more info see: InfluxDBClientOptions.Builder.connectionString(String).

      Parameters:
      url - the url to connect to InfluxDB 1.8 (required). http://localhost:8086?readTimeout=5000
      username - authorization username
      password - authorization password
      database - database name
      retentionPolicy - retention policy
      consistency - Specify the write consistency for the point. InfluxDB assumes that the write consistency is WriteConsistency.ONE if you do not specify consistency. See the InfluxDB Enterprise documentation for detailed descriptions of each consistency option. Available with InfluxDB Enterprise clusters only!
      Returns:
      client
    • create

      @Nonnull public static InfluxDBClient create(@Nonnull InfluxDBClientOptions options)
      Create an instance of the InfluxDB 2.x client.
      Parameters:
      options - the connection configuration
      Returns:
      client
    • onBoarding

      @Nonnull public static OnboardingResponse onBoarding(@Nonnull String url, @Nonnull String username, @Nonnull String password, @Nonnull String org, @Nonnull String bucket)
      Post onboarding request, to setup initial user, org and bucket.
      Parameters:
      url - the url to connect to the InfluxDB
      username - the name of an user
      password - the password to connect as an user
      org - the name of an organization
      bucket - the name of a bucket
      Returns:
      Created default user, bucket, org.
    • onBoarding

      @Nonnull public static OnboardingResponse onBoarding(@Nonnull String url, @Nonnull OnboardingRequest onboarding)
      Post onboarding request, to setup initial user, org and bucket.
      Parameters:
      url - the url to connect to the InfluxDB
      onboarding - the defaults
      Returns:
      Created default user, bucket, org.