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

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

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

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: org.apache.beam/beam-sdks-java-io-google-cloud-platform

private static Topic buildTopic(int i) {
 Topic topic = new Topic();
 topic.setName(PubsubClient.topicPathFromName(PROJECT.getId(), "Topic" + i).getPath());
 return topic;
}
origin: org.apache.beam/beam-sdks-java-io-google-cloud-platform

@Override
public void createTopic(TopicPath topic) throws IOException {
 pubsub
   .projects()
   .topics()
   .create(topic.getPath(), new Topic())
   .execute(); // ignore Topic result.
}
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: GoogleCloudPlatform/pubsub

try {
 pubsub.projects().topics()
   .create("projects/" + projectName + "/topics/" + topic, new Topic()).execute();
} catch (GoogleJsonResponseException e) {
 if (e.getStatusCode() != ALREADY_EXISTS) {
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: org.apache.beam/beam-examples-java

private void setupPubsubTopic(String topic) throws IOException {
 if (pubsubClient == null) {
  pubsubClient = newPubsubClient(options.as(PubsubOptions.class)).build();
 }
 if (executeNullIfNotFound(pubsubClient.projects().topics().get(topic)) == null) {
  pubsubClient.projects().topics().create(topic, new Topic().setName(topic)).execute();
 }
}
origin: Talend/components

public void createTopic(String topic) throws IOException {
  client.projects().topics().create(getTopicPath(topic), new Topic()).execute();
}
origin: GoogleCloudPlatform/cloud-pubsub-samples-java

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

Javadoc

A topic resource.

This is the Java data model class that specifies how to parse/serialize into the JSON that is transmitted over HTTP when working with the Cloud Pub/Sub API. For a detailed explanation see: https://developers.google.com/api-client-library/java/google-http-java-client/json

Most used methods

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

Popular in Java

  • Creating JSON documents from java classes using gson
  • getSupportFragmentManager (FragmentActivity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • JComboBox (javax.swing)
  • Runner (org.openjdk.jmh.runner)
  • 21 Best IntelliJ Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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