public class DefaultPublisherFactory extends Object implements PublisherFactory
PublisherFactory
implementation.
Creates Publisher
s for topics. Use CachingPublisherFactory
to cache them.
Constructor and Description |
---|
DefaultPublisherFactory(GcpProjectIdProvider projectIdProvider)
Create
DefaultPublisherFactory instance based on the provided GcpProjectIdProvider . |
Modifier and Type | Method and Description |
---|---|
com.google.cloud.pubsub.v1.Publisher |
createPublisher(String topic)
Creates a
Publisher for a given topic. |
void |
setBatchingSettings(com.google.api.gax.batching.BatchingSettings batchingSettings)
Set the API call batching configuration.
|
void |
setChannelProvider(com.google.api.gax.rpc.TransportChannelProvider channelProvider)
Set the provider for the channel to be used by the publisher.
|
void |
setCredentialsProvider(com.google.api.gax.core.CredentialsProvider credentialsProvider)
Set the provider for the GCP credentials to be used by the publisher on every API calls it
makes.
|
void |
setCustomizers(List<PublisherCustomizer> customizers)
Accepts a list of
Publisher.Builder customizers. |
void |
setEnableMessageOrdering(Boolean enableMessageOrdering)
Set whether message ordering should be enabled on the publisher.
|
void |
setEndpoint(String endpoint)
Set the publisher endpoint.
|
void |
setExecutorProvider(com.google.api.gax.core.ExecutorProvider executorProvider)
Set the provider for the executor that will be used by the publisher.
|
void |
setHeaderProvider(com.google.api.gax.rpc.HeaderProvider headerProvider)
Set the provider for the HTTP headers to be used in the Pub/Sub REST API requests.
|
void |
setRetrySettings(com.google.api.gax.retrying.RetrySettings retrySettings)
Set the API call retry configuration.
|
public DefaultPublisherFactory(GcpProjectIdProvider projectIdProvider)
DefaultPublisherFactory
instance based on the provided GcpProjectIdProvider
.
The GcpProjectIdProvider
must not be null, neither provide an empty projectId
.
projectIdProvider
- provides the default GCP project ID for selecting the topicpublic void setExecutorProvider(com.google.api.gax.core.ExecutorProvider executorProvider)
executorProvider
- the executor provider to setpublic void setChannelProvider(com.google.api.gax.rpc.TransportChannelProvider channelProvider)
channelProvider
- the channel provider to setpublic void setCredentialsProvider(com.google.api.gax.core.CredentialsProvider credentialsProvider)
credentialsProvider
- the credentials provider to setpublic void setHeaderProvider(com.google.api.gax.rpc.HeaderProvider headerProvider)
headerProvider
- the header provider to setpublic void setRetrySettings(com.google.api.gax.retrying.RetrySettings retrySettings)
retrySettings
- the retry settings to setpublic void setBatchingSettings(com.google.api.gax.batching.BatchingSettings batchingSettings)
batchingSettings
- the batching settings to setpublic void setEnableMessageOrdering(Boolean enableMessageOrdering)
enableMessageOrdering
- whether to enable message orderingpublic void setEndpoint(String endpoint)
endpoint
- publisher endpointpublic void setCustomizers(List<PublisherCustomizer> customizers)
Publisher.Builder
customizers.
The customizers are applied in the order provided, so the later customizers can override
any settings provided by the earlier ones.public com.google.cloud.pubsub.v1.Publisher createPublisher(String topic)
Publisher
for a given topic.
Configuration precedence:
spring.cloud.gcp.pubsub.publisher
configuration options
createPublisher
in interface PublisherFactory
topic
- destination topicCopyright © 2024. All rights reserved.