public ProjectSubscriptionName deleteSubscription ( String subscriptionId ) throws Exception { // [START pubsub_delete_subscription] try ( SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient . create ( ) ) { ProjectSubscriptionName subscriptionName = ProjectSubscriptionName . of ( projectId , subscriptionId ) ; subscriptionAdminClient . deleteSubscription ( subscriptionName ) ; return subscriptionName ; } // [END pubsub_delete_subscription] }
Example of deleting a subscription .