Class SubscriptionCreateOptions
- All Implemented Interfaces:
Serializable
Supplying these options for a subscription is what authorises creating it. There is no
separate disposition enum, because there is no meaningful "create with defaults": a subscription
without a topic is not a subscription, and only the user knows which topic to bind. A
subscription passed to PubSubSourceBuilder.subscription(SubscriptionDestination) without
options must therefore already exist, and the source fails at startup if it does not.
Options are per subscription, and the topic binding is why. One options object shared by several subscriptions would bind them all to the same topic, and Pub/Sub delivers a complete copy of the stream to every subscription of a topic — so the source would emit each message once per subscription, with nothing anywhere reporting an error.
Options only affect creation. A subscription that already exists is used exactly as it is
configured, and these settings are neither applied to it nor compared against it (except for the
two the source cannot work around, which the startup check rejects: ordering under OrderingMode.PER_KEY, and exactly-once delivery).
Every knob but the topic 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 (an acknowledgement deadline of 10-600 seconds, for example) are left to Pub/Sub, whose rejection already names the field and the limit.
- See Also:
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Returns a builder.booleanReturns the acknowledgement deadline, ornullfor the Pub/Sub default (10 s).intReturns how many delivery attempts a message gets before it is dead-lettered, or0when no dead-letter policy is configured.Returns the topic undeliverable messages are forwarded to, ornullwhen no dead-letter policy is configured.Returns how long the subscription may sit inactive before Pub/Sub deletes it, ornullwhen the default (31 days) applies or when expiration is disabled — seeisNeverExpire().Returns the subscription filter expression, ornullwhen unfiltered.Returns how long messages are retained, ornullfor the Pub/Sub default (7 days).getTopic()Returns the topic the subscription is created against.inthashCode()booleanReturns whether the subscription is created with ordering-key ordering enabled.booleanReturns whether the subscription is created never to expire.booleanReturns whether acknowledged messages are retained for replay.toString()
-
Method Details
-
builder
Returns a builder. The topic is required; everything else is optional. -
getTopic
Returns the topic the subscription is created against. -
getAckDeadline
Returns the acknowledgement deadline, ornullfor the Pub/Sub default (10 s). -
isEnableMessageOrdering
public boolean isEnableMessageOrdering()Returns whether the subscription is created with ordering-key ordering enabled. -
getMessageRetention
Returns how long messages are retained, ornullfor the Pub/Sub default (7 days). -
isRetainAckedMessages
public boolean isRetainAckedMessages()Returns whether acknowledged messages are retained for replay. -
getExpirationTtl
Returns how long the subscription may sit inactive before Pub/Sub deletes it, ornullwhen the default (31 days) applies or when expiration is disabled — seeisNeverExpire(). -
isNeverExpire
public boolean isNeverExpire()Returns whether the subscription is created never to expire. -
getDeadLetterTopic
Returns the topic undeliverable messages are forwarded to, ornullwhen no dead-letter policy is configured. -
getDeadLetterMaxDeliveryAttempts
public int getDeadLetterMaxDeliveryAttempts()Returns how many delivery attempts a message gets before it is dead-lettered, or0when no dead-letter policy is configured. -
getFilter
Returns the subscription filter expression, ornullwhen unfiltered. -
equals
-
hashCode
public int hashCode() -
toString
-