Class PubSubConfiguration
java.lang.Object
com.google.cloud.spring.pubsub.core.PubSubConfiguration
- Direct Known Subclasses:
GcpPubSubProperties
Properties for Publisher or Subscriber specific configurations.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBatching settings.static classflow control settings.static classHealth Check settings.static classPublisher settings.static classRetry settings.static classSubscriber settings. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault number of executor threads. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncomputeMaxAckExtensionPeriod(String subscriptionName, String projectId) Computes the max extension period.computeMaxDurationPerAckExtension(String subscriptionName, String projectId) Computes the upper bound for a single mod ack extension period.computeMinDurationPerAckExtension(String subscriptionName, String projectId) Computes the lower bound for a single mod ack extension period.computeParallelPullCount(String subscriptionName, String projectId) Computes parallel pull count.computePullEndpoint(String subscriptionName, String projectId) Returns the pull endpoint.com.google.api.gax.rpc.StatusCode.Code[]computeRetryableCodes(String subscriptionName, String projectId) Retrieves collection of retryable codes from configuration.computeSubscriberFlowControlSettings(com.google.pubsub.v1.ProjectSubscriptionName projectSubscriptionName) Computes flow control settings to use.computeSubscriberRetrySettings(com.google.pubsub.v1.ProjectSubscriptionName projectSubscriptionName) Computes the retry settings.computeSubscriberUniverseDomain(String subscriptionName, String projectId) Returns the universe domain.Map<com.google.pubsub.v1.ProjectSubscriptionName,PubSubConfiguration.Subscriber> Returns an immutable map of subscription properties keyed by the fully-qualifiedProjectSubscriptionName.getSubscriptionProperties(com.google.pubsub.v1.ProjectSubscriptionName projectSubscriptionName) Returns properties for the specified fully-qualifiedProjectSubscriptionName.voidinitialize(String defaultProjectId) Standardizes all subscription properties to be keyed by their fully qualified subscription names.voidsetSubscription(Map<String, PubSubConfiguration.Subscriber> subscriberProperties) This method will be called by Spring Framework when binding user properties.
-
Field Details
-
DEFAULT_EXECUTOR_THREADS
public static final int DEFAULT_EXECUTOR_THREADSDefault number of executor threads.- See Also:
-
-
Constructor Details
-
PubSubConfiguration
public PubSubConfiguration()
-
-
Method Details
-
getSubscriber
-
getPublisher
-
getHealth
-
setSubscription
This method will be called by Spring Framework when binding user properties. Also potentially useful for tests.- Parameters:
subscriberProperties- map of user-defined properties.
-
getFullyQualifiedSubscriberProperties
public Map<com.google.pubsub.v1.ProjectSubscriptionName,PubSubConfiguration.Subscriber> getFullyQualifiedSubscriberProperties()Returns an immutable map of subscription properties keyed by the fully-qualifiedProjectSubscriptionName.Cannot be called before
initialize(String).- Returns:
- map of subscription properties
-
initialize
Standardizes all subscription properties to be keyed by their fully qualified subscription names. Not thread-safe.If a `fully-qualified-name` property is present, it is used as a key for all subscription properties under the same group. Otherwise, the provided configuration group key is assumed to be the short subscription name in the current project.
- Parameters:
defaultProjectId- Project to use with short subscription names
-
getSubscriptionProperties
public PubSubConfiguration.Subscriber getSubscriptionProperties(com.google.pubsub.v1.ProjectSubscriptionName projectSubscriptionName) Returns properties for the specified fully-qualifiedProjectSubscriptionName.- Parameters:
projectSubscriptionName- fully-qualifiedProjectSubscriptionName- Returns:
- user-provided subscription properties
-
computeSubscriberFlowControlSettings
public PubSubConfiguration.FlowControl computeSubscriberFlowControlSettings(com.google.pubsub.v1.ProjectSubscriptionName projectSubscriptionName) Computes flow control settings to use. The subscription-specific property takes precedence if both global and subscription-specific properties are set. If subscription-specific settings are not set then global settings are picked.- Parameters:
projectSubscriptionName- Fully qualified subscription name- Returns:
- flow control settings defaulting to global where not provided
-
computeParallelPullCount
Computes parallel pull count. The subscription-specific property takes precedence if both global and subscription-specific properties are set. If subscription-specific configuration is not set then the global configuration is picked.- Parameters:
subscriptionName- subscription nameprojectId- project id- Returns:
- parallel pull count
-
computeRetryableCodes
public com.google.api.gax.rpc.StatusCode.Code[] computeRetryableCodes(String subscriptionName, String projectId) Retrieves collection of retryable codes from configuration. The subscription-specific property takes precedence if both global and subscription-specific properties are set. If subscription-specific configuration is not set then the global configuration is picked.- Parameters:
subscriptionName- subscription nameprojectId- project id- Returns:
- retryable codes
-
computeMaxAckExtensionPeriod
Computes the max extension period. The subscription-specific property takes precedence if both global and subscription-specific properties are set. If none are set then the default (0) is returned.- Parameters:
subscriptionName- subscription nameprojectId- project id- Returns:
- max extension period
-
computeMinDurationPerAckExtension
Computes the lower bound for a single mod ack extension period. The subscription-specific property takes precedence if both global and subscription-specific properties are set. If none are set then the default (0) is returned.- Parameters:
subscriptionName- subscription nameprojectId- project id- Returns:
- min duration per ack extension
-
computeMaxDurationPerAckExtension
Computes the upper bound for a single mod ack extension period. The subscription-specific property takes precedence if both global and subscription-specific properties are set. If none are set then the default (0) is returned.- Parameters:
subscriptionName- subscription nameprojectId- project id- Returns:
- max duration per ack extension
-
computePullEndpoint
Returns the pull endpoint. The subscription-specific property takes precedence if both global and subscription-specific properties are set. If subscription-specific configuration is not set then the global configuration is picked.- Parameters:
subscriptionName- subscription nameprojectId- project id- Returns:
- pull endpoint
-
computeSubscriberUniverseDomain
Returns the universe domain. The subscription-specific property takes precedence if both global and subscription-specific properties are set. If subscription-specific configuration is not set then the global configuration is picked.- Parameters:
subscriptionName- subscription nameprojectId- project id- Returns:
- pull endpoint
-
computeSubscriberRetrySettings
public PubSubConfiguration.Retry computeSubscriberRetrySettings(com.google.pubsub.v1.ProjectSubscriptionName projectSubscriptionName) Computes the retry settings. The subscription-specific property takes precedence if both global and subscription-specific properties are set. If subscription-specific settings are not set then the global settings are picked.- Parameters:
projectSubscriptionName- The fully qualified subscription name- Returns:
- retry settings
-