diff --git a/google-cloud-clients/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStubSettings.java b/google-cloud-clients/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStubSettings.java index 4214080d9433..612fbb6b44a9 100644 --- a/google-cloud-clients/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStubSettings.java +++ b/google-cloud-clients/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStubSettings.java @@ -292,7 +292,9 @@ public String extractNextToken(ListTopicsResponse payload) { @Override public Iterable extractResources(ListTopicsResponse payload) { - return payload.getTopicsList(); + return payload.getTopicsList() != null + ? payload.getTopicsList() + : ImmutableList.of(); } }; @@ -332,7 +334,9 @@ public String extractNextToken(ListTopicSubscriptionsResponse payload) { @Override public Iterable extractResources(ListTopicSubscriptionsResponse payload) { - return payload.getSubscriptionsList(); + return payload.getSubscriptionsList() != null + ? payload.getSubscriptionsList() + : ImmutableList.of(); } }; @@ -476,11 +480,6 @@ public static class Builder extends StubSettings.BuildernewArrayList( StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); - definitions.put( - "http_get", - ImmutableSet.copyOf( - Lists.newArrayList( - StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); definitions.put( "one_plus_delivery", diff --git a/google-cloud-clients/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/SubscriberStubSettings.java b/google-cloud-clients/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/SubscriberStubSettings.java index 7072eb0a55eb..d66dca70da74 100644 --- a/google-cloud-clients/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/SubscriberStubSettings.java +++ b/google-cloud-clients/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/SubscriberStubSettings.java @@ -355,7 +355,9 @@ public String extractNextToken(ListSubscriptionsResponse payload) { @Override public Iterable extractResources(ListSubscriptionsResponse payload) { - return payload.getSubscriptionsList(); + return payload.getSubscriptionsList() != null + ? payload.getSubscriptionsList() + : ImmutableList.of(); } }; @@ -389,7 +391,9 @@ public String extractNextToken(ListSnapshotsResponse payload) { @Override public Iterable extractResources(ListSnapshotsResponse payload) { - return payload.getSnapshotsList(); + return payload.getSnapshotsList() != null + ? payload.getSnapshotsList() + : ImmutableList.of(); } }; @@ -484,11 +488,6 @@ public static class Builder extends StubSettings.BuildernewArrayList( - StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } diff --git a/google-cloud-clients/google-cloud-pubsub/synth.py b/google-cloud-clients/google-cloud-pubsub/synth.py index f8862c71e023..0601c96b8bb0 100644 --- a/google-cloud-clients/google-cloud-pubsub/synth.py +++ b/google-cloud-clients/google-cloud-pubsub/synth.py @@ -35,6 +35,12 @@ s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') + s.replace( + '**/stub/SubscriberStubSettings.java', + r'return InstantiatingGrpcChannelProvider\.newBuilder\(\);', + 'return InstantiatingGrpcChannelProvider.newBuilder().setMaxInboundMessageSize(20 << 20); // 20MB' + ) + java.format_code('./src') java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src')