public final class WebPubSubServiceClientBuilder extends Object
sync
and async
Azure Web Pub Sub clients, using the
buildClient
and buildAsyncClient
methods respectively.
To fully configure a Azure Web Pub Sub client, it is necessary to supply a
connection string
retrieved from the Azure Portal, or else a combination of
credential
and endpoint
.
An Azure Web Pub Sub client is required to connect to a specific hub
. An exception will be
thrown when the build methods are called if the hub value is null or an empty String.
Code Samples
WebPubSubServiceAsyncClient client = new WebPubSubServiceClientBuilder() .connectionString("<Insert connection string from Azure Portal>") .buildAsyncClient();
This demonstrates using the connection string provided by the Azure Portal. Another approach is to use the combination of credential and endpoint details, as shown below:
WebPubSubServiceAsyncClient client = new WebPubSubServiceClientBuilder() .credential(new AzureKeyCredential("<Insert key from Azure Portal>")) .endpoint("<Insert endpoint from Azure Portal>") .buildAsyncClient();
Of course, synchronous clients may also be instantiated, by calling buildClient
rather than
buildAsyncClient
.
WebPubSubServiceClient client = new WebPubSubServiceClientBuilder() .connectionString("<Insert connection string from Azure Portal>") .buildClient();
Constructor and Description |
---|
WebPubSubServiceClientBuilder()
Creates a new builder instance with all values set to their default value.
|
Modifier and Type | Method and Description |
---|---|
WebPubSubServiceClientBuilder |
addPolicy(com.azure.core.http.policy.HttpPipelinePolicy policy)
Adds a policy to the set of existing policies that are executed after required policies.
|
WebPubSubServiceAsyncClient |
buildAsyncClient()
Builds an instance of WebPubSubAsyncServiceClient with the provided parameters.
|
WebPubSubServiceClient |
buildClient()
Builds an instance of WebPubSubServiceClient with the provided parameters.
|
WebPubSubServiceClientBuilder |
clientOptions(com.azure.core.util.ClientOptions clientOptions)
Sets the
ClientOptions which enables various options to be set on the client. |
WebPubSubServiceClientBuilder |
configuration(com.azure.core.util.Configuration configuration)
Sets the configuration store that is used during construction of the service client.
|
WebPubSubServiceClientBuilder |
connectionString(String connectionString)
Sets the credential to use when authenticating HTTP requests.
|
WebPubSubServiceClientBuilder |
credential(com.azure.core.credential.AzureKeyCredential credential)
Sets the
AzureKeyCredential used to authenticate HTTP requests. |
WebPubSubServiceClientBuilder |
credential(com.azure.core.credential.TokenCredential credential)
Sets the
TokenCredential used to authenticate HTTP requests. |
WebPubSubServiceClientBuilder |
endpoint(String endpoint)
Sets the service endpoint for the Azure Web Pub Sub instance.
|
WebPubSubServiceClientBuilder |
httpClient(com.azure.core.http.HttpClient client)
Sets the HTTP client to use for sending and receiving requests to and from the service.
|
WebPubSubServiceClientBuilder |
httpLogOptions(com.azure.core.http.policy.HttpLogOptions logOptions)
Sets the logging configuration for HTTP requests and responses.
|
WebPubSubServiceClientBuilder |
hub(String hub)
Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or
underscore.
|
WebPubSubServiceClientBuilder |
pipeline(com.azure.core.http.HttpPipeline pipeline)
Sets the HTTP pipeline to use for the service client.
|
WebPubSubServiceClientBuilder |
retryPolicy(com.azure.core.http.policy.RetryPolicy retryPolicy)
Sets the
HttpPipelinePolicy that is used when each request is sent. |
WebPubSubServiceClientBuilder |
reverseProxyEndpoint(String reverseProxyEndpoint)
Sets the reverse proxy endpoint.
|
WebPubSubServiceClientBuilder |
serviceVersion(WebPubSubServiceVersion version)
Sets the
WebPubSubServiceVersion that is used when making API requests. |
public WebPubSubServiceClientBuilder()
public WebPubSubServiceClientBuilder 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
- the ClientOptions
to be set on the client.WebPubSubServiceClientBuilder
object.public WebPubSubServiceClientBuilder connectionString(String connectionString)
connectionString
- Connection string in the format "endpoint={endpoint_value};accesskey={accesskey_value}"WebPubSubServiceClientBuilder
object.NullPointerException
- If connectionString
is null
.public WebPubSubServiceClientBuilder endpoint(String endpoint)
endpoint
- The URL of the Azure Web Pub Sub instance to send service requests to, and receive responses
from.WebPubSubServiceClientBuilder
object.IllegalArgumentException
- if endpoint
is null
.public WebPubSubServiceClientBuilder credential(com.azure.core.credential.AzureKeyCredential credential)
AzureKeyCredential
used to authenticate HTTP requests.credential
- AzureKeyCredential used to authenticate HTTP requests.WebPubSubServiceClientBuilder
object.public WebPubSubServiceClientBuilder credential(com.azure.core.credential.TokenCredential credential)
TokenCredential
used to authenticate HTTP requests.credential
- TokenCredential used to authenticate HTTP requests.WebPubSubServiceClientBuilder
object.public WebPubSubServiceClientBuilder reverseProxyEndpoint(String reverseProxyEndpoint)
reverseProxyEndpoint
- The reverse proxy endpoint.WebPubSubServiceClientBuilder
object.public WebPubSubServiceClientBuilder hub(String hub)
hub
- Target hub name, which should start with alphabetic characters and only contain alpha-numeric
characters or underscore.WebPubSubServiceClientBuilder
object.NullPointerException
- If hub
is null
.public WebPubSubServiceClientBuilder 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.WebPubSubServiceClientBuilder
object.public WebPubSubServiceClientBuilder addPolicy(com.azure.core.http.policy.HttpPipelinePolicy policy)
policy
- The retry policy for service requests.WebPubSubServiceClientBuilder
object.NullPointerException
- If policy
is null
.public WebPubSubServiceClientBuilder httpClient(com.azure.core.http.HttpClient client)
client
- The HTTP client to use for requests.WebPubSubServiceClientBuilder
object.public WebPubSubServiceClientBuilder pipeline(com.azure.core.http.HttpPipeline pipeline)
pipeline
is set, all other settings are ignored, aside from
connectionString
to build WebPubSubServiceAsyncClient
or
WebPubSubServiceClient
.pipeline
- The HTTP pipeline to use for sending service requests and receiving responses.WebPubSubServiceClientBuilder
object.public WebPubSubServiceClientBuilder 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 toWebPubSubServiceClientBuilder
object.public WebPubSubServiceClientBuilder retryPolicy(com.azure.core.http.policy.RetryPolicy retryPolicy)
HttpPipelinePolicy
that is used when each request is sent. The default retry policy will be
used if not provided.retryPolicy
- user's retry policy applied to each request.WebPubSubServiceClientBuilder
object.public WebPubSubServiceClientBuilder serviceVersion(WebPubSubServiceVersion version)
WebPubSubServiceVersion
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.
version
- WebPubSubServiceVersion
of the service to be used when making requests.WebPubSubServiceClientBuilder
object.public WebPubSubServiceAsyncClient buildAsyncClient()
public WebPubSubServiceClient buildClient()
Copyright © 2021 Microsoft Corporation. All rights reserved.