public void replacePushConfig ( String subscriptionId , String endpoint ) throws Exception { // [START pubsub_update_push_configuration] try ( SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient . create ( ) ) { ProjectSubscriptionName subscriptionName = ProjectSubscriptionName . of ( projectId , subscriptionId ) ; PushConfig pushConfig = PushConfig . newBuilder ( ) . setPushEndpoint ( endpoint ) . build ( ) ; subscriptionAdminClient . modifyPushConfig ( subscriptionName , pushConfig ) ; } // [END pubsub_update_push_configuration] }
Example of replacing the push configuration of a subscription setting the push endpoint .