Class SubscriptionDestination

java.lang.Object
io.github.flink.gcp.connector.pubsub.source.SubscriptionDestination
All Implemented Interfaces:
Serializable

@Public public final class SubscriptionDestination extends Object implements Serializable
A fully-qualified Pub/Sub subscription reference: project and subscription.

Instances are pure subscription identity: equals(Object) and hashCode() are defined over exactly (project, subscription), so a split carries one and the enumerator can key its per-subscription bookkeeping by it. The reader does not key its subscribers this way — it keys them by split id, because under OrderingMode.NONE several splits deliberately consume one subscription, each with its own subscriber. Subscriber settings are intentionally not part of this class — they are configured on the source — keeping subscription identity stable.

Instances are immutable; the resource path and hash are precomputed.

Deliberately mirrors sink.TopicDestination (and the BigQuery module's TableDestination) rather than sharing a base type: the three name different resources and only coincide in shape. A shared destination-identity type was considered and declined when issue #61 created flink-connector-gcp-base — a type moves there only once it has multiple consumers, and nothing consumes destination identity across modules.

See Also:
  • Method Details

    • of

      public static SubscriptionDestination of(String project, String subscription)
      Creates a SubscriptionDestination from bare ids, not resource paths.
      Parameters:
      project - the Google Cloud project id
      subscription - the Pub/Sub subscription id
      Returns:
      the destination
      Throws:
      IllegalArgumentException - if a component is null or blank, has leading or trailing whitespace, or contains '/' — a separator would make the composed resource path address a different resource
    • getProject

      public String getProject()
      Returns the Google Cloud project id, given as a bare id rather than a resource path.
    • getSubscription

      public String getSubscription()
      Returns the Pub/Sub subscription id, given as a bare id rather than a resource path.
    • toSubscriptionPath

      public String toSubscriptionPath()
      Returns the subscription path in the projects/<p>/subscriptions/<s> form used by the Pub/Sub API.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object