diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherClient.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherClient.java index e1cd043a439f..0b7ca15db947 100644 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherClient.java +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherClient.java @@ -20,7 +20,6 @@ import com.google.api.gax.grpc.ChannelAndExecutor; import com.google.api.gax.grpc.UnaryCallable; -import com.google.api.gax.protobuf.PathTemplate; import com.google.iam.v1.GetIamPolicyRequest; import com.google.iam.v1.Policy; import com.google.iam.v1.SetIamPolicyRequest; @@ -53,6 +52,8 @@ * Service Description: The service that an application uses to manipulate topics, and to send * messages to a topic. * + *
To publish messages to a topic, see the Publisher class. + * *
This class provides the ability to make remote calls to the backing service through method
* calls that map to API methods. Sample code to get started:
*
@@ -127,39 +128,6 @@ public class PublisherClient implements AutoCloseable {
private final UnaryCallable Sample code:
*
* Sample code:
*
* Sample code:
*
* To retrieve messages from a subscription, see the Subscriber class.
+ *
* This class provides the ability to make remote calls to the backing service through method
* calls that map to API methods. Sample code to get started:
*
@@ -127,71 +131,14 @@ public class SubscriberClient implements AutoCloseable {
private final UnaryCallable If the name is not provided in the request, the server will assign a random name for this
- * subscription on the same project as the topic. Note that for REST API requests, you must
- * specify a name.
+ * subscription on the same project as the topic, conforming to the [resource name
+ * format](https://cloud.google.com/pubsub/docs/overview#names). The generated name is populated
+ * in the returned Subscription object. Note that for REST API requests, you must specify a name
+ * in the request.
*
* Sample code:
*
@@ -290,8 +241,9 @@ public final SubscriberSettings getSettings() {
* letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores
* (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3
* and 255 characters in length, and it must not start with `"goog"`.
- * @param topic The name of the topic from which this subscription is receiving messages. The
- * value of this field will be `_deleted-topic_` if the topic has been deleted.
+ * @param topic The name of the topic from which this subscription is receiving messages. Format
+ * is `projects/{project}/topics/{topic}`. The value of this field will be `_deleted-topic_`
+ * if the topic has been deleted.
* @param pushConfig If push delivery is used with this subscription, this field is used to
* configure it. An empty `pushConfig` signifies that the subscriber will pull and ack
* messages using API methods.
@@ -301,13 +253,13 @@ public final SubscriberSettings getSettings() {
* and will not be delivered again during that time (on a best-effort basis).
* For pull subscriptions, this value is used as the initial value for the ack deadline. To
* override this value for a given message, call `ModifyAckDeadline` with the corresponding
- * `ack_id` if using pull. The maximum custom deadline you can specify is 600 seconds (10
- * minutes).
+ * `ack_id` if using pull. The minimum custom deadline you can specify is 10 seconds. The
+ * maximum custom deadline you can specify is 600 seconds (10 minutes). If this parameter is
+ * 0, a default value of 10 seconds is used.
* For push delivery, this value is also used to set the request timeout for the call to
* the push endpoint.
* If the subscriber never acknowledges the message, the Pub/Sub system will eventually
* redeliver the message.
- * If this parameter is 0, a default value of 10 seconds is used.
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final Subscription createSubscription(
@@ -316,7 +268,7 @@ public final Subscription createSubscription(
Subscription request =
Subscription.newBuilder()
.setNameWithSubscriptionName(name)
- .setTopicWithTopicNameOneof(TopicNameOneof.from(topic))
+ .setTopicWithTopicNameOneof(topic == null ? null : TopicNameOneof.from(topic))
.setPushConfig(pushConfig)
.setAckDeadlineSeconds(ackDeadlineSeconds)
.build();
@@ -329,8 +281,10 @@ public final Subscription createSubscription(
* `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns `NOT_FOUND`.
*
* If the name is not provided in the request, the server will assign a random name for this
- * subscription on the same project as the topic. Note that for REST API requests, you must
- * specify a name.
+ * subscription on the same project as the topic, conforming to the [resource name
+ * format](https://cloud.google.com/pubsub/docs/overview#names). The generated name is populated
+ * in the returned Subscription object. Note that for REST API requests, you must specify a name
+ * in the request.
*
* Sample code:
*
@@ -359,8 +313,10 @@ public final Subscription createSubscription(Subscription request) {
* `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns `NOT_FOUND`.
*
* If the name is not provided in the request, the server will assign a random name for this
- * subscription on the same project as the topic. Note that for REST API requests, you must
- * specify a name.
+ * subscription on the same project as the topic, conforming to the [resource name
+ * format](https://cloud.google.com/pubsub/docs/overview#names). The generated name is populated
+ * in the returned Subscription object. Note that for REST API requests, you must specify a name
+ * in the request.
*
* Sample code:
*
@@ -395,7 +351,8 @@ public final UnaryCallable Sample code:
*
@@ -574,7 +532,8 @@ public final ListSubscriptionsPagedResponse listSubscriptions(ListSubscriptionsR
* }
* Sample code:
*
@@ -614,10 +573,10 @@ private final void deleteSubscription(DeleteSubscriptionRequest request) {
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
- * Deletes an existing subscription. All pending messages in the subscription are immediately
+ * 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.
+ * the old subscription or its topic unless the same topic is specified.
*
* Sample code:
*
@@ -655,12 +614,14 @@ public final UnaryCallable Establishes a stream with the server, which sends messages down to the client. The client
+ * streams acknowledgements and ack deadline modifications back to the server. The server will
+ * close the stream and return the status on any error. The server may close the stream with
+ * status `OK` to reassign server-side resources, in which case, the client should re-establish
+ * the stream. `UNAVAILABLE` may also be returned in the case of a transient error (e.g., a server
+ * restart). These should also be retried by the client. Flow control can be achieved by
+ * configuring the underlying RPC channel.
+ *
+ * Sample code:
+ *
+ * An empty `pushConfig` indicates that the Pub/Sub system should stop pushing messages
* from the given subscription and allow messages to be pulled and acknowledged - effectively
@@ -1018,7 +1036,7 @@ public final UnaryCallable Sample code:
*
* Sample code:
*
* Sample code:
*
* Service Description: The service that an application uses to manipulate topics, and to send
* messages to a topic.
*
+ * To publish messages to a topic, see the Publisher class.
+ *
* Sample for PublisherClient:
*
* Service Description: The service that an application uses to manipulate subscriptions and to
* consume messages from a subscription via the `Pull` method.
*
+ * To retrieve messages from a subscription, see the Subscriber class.
+ *
* Sample for SubscriberClient:
*
*
*
- * @param subscription The name of the subscription.
+ * @param subscription The name of the subscription. Format is
+ * `projects/{project}/subscriptions/{sub}`.
* @param pushConfig The push configuration for future deliveries.
*
* try (PublisherClient publisherClient = PublisherClient.create()) {
- * String formattedResource = PublisherClient.formatTopicName("[PROJECT]", "[TOPIC]");
+ * String formattedResource = TopicName.create("[PROJECT]", "[TOPIC]").toString();
* Policy policy = Policy.newBuilder().build();
* Policy response = publisherClient.setIamPolicy(formattedResource, policy);
* }
@@ -777,7 +749,7 @@ public final UnaryCallable
*/
- public final UnaryCallable
* try (PublisherClient publisherClient = PublisherClient.create()) {
- * String formattedResource = PublisherClient.formatTopicName("[PROJECT]", "[TOPIC]");
+ * String formattedResource = TopicName.create("[PROJECT]", "[TOPIC]").toString();
* Policy policy = Policy.newBuilder().build();
* SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder()
* .setResource(formattedResource)
@@ -816,7 +788,7 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) {
*
*
*
- * @param subscription The subscription from which messages should be pulled.
- * @param returnImmediately If this is specified as true the system will respond immediately even
- * if it is not able to return a message in the `Pull` response. Otherwise the system is
- * allowed to wait until at least one message is available rather than returning no messages.
- * The client may cancel the request if it does not wish to wait any longer for the response.
+ * @param subscription The subscription from which messages should be pulled. Format is
+ * `projects/{project}/subscriptions/{sub}`.
+ * @param returnImmediately If this field set to true, the system will respond immediately even if
+ * it there are no messages available to return in the `Pull` response. Otherwise, the system
+ * may wait (for a bounded amount of time) until at least one message is available, rather
+ * than returning no messages. The client may cancel the request if it does not wish to wait
+ * any longer for the response.
* @param maxMessages The maximum number of messages returned for this request. The Pub/Sub system
* may return fewer than the number specified.
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
- public final PullResponse pull(
+ /* package-private */ final PullResponse pull(
SubscriptionName subscription, boolean returnImmediately, int maxMessages) {
PullRequest request =
@@ -911,10 +875,63 @@ public final PullResponse pull(PullRequest request) {
* }
*
* try (PublisherClient publisherClient = PublisherClient.create()) {
- * String formattedResource = PublisherClient.formatTopicName("[PROJECT]", "[TOPIC]");
+ * String formattedResource = TopicName.create("[PROJECT]", "[TOPIC]").toString();
* Policy policy = Policy.newBuilder().build();
* SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder()
* .setResource(formattedResource)
@@ -841,7 +813,7 @@ public final UnaryCallable
@@ -852,7 +824,7 @@ public final UnaryCallable
* try (PublisherClient publisherClient = PublisherClient.create()) {
- * String formattedResource = PublisherClient.formatTopicName("[PROJECT]", "[TOPIC]");
+ * String formattedResource = TopicName.create("[PROJECT]", "[TOPIC]").toString();
* Policy response = publisherClient.getIamPolicy(formattedResource);
* }
*
*
- * @param subscription The subscription whose message is being acknowledged.
+ * @param subscription The subscription whose message is being acknowledged. Format is
+ * `projects/{project}/subscriptions/{sub}`.
* @param ackIds The acknowledgment ID for the messages being acknowledged that was returned by
* the Pub/Sub system in the `Pull` response. Must not be empty.
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
@@ -841,16 +803,18 @@ public final UnaryCallable
* try (PublisherClient publisherClient = PublisherClient.create()) {
- * String formattedResource = PublisherClient.formatTopicName("[PROJECT]", "[TOPIC]");
+ * String formattedResource = TopicName.create("[PROJECT]", "[TOPIC]").toString();
* GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder()
* .setResource(formattedResource)
* .build();
@@ -890,7 +862,7 @@ private final Policy getIamPolicy(GetIamPolicyRequest request) {
*
*
*
- * @param subscription The name of the subscription.
+ * @param subscription The name of the subscription. Format is
+ * `projects/{project}/subscriptions/{sub}`.
* @param ackIds List of acknowledgment IDs.
* @param ackDeadlineSeconds The new ack deadline with respect to the time this request was sent
- * to the Pub/Sub system. Must be >= 0. For example, if the value is 10, the new ack
- * deadline will expire 10 seconds after the `ModifyAckDeadline` call was made. Specifying
- * zero may immediately make the message available for another pull request.
+ * to the Pub/Sub system. For example, if the value is 10, the new ack deadline will expire 10
+ * seconds after the `ModifyAckDeadline` call was made. Specifying zero may immediately make
+ * the message available for another pull request. The minimum deadline you can specify is 0
+ * seconds. The maximum deadline you can specify is 600 seconds (10 minutes).
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final void modifyAckDeadline(
@@ -752,7 +713,8 @@ public final UnaryCallable
* try (PublisherClient publisherClient = PublisherClient.create()) {
- * String formattedResource = PublisherClient.formatTopicName("[PROJECT]", "[TOPIC]");
+ * String formattedResource = TopicName.create("[PROJECT]", "[TOPIC]").toString();
* GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder()
* .setResource(formattedResource)
* .build();
@@ -906,13 +878,14 @@ public final UnaryCallable
*
- * @param subscription The subscription to delete.
+ * @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) {
@@ -588,10 +547,10 @@ public final void deleteSubscription(SubscriptionName subscription) {
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
- * Deletes an existing subscription. All pending messages in the subscription are immediately
+ * 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.
+ * the old subscription or its topic unless the same topic is specified.
*
*
* try (PublisherClient publisherClient = PublisherClient.create()) {
- * String formattedResource = PublisherClient.formatTopicName("[PROJECT]", "[TOPIC]");
+ * String formattedResource = TopicName.create("[PROJECT]", "[TOPIC]").toString();
* List<String> permissions = new ArrayList<>();
* TestIamPermissionsResponse response = publisherClient.testIamPermissions(formattedResource, permissions);
* }
@@ -928,7 +901,7 @@ public final UnaryCallable
*
- * @param project The name of the cloud project that subscriptions belong to.
+ * @param project The name of the cloud project that subscriptions belong to. Format is
+ * `projects/{project}`.
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final ListSubscriptionsPagedResponse listSubscriptions(ProjectName project) {
@@ -560,10 +518,10 @@ public final ListSubscriptionsPagedResponse listSubscriptions(ListSubscriptionsR
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
- * Deletes an existing subscription. All pending messages in the subscription are immediately
+ * 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.
+ * the old subscription or its topic unless the same topic is specified.
*
*
* try (PublisherClient publisherClient = PublisherClient.create()) {
- * String formattedResource = PublisherClient.formatTopicName("[PROJECT]", "[TOPIC]");
+ * String formattedResource = TopicName.create("[PROJECT]", "[TOPIC]").toString();
* List<String> permissions = new ArrayList<>();
* TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder()
* .setResource(formattedResource)
@@ -964,13 +938,14 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
- * Returns permissions that a caller has on the specified resource.
+ * Returns permissions that a caller has on the specified resource. If the resource does not
+ * exist, this will return an empty set of permissions, not a NOT_FOUND error.
*
*
*
- * @param subscription The name of the subscription to get.
+ * @param subscription The name of the subscription to get. Format is
+ * `projects/{project}/subscriptions/{sub}`.
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final Subscription getSubscription(SubscriptionName subscription) {
@@ -467,7 +424,8 @@ public final UnaryCallable
* try (PublisherClient publisherClient = PublisherClient.create()) {
- * String formattedResource = PublisherClient.formatTopicName("[PROJECT]", "[TOPIC]");
+ * String formattedResource = TopicName.create("[PROJECT]", "[TOPIC]").toString();
* List<String> permissions = new ArrayList<>();
* TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder()
* .setResource(formattedResource)
diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberClient.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberClient.java
index 8bbd1ff67167..23f723a79a31 100644
--- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberClient.java
+++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberClient.java
@@ -18,8 +18,8 @@
import static com.google.cloud.pubsub.spi.v1.PagedResponseWrappers.ListSubscriptionsPagedResponse;
import com.google.api.gax.grpc.ChannelAndExecutor;
+import com.google.api.gax.grpc.StreamingCallable;
import com.google.api.gax.grpc.UnaryCallable;
-import com.google.api.gax.protobuf.PathTemplate;
import com.google.iam.v1.GetIamPolicyRequest;
import com.google.iam.v1.Policy;
import com.google.iam.v1.SetIamPolicyRequest;
@@ -38,6 +38,8 @@
import com.google.pubsub.v1.PullRequest;
import com.google.pubsub.v1.PullResponse;
import com.google.pubsub.v1.PushConfig;
+import com.google.pubsub.v1.StreamingPullRequest;
+import com.google.pubsub.v1.StreamingPullResponse;
import com.google.pubsub.v1.Subscription;
import com.google.pubsub.v1.SubscriptionName;
import com.google.pubsub.v1.TopicName;
@@ -55,6 +57,8 @@
* Service Description: The service that an application uses to manipulate subscriptions and to
* consume messages from a subscription via the `Pull` method.
*
+ *
+ */
+ /* package-private */ final StreamingCallable
+ * try (SubscriberClient subscriberClient = SubscriberClient.create()) {
+ * StreamObserver<StreamingPullResponse> responseObserver =
+ * new StreamObserver<StreamingPullResponse>() {
+ * {@literal @}Override
+ * public void onNext(StreamingPullResponse response) {
+ * // Do something when receive a response
+ * }
+ *
+ * {@literal @}Override
+ * public void onError(Throwable t) {
+ * // Add error-handling
+ * }
+ *
+ * {@literal @}Override
+ * public void onCompleted() {
+ * // Do something when complete.
+ * }
+ * };
+ * StreamObserver<StreamingRecognizeRequest> requestObserver =
+ * subscriberClient.streamingPullCallable().bidiStreamingCall(responseObserver)});
+ *
+ * SubscriptionName subscription = SubscriptionName.create("[PROJECT]", "[SUBSCRIPTION]");
+ * int streamAckDeadlineSeconds = 0;
+ * StreamingPullRequest request = StreamingPullRequest.newBuilder()
+ * .setSubscriptionWithSubscriptionName(subscription)
+ * .setStreamAckDeadlineSeconds(streamAckDeadlineSeconds)
+ * .build();
+ * requestObserver.onNext(request);
+ * }
+ *
* try (SubscriberClient subscriberClient = SubscriberClient.create()) {
- * String formattedResource = SubscriberClient.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
+ * String formattedResource = SubscriptionName.create("[PROJECT]", "[SUBSCRIPTION]").toString();
* Policy policy = Policy.newBuilder().build();
* Policy response = subscriberClient.setIamPolicy(formattedResource, policy);
* }
@@ -1033,7 +1051,7 @@ public final UnaryCallable
* try (SubscriberClient subscriberClient = SubscriberClient.create()) {
- * String formattedResource = SubscriberClient.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
+ * String formattedResource = SubscriptionName.create("[PROJECT]", "[SUBSCRIPTION]").toString();
* Policy policy = Policy.newBuilder().build();
* SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder()
* .setResource(formattedResource)
@@ -1072,7 +1090,7 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) {
*
*
* try (SubscriberClient subscriberClient = SubscriberClient.create()) {
- * String formattedResource = SubscriberClient.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
+ * String formattedResource = SubscriptionName.create("[PROJECT]", "[SUBSCRIPTION]").toString();
* Policy policy = Policy.newBuilder().build();
* SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder()
* .setResource(formattedResource)
@@ -1097,7 +1115,7 @@ public final UnaryCallable
@@ -1108,7 +1126,7 @@ public final UnaryCallable
* try (SubscriberClient subscriberClient = SubscriberClient.create()) {
- * String formattedResource = SubscriberClient.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
+ * String formattedResource = SubscriptionName.create("[PROJECT]", "[SUBSCRIPTION]").toString();
* Policy response = subscriberClient.getIamPolicy(formattedResource);
* }
*
* try (SubscriberClient subscriberClient = SubscriberClient.create()) {
- * String formattedResource = SubscriberClient.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
+ * String formattedResource = SubscriptionName.create("[PROJECT]", "[SUBSCRIPTION]").toString();
* GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder()
* .setResource(formattedResource)
* .build();
@@ -1146,7 +1164,7 @@ private final Policy getIamPolicy(GetIamPolicyRequest request) {
*
*
* try (SubscriberClient subscriberClient = SubscriberClient.create()) {
- * String formattedResource = SubscriberClient.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
+ * String formattedResource = SubscriptionName.create("[PROJECT]", "[SUBSCRIPTION]").toString();
* GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder()
* .setResource(formattedResource)
* .build();
@@ -1162,13 +1180,14 @@ public final UnaryCallable
* try (SubscriberClient subscriberClient = SubscriberClient.create()) {
- * String formattedResource = SubscriberClient.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
+ * String formattedResource = SubscriptionName.create("[PROJECT]", "[SUBSCRIPTION]").toString();
* List<String> permissions = new ArrayList<>();
* TestIamPermissionsResponse response = subscriberClient.testIamPermissions(formattedResource, permissions);
* }
@@ -1184,7 +1203,7 @@ public final UnaryCallable
* try (SubscriberClient subscriberClient = SubscriberClient.create()) {
- * String formattedResource = SubscriberClient.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
+ * String formattedResource = SubscriptionName.create("[PROJECT]", "[SUBSCRIPTION]").toString();
* List<String> permissions = new ArrayList<>();
* TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder()
* .setResource(formattedResource)
@@ -1220,13 +1240,14 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
- * Returns permissions that a caller has on the specified resource.
+ * Returns permissions that a caller has on the specified resource. If the resource does not
+ * exist, this will return an empty set of permissions, not a NOT_FOUND error.
*
*
* try (SubscriberClient subscriberClient = SubscriberClient.create()) {
- * String formattedResource = SubscriberClient.formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
+ * String formattedResource = SubscriptionName.create("[PROJECT]", "[SUBSCRIPTION]").toString();
* List<String> permissions = new ArrayList<>();
* TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder()
* .setResource(formattedResource)
diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberSettings.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberSettings.java
index 971e00f2df72..1366d8e10e90 100644
--- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberSettings.java
+++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberSettings.java
@@ -29,6 +29,7 @@
import com.google.api.gax.grpc.PagedListDescriptor;
import com.google.api.gax.grpc.PagedListResponseFactory;
import com.google.api.gax.grpc.SimpleCallSettings;
+import com.google.api.gax.grpc.StreamingCallSettings;
import com.google.api.gax.grpc.UnaryCallSettings;
import com.google.api.gax.grpc.UnaryCallable;
import com.google.common.collect.ImmutableList;
@@ -53,6 +54,8 @@
import com.google.pubsub.v1.ModifyPushConfigRequest;
import com.google.pubsub.v1.PullRequest;
import com.google.pubsub.v1.PullResponse;
+import com.google.pubsub.v1.StreamingPullRequest;
+import com.google.pubsub.v1.StreamingPullResponse;
import com.google.pubsub.v1.SubscriberGrpc;
import com.google.pubsub.v1.Subscription;
import io.grpc.Status;
@@ -111,6 +114,8 @@ public class SubscriberSettings extends ClientSettings {
private final SimpleCallSettings
@@ -40,6 +42,8 @@
*
diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/spi/v1/MockSubscriberImpl.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/spi/v1/MockSubscriberImpl.java
index 2bfcd52631d0..cb589e8e0028 100644
--- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/spi/v1/MockSubscriberImpl.java
+++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/spi/v1/MockSubscriberImpl.java
@@ -26,6 +26,8 @@
import com.google.pubsub.v1.ModifyPushConfigRequest;
import com.google.pubsub.v1.PullRequest;
import com.google.pubsub.v1.PullResponse;
+import com.google.pubsub.v1.StreamingPullRequest;
+import com.google.pubsub.v1.StreamingPullResponse;
import com.google.pubsub.v1.SubscriberGrpc.SubscriberImplBase;
import com.google.pubsub.v1.Subscription;
import io.grpc.stub.StreamObserver;
@@ -169,6 +171,36 @@ public void pull(PullRequest request, StreamObserver