Package com.google.cloud.pubsub.v1
Class Publisher.Builder
- java.lang.Object
-
- com.google.cloud.pubsub.v1.Publisher.Builder
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Publisherbuild()static com.google.api.gax.batching.BatchingSettingsgetDefaultBatchingSettings()Returns the default BatchingSettings used by the client if settings are not provided.Publisher.BuildersetBatchingSettings(com.google.api.gax.batching.BatchingSettings batchingSettings)Publisher.BuildersetChannelProvider(com.google.api.gax.rpc.TransportChannelProvider channelProvider)ChannelProviderto use to create Channels, which must point at Cloud Pub/Sub endpoint.Publisher.BuildersetCompressionBytesThreshold(long compressionBytesThreshold)Sets the threshold (in bytes) above which messages are compressed for transport.Publisher.BuildersetCredentialsProvider(com.google.api.gax.core.CredentialsProvider credentialsProvider)CredentialsProviderto use to create Credentials to authenticate calls.Publisher.BuildersetEnableCompression(boolean enableCompression)Gives the ability to enable transport compression.Publisher.BuildersetEnableMessageOrdering(boolean enableMessageOrdering)Sets the message ordering option.Publisher.BuildersetEndpoint(String endpoint)Gives the ability to override the gRPC endpoint.Publisher.BuildersetExecutorProvider(com.google.api.gax.core.ExecutorProvider executorProvider)Gives the ability to set a custom executor to be used by the library.Publisher.BuildersetHeaderProvider(com.google.api.gax.rpc.HeaderProvider headerProvider)Sets the static header provider.Publisher.BuildersetRetrySettings(com.google.api.gax.retrying.RetrySettings retrySettings)Configures the Publisher's retry parameters.Publisher.BuildersetTransform(com.google.api.core.ApiFunction<PubsubMessage,PubsubMessage> messageTransform)Gives the ability to set anApiFunctionthat will transform thePubsubMessagebefore it is sent
-
-
-
Method Detail
-
setChannelProvider
public Publisher.Builder setChannelProvider(com.google.api.gax.rpc.TransportChannelProvider channelProvider)
ChannelProviderto use to create Channels, which must point at Cloud Pub/Sub endpoint.For performance, this client benefits from having multiple underlying connections. See
InstantiatingGrpcChannelProvider.Builder.setPoolSize(int).
-
setHeaderProvider
@BetaApi public Publisher.Builder setHeaderProvider(com.google.api.gax.rpc.HeaderProvider headerProvider)
Sets the static header provider. The header provider will be called during client construction only once. The headers returned by the provider will be cached and supplied as is for each request issued by the constructed client. Some reserved headers can be overridden (e.g. Content-Type) or merged with the default value (e.g. User-Agent) by the underlying transport layer.- Parameters:
headerProvider- the header provider- Returns:
- the builder
-
setCredentialsProvider
public Publisher.Builder setCredentialsProvider(com.google.api.gax.core.CredentialsProvider credentialsProvider)
CredentialsProviderto use to create Credentials to authenticate calls.
-
setBatchingSettings
public Publisher.Builder setBatchingSettings(com.google.api.gax.batching.BatchingSettings batchingSettings)
-
setRetrySettings
public Publisher.Builder setRetrySettings(com.google.api.gax.retrying.RetrySettings retrySettings)
Configures the Publisher's retry parameters.
-
setEnableMessageOrdering
public Publisher.Builder setEnableMessageOrdering(boolean enableMessageOrdering)
Sets the message ordering option.
-
setExecutorProvider
public Publisher.Builder setExecutorProvider(com.google.api.gax.core.ExecutorProvider executorProvider)
Gives the ability to set a custom executor to be used by the library.
-
setTransform
@BetaApi public Publisher.Builder setTransform(com.google.api.core.ApiFunction<PubsubMessage,PubsubMessage> messageTransform)
Gives the ability to set anApiFunctionthat will transform thePubsubMessagebefore it is sent
-
setEndpoint
public Publisher.Builder setEndpoint(String endpoint)
Gives the ability to override the gRPC endpoint.
-
setEnableCompression
public Publisher.Builder setEnableCompression(boolean enableCompression)
Gives the ability to enable transport compression.
-
setCompressionBytesThreshold
public Publisher.Builder setCompressionBytesThreshold(long compressionBytesThreshold)
Sets the threshold (in bytes) above which messages are compressed for transport. Only takes effect if setEnableCompression(true) is also called."
-
getDefaultBatchingSettings
public static com.google.api.gax.batching.BatchingSettings getDefaultBatchingSettings()
Returns the default BatchingSettings used by the client if settings are not provided.
-
build
public Publisher build() throws IOException
- Throws:
IOException
-
-