29
29
import com .google .cloud .Role ;
30
30
import com .google .cloud .pubsub .PubSub ;
31
31
import com .google .cloud .pubsub .PubSub .ListOption ;
32
- import com .google .cloud .pubsub .PushConfig ;
33
32
import com .google .cloud .pubsub .Subscription ;
34
33
import com .google .cloud .pubsub .SubscriptionId ;
35
34
import com .google .cloud .pubsub .SubscriptionInfo ;
36
35
import com .google .cloud .pubsub .Topic ;
37
36
import com .google .cloud .pubsub .TopicInfo ;
38
-
37
+ import com . google . pubsub . v1 . PushConfig ;
39
38
import java .util .Iterator ;
40
39
import java .util .LinkedList ;
41
40
import java .util .List ;
42
41
import java .util .concurrent .ExecutionException ;
43
42
import java .util .concurrent .Future ;
44
- import java .util .concurrent .TimeUnit ;
45
43
46
44
/**
47
45
* This class contains a number of snippets for the {@link PubSub} interface.
@@ -224,7 +222,7 @@ public Subscription createSubscriptionAsync(String topicName, String subscriptio
224
222
// [VARIABLE "https://www.example.com/push"]
225
223
public void replacePushConfig (String subscriptionName , String endpoint ) {
226
224
// [START replacePushConfig]
227
- PushConfig pushConfig = PushConfig .of ( endpoint );
225
+ PushConfig pushConfig = PushConfig .newBuilder (). setPushEndpoint ( endpoint ). build ( );
228
226
pubsub .replacePushConfig (subscriptionName , pushConfig );
229
227
// [END replacePushConfig]
230
228
}
@@ -251,7 +249,7 @@ public void replacePushConfigToPull(String subscriptionName) {
251
249
public void replacePushConfigAsync (String subscriptionName , String endpoint )
252
250
throws ExecutionException , InterruptedException {
253
251
// [START replacePushConfigAsync]
254
- PushConfig pushConfig = PushConfig .of ( endpoint );
252
+ PushConfig pushConfig = PushConfig .newBuilder (). setPushEndpoint ( endpoint ). build ( );
255
253
Future <Void > future = pubsub .replacePushConfigAsync (subscriptionName , pushConfig );
256
254
// ...
257
255
future .get ();
0 commit comments