Class TopicDestination

java.lang.Object
io.github.flink.gcp.connector.pubsub.sink.TopicDestination
All Implemented Interfaces:
Serializable

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

Instances are pure topic identity: equals(Object) and hashCode() are defined over exactly (project, topic) so the class can serve as a per-destination key (the writer's per-topic publisher map). Publisher settings are intentionally not part of this class — they are configured on the sink — keeping destination identity stable.

Instances are immutable; the resource path and hash are precomputed, so they are cheap to use as map keys on the per-record write path. Resolvers should still cache and reuse instances instead of re-creating them per record.

See Also:
  • Method Details

    • of

      public static TopicDestination of(String project, String topic)
      Creates a TopicDestination from bare ids, not resource paths.
      Parameters:
      project - the Google Cloud project id
      topic - the Pub/Sub topic 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.
    • getTopic

      public String getTopic()
      Returns the Pub/Sub topic id, given as a bare id rather than a resource path.
    • toTopicPath

      public String toTopicPath()
      Returns the topic path in the projects/<p>/topics/<t> 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