コード例 #1
0
 private void setupPubsubTopic(String topic) throws IOException {
   if (pubsubClient == null) {
     pubsubClient = Transport.newPubsubClient(options).build();
   }
   if (executeNullIfNotFound(pubsubClient.projects().topics().get(topic)) == null) {
     pubsubClient.projects().topics().create(topic, new Topic().setName(topic)).execute();
   }
 }
コード例 #2
-1
 /**
  * Deletes the Google Cloud Pub/Sub topic.
  *
  * @throws IOException if there is a problem deleting the Pub/Sub topic
  */
 private void deletePubsubTopic(String topic) throws IOException {
   if (pubsubClient == null) {
     pubsubClient = Transport.newPubsubClient(options).build();
   }
   if (executeNullIfNotFound(pubsubClient.projects().topics().get(topic)) != null) {
     pubsubClient.projects().topics().delete(topic).execute();
   }
 }