use of com.google.pubsub.v1.DeleteSubscriptionRequest in project beam by apache.
the class PubsubGrpcClient method deleteSubscription.
@Override
public void deleteSubscription(SubscriptionPath subscription) throws IOException {
DeleteSubscriptionRequest request = DeleteSubscriptionRequest.newBuilder().setSubscription(subscription.getPath()).build();
// ignore Empty result.
subscriberStub().deleteSubscription(request);
}
use of com.google.pubsub.v1.DeleteSubscriptionRequest in project google-cloud-java by GoogleCloudPlatform.
the class SubscriptionAdminClient method deleteSubscription.
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Deletes an existing subscription. All messages retained in the subscription are immediately
* dropped. Calls to `Pull` after deletion will return `NOT_FOUND`. After a subscription is
* deleted, a new one may be created with the same name, but the new one has no association with
* the old subscription or its topic unless the same topic is specified.
*
* <p>Sample code:
*
* <pre><code>
* try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
* SubscriptionName subscription = SubscriptionName.create("[PROJECT]", "[SUBSCRIPTION]");
* subscriptionAdminClient.deleteSubscription(subscription);
* }
* </code></pre>
*
* @param subscription The subscription to delete. Format is
* `projects/{project}/subscriptions/{sub}`.
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final void deleteSubscription(SubscriptionName subscription) {
DeleteSubscriptionRequest request = DeleteSubscriptionRequest.newBuilder().setSubscriptionWithSubscriptionName(subscription).build();
deleteSubscription(request);
}
use of com.google.pubsub.v1.DeleteSubscriptionRequest in project google-cloud-java by GoogleCloudPlatform.
the class SubscriptionAdminClientTest method deleteSubscriptionTest.
@Test
@SuppressWarnings("all")
public void deleteSubscriptionTest() {
Empty expectedResponse = Empty.newBuilder().build();
mockSubscriber.addResponse(expectedResponse);
SubscriptionName subscription = SubscriptionName.create("[PROJECT]", "[SUBSCRIPTION]");
client.deleteSubscription(subscription);
List<GeneratedMessageV3> actualRequests = mockSubscriber.getRequests();
Assert.assertEquals(1, actualRequests.size());
DeleteSubscriptionRequest actualRequest = (DeleteSubscriptionRequest) actualRequests.get(0);
Assert.assertEquals(subscription, actualRequest.getSubscriptionAsSubscriptionName());
}
Aggregations