Class TopicCreateOptions
- All Implemented Interfaces:
Serializable
Unlike the source's SubscriptionCreateOptions, supplying these options is not
what authorises creation — CreateDisposition is, because a topic (unlike a subscription)
can meaningfully be created with defaults. The options are purely additive: without them, CreateDisposition.CREATE_IF_NEEDED creates the topic with every field at its service default.
Combining them with CreateDisposition.CREATE_NEVER is rejected by PubSubSinkBuilder.build(), since they would configure a topic the sink never creates.
One options object applies to every topic the sink creates. With dynamic destinations
(a DestinationResolver) each missing topic is created with these same settings; there is
no per-topic map, because unlike a subscription's topic binding, nothing in the settings ties
them to one topic.
Options only affect creation. A topic that already exists is used exactly as it is configured, and these settings are neither applied to it nor compared against it.
Every knob is optional and unset means absent, leaving Pub/Sub's own default. Values are validated here only where the failure would otherwise be silent or obscure; documented service ranges (a message retention of 10 minutes to 31 days, for example) are left to Pub/Sub, whose rejection already names the field and the limit. An all-unset object is allowed and equivalent to supplying no options at all.
- See Also:
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic TopicCreateOptions.Builderbuilder()Returns a builder.booleanReturns the regions messages published to the topic may be persisted in, ornullwhen the organization policy decides.Returns the Cloud KMS key the topic encrypts messages with, ornullfor Google-managed encryption.Returns how long the topic retains published messages, ornullfor the Pub/Sub default (no topic-level retention).inthashCode()booleanReturns whether publishes from outside the allowed regions are rejected in transit.toString()
-
Method Details
-
builder
Returns a builder. Every knob is optional. -
getMessageRetention
Returns how long the topic retains published messages, ornullfor the Pub/Sub default (no topic-level retention). -
getKmsKeyName
Returns the Cloud KMS key the topic encrypts messages with, ornullfor Google-managed encryption. -
getAllowedPersistenceRegions
Returns the regions messages published to the topic may be persisted in, ornullwhen the organization policy decides. -
isEnforceInTransit
public boolean isEnforceInTransit()Returns whether publishes from outside the allowed regions are rejected in transit. -
equals
-
hashCode
public int hashCode() -
toString
-