ConfigurationClientBuilder Class

Definition

This class provides a fluent builder API to help aid the configuration and instantiation of ConfigurationClient and ConfigurationAsyncClient, call buildClient() and buildAsyncClient() respectively to construct an instance of the desired client.

The client needs the service endpoint of the Azure App Configuration store and access credential. connectionString(String connectionString) gives the builder the service endpoint and access credential.

Instantiating an asynchronous Configuration Client

ConfigurationAsyncClient configurationAsyncClient = new ConfigurationClientBuilder()
     .connectionString(connectionString)
     .buildAsyncClient();

Instantiating a synchronous Configuration Client

ConfigurationClient configurationClient = new ConfigurationClientBuilder()
     .connectionString(connectionString)
     .buildClient();

Another way to construct the client is using a HttpPipeline. The pipeline gives the client an authenticated way to communicate with the service but it doesn't contain the service endpoint. Set the pipeline with pipeline(HttpPipeline pipeline) and set the service endpoint with endpoint(String endpoint). Using a pipeline requires additional setup but allows for finer control on how the ConfigurationClient and ConfigurationAsyncClient is built.

HttpPipeline pipeline = new HttpPipelineBuilder()
     .policies(/* add policies */)
     .build();
 
 ConfigurationClient configurationClient = new ConfigurationClientBuilder()
     .pipeline(pipeline)
     .endpoint("https://myconfig.azure.net/")
     .connectionString(connectionString)
     .buildClient();
public final class ConfigurationClientBuilder
Inheritance
java.lang.Object
ConfigurationClientBuilder

Inherited Members

java.lang.Object.clone() java.lang.Object.equals(java.lang.Object) java.lang.Object.finalize() java.lang.Object.getClass() java.lang.Object.hashCode() java.lang.Object.notify() java.lang.Object.notifyAll() java.lang.Object.toString() java.lang.Object.wait() java.lang.Object.wait(long) java.lang.Object.wait(long,int)

Constructors

ConfigurationClientBuilder()

Constructs a new builder used to configure and build ConfigurationClient and ConfigurationAsyncClient.

Methods

addPolicy(HttpPipelinePolicy policy)

Adds a policy to the set of existing policies.

buildAsyncClient()

Creates a ConfigurationAsyncClient based on options set in the Builder. Every time buildAsyncClient() is called a new instance of ConfigurationAsyncClient is created.

If pipeline(HttpPipeline pipeline) is set, then the pipeline and endpoint(String endpoint) are used to create the ConfigurationAsyncClient. All other builder settings are ignored.

buildClient()

Creates a ConfigurationClient based on options set in the Builder. Every time buildClient() is called a new instance of ConfigurationClient is created.

If pipeline(HttpPipeline pipeline) is set, then the pipeline and endpoint(String endpoint) are used to create the ConfigurationClient. All other builder settings are ignored.

clientOptions(ClientOptions clientOptions)

Sets the ClientOptions which enables various options to be set on the client. For example setting an applicationId using setApplicationId to configure the UserAgentPolicy for telemetry/monitoring purposes.

More About Azure Core: Telemetry policy

configuration(Configuration configuration)

Sets the configuration store that is used during construction of the service client. The default configuration store is a clone of the global configuration store, use NONE to bypass using configuration settings during construction.

connectionString(String connectionString)

Sets the credential to use when authenticating HTTP requests. Also, sets the endpoint(String endpoint) for this ConfigurationClientBuilder.

credential(TokenCredential tokenCredential)

Sets the TokenCredential used to authenticate HTTP requests.

endpoint(String endpoint)

Sets the service endpoint for the Azure App Configuration instance.

httpClient(HttpClient client)

Sets the HTTP client to use for sending and receiving requests to and from the service.

httpLogOptions(HttpLogOptions logOptions)

Sets the logging configuration for HTTP requests and responses.

If logLevel is not provided, default value of HttpLogDetailLevel#NONE is set.

pipeline(HttpPipeline pipeline)

Sets the HTTP pipeline to use for the service client.

If pipeline is set, all other settings are ignored, aside from endpoint(String endpoint) to build ConfigurationAsyncClient or ConfigurationClient.

retryPolicy(HttpPipelinePolicy retryPolicy)

Sets the HttpPipelinePolicy that is used to retry requests.

The default retry policy will be used if not provided buildAsyncClient() to build ConfigurationAsyncClient or ConfigurationClient.

serviceVersion(ConfigurationServiceVersion version)

Sets the ConfigurationServiceVersion that is used when making API requests.

If a service version is not provided, the service version that will be used will be the latest known service version based on the version of the client library being used. If no service version is specified, updating to a newer version the client library will have the result of potentially moving to a newer service version.

Applies to