Tabnine Logo
Topic.getName
Code IndexAdd Tabnine to your IDE (free)

How to use
getName
method
in
com.google.api.services.pubsub.model.Topic

Best Java code snippets using com.google.api.services.pubsub.model.Topic.getName (Showing top 5 results out of 315)

origin: Talend/components

public Set<String> listTopics() throws IOException {
  ListTopicsResponse listTopicsResponse = client.projects().topics().list(getProjectPath()).execute();
  List<Topic> topics = listTopicsResponse.getTopics();
  Set<String> topicsName = new HashSet<>();
  for (Topic topic : topics) {
    String topicName = topic.getName();
    String[] split = topicName.split("/");
    topicsName.add(split[3]);
  }
  return topicsName;
}
origin: org.apache.beam/beam-sdks-java-io-google-cloud-platform

@Override
public List<TopicPath> listTopics(ProjectPath project) throws IOException {
 Topics.List request = pubsub.projects().topics().list(project.getPath());
 ListTopicsResponse response = request.execute();
 if (response.getTopics() == null || response.getTopics().isEmpty()) {
  return ImmutableList.of();
 }
 List<TopicPath> topics = new ArrayList<>(response.getTopics().size());
 while (true) {
  for (Topic topic : response.getTopics()) {
   topics.add(topicPathFromPath(topic.getName()));
  }
  if (Strings.isNullOrEmpty(response.getNextPageToken())) {
   break;
  }
  request.setPageToken(response.getNextPageToken());
  response = request.execute();
 }
 return topics;
}
origin: org.apache.beam/beam-examples-java

 /** Create a topic if it doesn't exist. */
 public static void createTopic(Pubsub client, String fullTopicName) throws IOException {
  System.out.println("fullTopicName " + fullTopicName);
  try {
   client.projects().topics().get(fullTopicName).execute();
  } catch (GoogleJsonResponseException e) {
   if (e.getStatusCode() == HttpStatusCodes.STATUS_CODE_NOT_FOUND) {
    Topic topic = client.projects().topics().create(fullTopicName, new Topic()).execute();
    System.out.printf("Topic %s was created.%n", topic.getName());
   }
  }
 }
}
origin: GoogleCloudPlatform/cloud-pubsub-samples-java

/**
 * Creates a new topic with a given name.
 *
 * @param client Cloud Pub/Sub client.
 * @param args Command line arguments.
 * @throws IOException when Cloud Pub/Sub API calls fail.
 */
public static void createTopic(final Pubsub client, final String[] args)
    throws IOException {
  Main.checkArgsLength(args, 3);
  String topicName = PubsubUtils.getFullyQualifiedResourceName(
      PubsubUtils.ResourceType.TOPIC, args[0], args[2]);
  Topic topic = client.projects().topics()
      .create(topicName, new Topic())
      .execute();
  System.out.printf("Topic %s was created.\n", topic.getName());
}
origin: GoogleCloudPlatform/cloud-pubsub-samples-java

for (Topic topic : response.getTopics()) {
  hasTopics = true;
  System.out.println(topic.getName());
com.google.api.services.pubsub.modelTopicgetName

Javadoc

The name of the topic. It must have the format `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `"goog"`.

Popular methods of Topic

  • <init>
  • setName
    The name of the topic. It must have the format `"projects/{project}/topics/{topic}"`. `{topic}` must

Popular in Java

  • Updating database using SQL prepared statement
  • getSupportFragmentManager (FragmentActivity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • startActivity (Activity)
  • Menu (java.awt)
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • JTextField (javax.swing)
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now