@Override public void deleteTopic(TopicPath topic) throws IOException { DeleteTopicRequest request = DeleteTopicRequest.newBuilder().setTopic(topic.getPath()).build(); publisherStub().deleteTopic(request); // ignore Empty result. }
/** * Deletes the topic with the given name. Returns `NOT_FOUND` if the topic does not exist. After a * topic is deleted, a new topic may be created with the same name; this is an entirely new topic * with none of the old configuration or subscriptions. Existing subscriptions to this topic are * not deleted, but their `topic` field is set to `_deleted-topic_`. * * <p>Sample code: * * <pre><code> * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) { * ProjectTopicName topic = ProjectTopicName.of("[PROJECT]", "[TOPIC]"); * topicAdminClient.deleteTopic(topic); * } * </code></pre> * * @param topic Name of the topic to delete. Format is `projects/{project}/topics/{topic}`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteTopic(ProjectTopicName topic) { DeleteTopicRequest request = DeleteTopicRequest.newBuilder().setTopic(topic == null ? null : topic.toString()).build(); deleteTopic(request); }
/** * Deletes the topic with the given name. Returns `NOT_FOUND` if the topic does not exist. After a * topic is deleted, a new topic may be created with the same name; this is an entirely new topic * with none of the old configuration or subscriptions. Existing subscriptions to this topic are * not deleted, but their `topic` field is set to `_deleted-topic_`. * * <p>Sample code: * * <pre><code> * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) { * ProjectTopicName topic = ProjectTopicName.of("[PROJECT]", "[TOPIC]"); * topicAdminClient.deleteTopic(topic.toString()); * } * </code></pre> * * @param topic Name of the topic to delete. Format is `projects/{project}/topics/{topic}`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteTopic(String topic) { DeleteTopicRequest request = DeleteTopicRequest.newBuilder().setTopic(topic).build(); deleteTopic(request); }