public class SchemaRegistryClientBuilder extends Object
SchemaRegistryAsyncClient
and
SchemaRegistryClient
. To build the client, the builder requires the service endpoint of the Schema Registry
and an Azure AD credential.
Instantiating the client
// AAD credential to authorize with Schema Registry service. DefaultAzureCredential azureCredential = new DefaultAzureCredentialBuilder() .build(); SchemaRegistryClient client = new SchemaRegistryClientBuilder() .fullyQualifiedNamespace("https://<your-schema-registry-endpoint>.servicebus.windows.net") .credential(azureCredential) .buildClient();
Instantiating the async client
// AAD credential to authorize with Schema Registry service. DefaultAzureCredential azureCredential = new DefaultAzureCredentialBuilder() .build(); SchemaRegistryAsyncClient client = new SchemaRegistryClientBuilder() .fullyQualifiedNamespace("https://<your-schema-registry-endpoint>.servicebus.windows.net") .credential(azureCredential) .buildAsyncClient();
Instantiating with custom retry policy and HTTP log options
DefaultAzureCredential azureCredential = new DefaultAzureCredentialBuilder() .build(); HttpLogOptions httpLogOptions = new HttpLogOptions() .setLogLevel(HttpLogDetailLevel.BODY) .setPrettyPrintBody(true); RetryPolicy retryPolicy = new RetryPolicy(new FixedDelay(5, Duration.ofSeconds(30))); SchemaRegistryAsyncClient client = new SchemaRegistryClientBuilder() .fullyQualifiedNamespace("https://<your-schema-registry-endpoint>.servicebus.windows.net") .httpLogOptions(httpLogOptions) .retryPolicy(retryPolicy) .credential(azureCredential) .buildAsyncClient();
Constructor and Description |
---|
SchemaRegistryClientBuilder()
Constructor for CachedSchemaRegistryClientBuilder.
|
Modifier and Type | Method and Description |
---|---|
SchemaRegistryClientBuilder |
addPolicy(com.azure.core.http.policy.HttpPipelinePolicy policy)
Adds a policy to the set of existing policies that are executed after required policies.
|
SchemaRegistryAsyncClient |
buildAsyncClient()
Creates a
SchemaRegistryAsyncClient based on options set in the builder. |
SchemaRegistryClient |
buildClient()
Creates synchronous
SchemaRegistryClient instance. |
SchemaRegistryClientBuilder |
clientOptions(com.azure.core.util.ClientOptions clientOptions)
Sets the
ClientOptions which enables various options to be set on the client. |
SchemaRegistryClientBuilder |
configuration(com.azure.core.util.Configuration configuration)
Sets the configuration store that is used during construction of the service client.
|
SchemaRegistryClientBuilder |
credential(com.azure.core.credential.TokenCredential credential)
Sets the
TokenCredential to use when authenticating HTTP requests for this SchemaRegistryAsyncClient . |
SchemaRegistryClientBuilder |
fullyQualifiedNamespace(String fullyQualifiedNamespace)
Sets the fully qualified namespace for the Azure Schema Registry instance.
|
SchemaRegistryClientBuilder |
httpClient(com.azure.core.http.HttpClient httpClient)
Sets the HTTP client to use for sending and receiving requests to and from the service.
|
SchemaRegistryClientBuilder |
httpLogOptions(com.azure.core.http.policy.HttpLogOptions logOptions)
Sets the logging configuration for HTTP requests and responses.
|
SchemaRegistryClientBuilder |
pipeline(com.azure.core.http.HttpPipeline httpPipeline)
Sets the HTTP pipeline to use for the service client.
|
SchemaRegistryClientBuilder |
retryPolicy(com.azure.core.http.policy.RetryPolicy retryPolicy)
Sets the
RetryPolicy that is used when each request is sent. |
SchemaRegistryClientBuilder |
serviceVersion(com.azure.core.util.ServiceVersion serviceVersion)
Sets the service version to use.
|
public SchemaRegistryClientBuilder()
public SchemaRegistryClientBuilder fullyQualifiedNamespace(String fullyQualifiedNamespace)
fullyQualifiedNamespace
- The fully qualified namespace of the Azure Schema Registry instance.SchemaRegistryClientBuilder
object.NullPointerException
- if fullyQualifiedNamespace
is nullIllegalArgumentException
- if fullyQualifiedNamespace
cannot be parsed into a valid URLpublic SchemaRegistryClientBuilder httpClient(com.azure.core.http.HttpClient httpClient)
httpClient
- The HTTP client to use for requests.SchemaRegistryClientBuilder
object.public SchemaRegistryClientBuilder pipeline(com.azure.core.http.HttpPipeline httpPipeline)
If pipeline
is set, all other HTTP settings are ignored to build SchemaRegistryAsyncClient
.
httpPipeline
- The HTTP pipeline to use for sending service requests and receiving responses.SchemaRegistryClientBuilder
object.public SchemaRegistryClientBuilder configuration(com.azure.core.util.Configuration configuration)
global
configuration store
, use Configuration.NONE
to bypass using configuration settings during construction.configuration
- The configuration store used topublic SchemaRegistryClientBuilder credential(com.azure.core.credential.TokenCredential credential)
TokenCredential
to use when authenticating HTTP requests for this SchemaRegistryAsyncClient
.credential
- TokenCredential
SchemaRegistryClientBuilder
object.NullPointerException
- If credential
is null
public SchemaRegistryClientBuilder clientOptions(com.azure.core.util.ClientOptions clientOptions)
ClientOptions
which enables various options to be set on the client. For example setting an
applicationId
using ClientOptions.setApplicationId(String)
to configure the UserAgentPolicy
for telemetry/monitoring purposes.
More About Azure Core: Telemetry policy
clientOptions
- ClientOptions
.public SchemaRegistryClientBuilder httpLogOptions(com.azure.core.http.policy.HttpLogOptions logOptions)
If logLevel is not provided, default value of HttpLogDetailLevel.NONE
is set.
logOptions
- The logging configuration to use when sending and receiving HTTP requests/responses.SchemaRegistryClientBuilder
object.public SchemaRegistryClientBuilder retryPolicy(com.azure.core.http.policy.RetryPolicy retryPolicy)
RetryPolicy
that is used when each request is sent.
The default retry policy will be used if not provided to build SchemaRegistryAsyncClient
.
retryPolicy
- user's retry policy applied to each request.SchemaRegistryClientBuilder
object.public SchemaRegistryClientBuilder serviceVersion(com.azure.core.util.ServiceVersion serviceVersion)
serviceVersion
- Service version.public SchemaRegistryClientBuilder addPolicy(com.azure.core.http.policy.HttpPipelinePolicy policy)
policy
- The retry policy for service requests.SchemaRegistryClientBuilder
object.NullPointerException
- If policy
is null
.public SchemaRegistryAsyncClient buildAsyncClient()
SchemaRegistryAsyncClient
based on options set in the builder. Every time buildClient()
is called a new instance of SchemaRegistryAsyncClient
is created.
If pipeline
is set, then all HTTP pipeline related settings are ignored.SchemaRegistryAsyncClient
with the options set from the builder.NullPointerException
- if fullyQualifiedNamespace
and
credential
are not set.IllegalArgumentException
- if fullyQualifiedNamespace
is an empty
string.public SchemaRegistryClient buildClient()
SchemaRegistryClient
instance. See async builder method for options validation.SchemaRegistryClient
with the options set from the builder.NullPointerException
- if endpoint
and credential
are not set.Visit the Azure for Java Developers site for more Java documentation, including quick starts, tutorials, and code samples.