Class TopicCreateOptions.Builder
java.lang.Object
io.github.flink.gcp.connector.pubsub.sink.TopicCreateOptions.Builder
- Enclosing class:
- TopicCreateOptions
Builder for
TopicCreateOptions.-
Method Summary
Modifier and TypeMethodDescriptionallowedPersistenceRegions(List<String> allowedPersistenceRegions) Restricts which regions messages published to the topic may be persisted in (the topic's message storage policy).build()Builds the options.enforceInTransit(boolean enforceInTransit) Rejects publishes travelling through regions outside the allowed persistence regions, instead of only restricting where messages are stored.kmsKeyName(String kmsKeyName) Encrypts messages published to the topic with the given Cloud KMS key (customer-managed encryption) instead of Google-managed encryption.messageRetention(Duration messageRetention) Sets how long the topic retains published messages, whether or not they were acknowledged.
-
Method Details
-
messageRetention
Sets how long the topic retains published messages, whether or not they were acknowledged. Defaults to the Pub/Sub default: no topic-level retention, so a message is kept only as long as some subscription's own retention covers it. Topic retention is what lets a subscription created later — or a backwards seek — reach messages published before it existed or already acknowledged.- Parameters:
messageRetention- the retention duration- Returns:
- this builder
-
kmsKeyName
Encrypts messages published to the topic with the given Cloud KMS key (customer-managed encryption) instead of Google-managed encryption. The key must already exist, and the Pub/Sub service account needscloudkms.cryptoKeyEncrypterDecrypteron it — without that grant, publishes to the created topic fail.- Parameters:
kmsKeyName- the full key resource name,projects/P/locations/L/keyRings/R/cryptoKeys/K- Returns:
- this builder
-
allowedPersistenceRegions
Restricts which regions messages published to the topic may be persisted in (the topic's message storage policy). Defaults to whatever the project's organization policy allows.- Parameters:
allowedPersistenceRegions- the allowed Cloud regions, for example["europe-west1", "europe-west4"]- Returns:
- this builder
-
enforceInTransit
Rejects publishes travelling through regions outside the allowed persistence regions, instead of only restricting where messages are stored. RequiresallowedPersistenceRegions(List), whichbuild()enforces.- Parameters:
enforceInTransit- whether to enforce the storage policy in transit- Returns:
- this builder
-
build
Builds the options.- Returns:
- the options
-