Class ConfluentSettings.Builder
- Enclosing class:
- ConfluentSettings
EnvironmentSettings.-
Method Summary
Modifier and TypeMethodDescriptionApplies configuration from CLI arguments on top of the current builder state.build()Creates Confluent-specificEnvironmentSettingsthat can be passed intoTableEnvironment.create(EnvironmentSettings).setApplicationName(String name) Sets a name for this Table API application.setArtifactApiKey(String key) Sets the API key for Artifacts creation.setArtifactApiSecret(String secret) Sets the API secret for Artifacts creation.setArtifactEndpointTemplate(String artifactEndpointTemplate) Sets the template for the artifact endpoint URL.setAuthMode(AuthMode authMode) Sets the authentication mode for the Confluent Cloud REST APIs.setCatalogCache(Duration expiration) Sets the expiration time for catalog objects before Confluent Cloud is called again.Sets the Confluent identifier for a cloud provider.setComputePoolId(String computePoolId) Sets the ID of the compute pool.setEndpointTemplate(String endpointTemplate) Sets the template for the endpoint URL.setEnvironmentId(String envId) Sets the ID of the environment.setFlinkApiKey(String key) Sets the API key for Flink access.setFlinkApiSecret(String secret) Sets the API secret for Flink access.setGlobalApiKey(String key) Sets the global API key used for both Flink and Artifact access.setGlobalApiSecret(String secret) Sets the global API secret used for both Flink and Artifact access.setHttpUserAgent(String userAgent) Sets the HTTP User-Agent for API requests.setOAuthExternalAccessToken(String accessToken) Sets a pre-issued OAuth bearer token.setOAuthExternalClientId(String clientId) Sets the client ID registered with the external IdP.setOAuthExternalClientSecret(String clientSecret) Sets the client secret registered with the external IdP.setOAuthExternalTokenScope(String scope) Sets the OAuth scope to request from the IdP.setOAuthExternalTokenUrl(String tokenUrl) Sets the URL of the external IdP's OAuth 2.0 token endpoint.setOAuthIdentityPoolId(String identityPoolId) Sets the Confluent Cloud identity pool ID.setOAuthTokenProvider(OAuthTokenProvider provider) Registers a programmatic OAuth token provider for cloud-native identity flows (Azure Managed Identity, AWS IAM workload identity, custom token services).setOnConflict(OnConflictMode mode) Sets the behavior when a statement could not be updated, due to a conflict.Sets a Confluent-specific configuration option.setOrganizationId(String orgId) Sets the ID of the organization.setPrincipalId(String principalId) Sets the Principal that runs submitted statements.Sets the Confluent identifier for a cloud provider's region.setRestEndpoint(String endpoint) Sets the URL to the REST endpoint.setStatementName(String name) Sets the statement name for statement submission.Sets the directory for temporary files, e.g.
-
Method Details
-
applyArgs
Applies configuration from CLI arguments on top of the current builder state.Unlike
ConfluentSettings.newBuilderFromArgs(String[]), which only applies theConfluentPluginOptions.VAR_FLINK_PROPERTIESenvironment variable as a fallback before parsing args, this method lets a program layer arguments onto any existing builder. A program can therefore combine a base configuration (for example loaded viaConfluentSettings.newBuilderFromResource(String),ConfluentSettings.newBuilderFromFile(File), or explicit setters) with per-invocation arguments:EnvironmentSettings settings = ConfluentSettings.newBuilder() // FLINK_PROPERTIES file + env-var fallback .setApplicationName("my-table-program") // code default, overridable by --application-name .applyArgs(args) // per-invocation overrides + actions .build();Only the keys present in
argsare written; absent keys leave any previously configured value untouched. Because parsing writes into the sameConfigurationas the builder setters, arguments follow last-writer-wins semantics: values applied here override earlier builder state, and later builder calls override these.The parsed options are those listed in
ConfluentPluginOptions.ARG_OPTIONS. APluginActionpassed as the leading argument (for examplestop) is recorded and dispatched whenbuild()is called.- Parameters:
args- themain(String[] args)arguments- Returns:
- this builder
-
setApplicationName
Sets a name for this Table API application. Optional but recommended.The application name serves as a namespace for all statements submitted by this application. It will be used as a prefix for all statement names, whether auto-generated or explicitly set via
ConfluentTools.setStatementName(TableEnvironment, String).Behavior:
- Auto-generated statement names:
"{applicationName}-{uuid}" - Explicit statement names:
"{applicationName}-{statementName}"
If you do not set an application name:
- Auto-generated statement names will use:
"table-api-{date}-{uuid}" - Explicit statement names will be used as-is (fully qualified)
Naming constraints:
- Must contain only lowercase alphanumeric characters and hyphens
- Must start and end with an alphanumeric character (not a hyphen)
- Because it prefixes statement names, the effective usable length must be smaller to keep the full statement name within the 100-character limit.
For example:
"my-table-program".- Parameters:
name- the application name- Returns:
- this builder
- Auto-generated statement names:
-
setOrganizationId
Sets the ID of the organization. Required.For example: 'b0b21724-4586-4a07-b787-d0bb5aacbf87'.
Overrides the global variable ORG_ID.
-
setEnvironmentId
Sets the ID of the environment. Required.For example: 'env-z3y2x1'.
Overrides the global variable ENV_ID.
-
setFlinkApiKey
Sets the API key for Flink access. Required.Overrides global variable FLINK_API_KEY.
-
setFlinkApiSecret
Sets the API secret for Flink access. Required.Overrides global variable FLINK_API_SECRET.
-
setArtifactApiKey
Sets the API key for Artifacts creation. Optional.Overrides global variable ARTIFACT_API_KEY.
-
setArtifactApiSecret
Sets the API secret for Artifacts creation. Optional.Overrides global variable ARTIFACT_API_SECRET.
-
setGlobalApiKey
Sets the global API key used for both Flink and Artifact access. Optional.When set together with
setGlobalApiSecret(java.lang.String), it takes precedence over the dedicated Flink and Artifact API keys.Overrides global variable GLOBAL_API_KEY.
-
setGlobalApiSecret
Sets the global API secret used for both Flink and Artifact access. Optional.When set together with
setGlobalApiKey(java.lang.String), it takes precedence over the dedicated Flink and Artifact API secrets.Overrides global variable GLOBAL_API_SECRET.
-
setTemporaryDirectory
Sets the directory for temporary files, e.g. UDF jars. Optional. -
setHttpUserAgent
Sets the HTTP User-Agent for API requests. Optional.If not set, a default User-Agent will be used based on the package name and version.
Overrides global variable HTTP_USER_AGENT.
-
setComputePoolId
Sets the ID of the compute pool. Required.For example: 'lfcp-8m03rm'.
Overrides global variable COMPUTE_POOL_ID.
-
setCloud
Sets the Confluent identifier for a cloud provider. Required.For example: 'aws'.
Overrides the global variable CLOUD_PROVIDER.
-
setRegion
Sets the Confluent identifier for a cloud provider's region. Required.For example: 'us-east-1'.
Overrides the global variable CLOUD_REGION.
-
setPrincipalId
Sets the Principal that runs submitted statements. Optional.For example: 'sa-23kgz4' (for a service account).
Overrides the global variable PRINCIPAL_ID.
-
setRestEndpoint
Sets the URL to the REST endpoint. Optional.For example: 'confluent.cloud'.
Overrides the global variable REST_ENDPOINT.
-
setEndpointTemplate
Sets the template for the endpoint URL. Optional.For example: 'https://flinkpls-abc123.{region}.{cloud}.glb.confluent.cloud'.
The template may contain the placeholders {region} and {cloud}. The placeholders will be replaced with the values of the variable CLOUD_REGION and CLOUD_PROVIDER respectively.
Default value is 'https://flink.{region}.{cloud}.confluent.cloud'.
Overrides the global variable ENDPOINT_TEMPLATE.
-
setArtifactEndpointTemplate
Sets the template for the artifact endpoint URL. Optional.For example: 'https://api.{region}.{cloud}.confluent.cloud'.
The template may contain the placeholders {region} and {cloud}. The placeholders will be replaced with the values of the variable CLOUD_REGION and CLOUD_PROVIDER respectively.
Default value is 'https://api.confluent.cloud'.
Overrides the global variable ARTIFACT_ENDPOINT_TEMPLATE.
-
setCatalogCache
Sets the expiration time for catalog objects before Confluent Cloud is called again. Optional.For example: '5 min'. '1 min' by default. '0' disables the caching.
-
setAuthMode
Sets the authentication mode for the Confluent Cloud REST APIs. Optional, defaults toAuthMode.API_KEY.UDF artifact uploads additionally require either a global API key (
setGlobalApiKey(java.lang.String),setGlobalApiSecret(java.lang.String)) or a dedicated Artifact API key (setArtifactApiKey(java.lang.String),setArtifactApiSecret(java.lang.String)). A global API key, when set, takes precedence over the dedicated Flink and Artifact API keys.Overrides the global variable AUTH_MODE.
-
setOAuthExternalTokenUrl
Sets the URL of the external IdP's OAuth 2.0 token endpoint. Required whenauth-mode=OAUTH_CLIENT_CREDENTIALS.For example: 'https://mycompany.okta.com/oauth2/abc123/v1/token'.
Overrides the global variable OAUTH_EXTERNAL_TOKEN_URL.
-
setOAuthExternalClientId
Sets the client ID registered with the external IdP. Required whenauth-mode=OAUTH_CLIENT_CREDENTIALS.Overrides the global variable OAUTH_EXTERNAL_CLIENT_ID.
-
setOAuthExternalClientSecret
Sets the client secret registered with the external IdP. Required whenauth-mode=OAUTH_CLIENT_CREDENTIALS.Treated as sensitive: the plugin never logs this value.
Overrides the global variable OAUTH_EXTERNAL_CLIENT_SECRET.
-
setOAuthExternalTokenScope
Sets the OAuth scope to request from the IdP. Optional and IdP-dependent.Microsoft Entra ID typically requires
api://<client_id>/.default. Okta does not require any scope. Used whenauth-mode=OAUTH_CLIENT_CREDENTIALS.Overrides the global variable OAUTH_EXTERNAL_TOKEN_SCOPE.
-
setOAuthExternalAccessToken
Sets a pre-issued OAuth bearer token. Used whenauth-mode=OAUTH_STATIC_TOKEN.The user is responsible for ensuring the token is not expired; the plugin does not refresh it. Mutually exclusive with
setOAuthTokenProvider(io.confluent.flink.plugin.OAuthTokenProvider).Overrides the global variable OAUTH_EXTERNAL_ACCESS_TOKEN.
-
setOAuthIdentityPoolId
Sets the Confluent Cloud identity pool ID. Used whenauth-mode=OAUTH_STATIC_TOKENorauth-mode=OAUTH_CLIENT_CREDENTIALSFor example: 'pool-xxxxx'. The plugin sends this on every Flink SQL request as the
Confluent-Identity-Pool-Idheader.Overrides the global variable OAUTH_IDENTITY_POOL_ID.
-
setOAuthTokenProvider
Registers a programmatic OAuth token provider for cloud-native identity flows (Azure Managed Identity, AWS IAM workload identity, custom token services).Requires
setAuthMode(io.confluent.flink.plugin.AuthMode)withAuthMode.OAUTH_STATIC_TOKENon the same builder. -
setStatementName
Sets the statement name for statement submission.A statement name must be unique within an environment and cloud region for a given organization. By default, statement names are auto-generated using a UUID.
Important: If you configured an application name via
setApplicationName(String), it will be automatically prefixed to the statement name you provide here. For example, if your application name is"myapp"and you set the statement name to"query1", the final statement name will be"myapp-query1".If you did not configure an application name and use this method to set an explicit statement name, the statement name you provide will be used as-is (fully qualified).
First submission only: When set via
ConfluentSettings, the statement name applies only to the first statement submitted on the resultingTableEnvironment; it is automatically reset afterward, and subsequent submissions auto-generate a unique name. To simply run multiple statements without managing names, configure an application name viasetApplicationName(String)instead, which namespaces every statement's auto-generated name. When a specific statement needs a stable name to be stopped, resumed, or replaced across runs, useConfluentTools.setStatementName(TableEnvironment, String)before each such submission.Naming constraints:
- Must contain only lowercase alphanumeric characters and hyphens
- Must start and end with an alphanumeric character (not a hyphen)
- Maximum length: 100 characters (including the application name prefix if configured)
- Parameters:
name- the statement name (will be prefixed with application name if configured)- Returns:
- this builder
-
setOnConflict
Sets the behavior when a statement could not be updated, due to a conflict. Optional, defaults toOnConflictMode.FAIL.With
OnConflictMode.REPLACE, on a conflict during statement submission, the plugin deletes the conflicting statement and retries the submission once. Requires an application name to be configured viasetApplicationName(String)so that statement names are stable across runs. -
setOption
Sets a Confluent-specific configuration option.Note: This method does not support Flink options. Check the documentation for more information.
-
build
Creates Confluent-specificEnvironmentSettingsthat can be passed intoTableEnvironment.create(EnvironmentSettings).
-