Class PubSubTopicUtils

java.lang.Object
com.google.cloud.spring.pubsub.support.PubSubTopicUtils

public final class PubSubTopicUtils extends Object
Various utility methods for dealing with Pub/Sub topics.
Since:
1.2
  • Method Details

    • toProjectTopicName

      public static com.google.pubsub.v1.ProjectTopicName toProjectTopicName(String topic, @Nullable String projectId)
      Create a ProjectTopicName based on a topic name within a project or the fully-qualified topic name. If the specified topic is in the projects/[project_name]/topics/[topic_name] format, then the projectId is ignored}
      Parameters:
      topic - the topic name in the project or the fully-qualified project name
      projectId - the project ID to use if the topic is not a fully-qualified name
      Returns:
      the Pub/Sub object representing the topic name
    • toTopicName

      public static com.google.pubsub.v1.TopicName toTopicName(String topic, @Nullable String projectId)
      Create a TopicName based on a topic name within a project or the fully-qualified topic name. If the specified topic is in the projects/[project_name]/topics/[topic_name] format, then the projectId is ignored}
      Parameters:
      topic - the topic name in the project or the fully-qualified project name
      projectId - the project ID to use if the topic is not a fully-qualified name
      Returns:
      the Pub/Sub object representing the topic name