seekCallable() {
/**
* Sets the access control policy on the specified resource. Replaces any existing policy.
*
- * Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED
+ *
Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
*
*
Sample code:
*
@@ -2046,7 +2151,7 @@ public final Policy setIamPolicy(String resource, Policy policy) {
/**
* Sets the access control policy on the specified resource. Replaces any existing policy.
*
- *
Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED
+ *
Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
*
*
Sample code:
*
@@ -2142,7 +2247,7 @@ public final UnaryCallable getIamPolicyCallable() {
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* 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.
+ * exist, this will return an empty set of permissions, not a `NOT_FOUND` error.
*
* Note: This operation is designed to be used for building permission-aware UIs and
* command-line tools, not for authorization checking. This operation may "fail open" without
@@ -2209,7 +2314,7 @@ public final TestIamPermissionsResponse testIamPermissions(
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* 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.
+ * exist, this will return an empty set of permissions, not a `NOT_FOUND` error.
*
*
Note: This operation is designed to be used for building permission-aware UIs and
* command-line tools, not for authorization checking. This operation may "fail open" without
diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriptionAdminSettings.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriptionAdminSettings.java
index 32e5a6c5c..06d12d8ff 100644
--- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriptionAdminSettings.java
+++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriptionAdminSettings.java
@@ -41,6 +41,7 @@
import com.google.pubsub.v1.CreateSnapshotRequest;
import com.google.pubsub.v1.DeleteSnapshotRequest;
import com.google.pubsub.v1.DeleteSubscriptionRequest;
+import com.google.pubsub.v1.GetSnapshotRequest;
import com.google.pubsub.v1.GetSubscriptionRequest;
import com.google.pubsub.v1.ListSnapshotsRequest;
import com.google.pubsub.v1.ListSnapshotsResponse;
@@ -122,6 +123,11 @@ public UnaryCallSettings deleteSubscriptionSet
return ((SubscriberStubSettings) getStubSettings()).deleteSubscriptionSettings();
}
+ /** Returns the object with the settings used for calls to getSnapshot. */
+ /* package-private */ UnaryCallSettings getSnapshotSettings() {
+ return ((SubscriberStubSettings) getStubSettings()).getSnapshotSettings();
+ }
+
/** Returns the object with the settings used for calls to modifyAckDeadline. */
/* package-private */ UnaryCallSettings
modifyAckDeadlineSettings() {
@@ -318,6 +324,12 @@ public UnaryCallSettings.Builder createSubscriptionS
return getStubSettingsBuilder().deleteSubscriptionSettings();
}
+ /** Returns the builder for the settings used for calls to getSnapshot. */
+ /* package-private */ UnaryCallSettings.Builder
+ getSnapshotSettings() {
+ return getStubSettingsBuilder().getSnapshotSettings();
+ }
+
/** Returns the builder for the settings used for calls to modifyAckDeadline. */
/* package-private */ UnaryCallSettings.Builder
modifyAckDeadlineSettings() {
diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminClient.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminClient.java
index 11951c869..548523021 100644
--- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminClient.java
+++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminClient.java
@@ -38,6 +38,8 @@
import com.google.protobuf.Empty;
import com.google.pubsub.v1.DeleteTopicRequest;
import com.google.pubsub.v1.GetTopicRequest;
+import com.google.pubsub.v1.ListTopicSnapshotsRequest;
+import com.google.pubsub.v1.ListTopicSnapshotsResponse;
import com.google.pubsub.v1.ListTopicSubscriptionsRequest;
import com.google.pubsub.v1.ListTopicSubscriptionsResponse;
import com.google.pubsub.v1.ListTopicsRequest;
@@ -883,6 +885,157 @@ public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions(
return stub.listTopicSubscriptionsCallable();
}
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Lists the names of the snapshots on this topic. Snapshots are used in <a
+ * href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a> operations, which
+ * allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment
+ * state of messages in an existing subscription to the state captured by a snapshot.
+ *
+ * Sample code:
+ *
+ *
+ * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+ * TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
+ * for (String element : topicAdminClient.listTopicSnapshots(topic).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param topic Required. The name of the topic that snapshots are attached to. Format is
+ * `projects/{project}/topics/{topic}`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ /* package-private */ final ListTopicSnapshotsPagedResponse listTopicSnapshots(TopicName topic) {
+ ListTopicSnapshotsRequest request =
+ ListTopicSnapshotsRequest.newBuilder()
+ .setTopic(topic == null ? null : topic.toString())
+ .build();
+ return listTopicSnapshots(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Lists the names of the snapshots on this topic. Snapshots are used in <a
+ * href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a> operations, which
+ * allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment
+ * state of messages in an existing subscription to the state captured by a snapshot.
+ *
+ * Sample code:
+ *
+ *
+ * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+ * TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
+ * for (String element : topicAdminClient.listTopicSnapshots(topic.toString()).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param topic Required. The name of the topic that snapshots are attached to. Format is
+ * `projects/{project}/topics/{topic}`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ /* package-private */ final ListTopicSnapshotsPagedResponse listTopicSnapshots(String topic) {
+ ListTopicSnapshotsRequest request =
+ ListTopicSnapshotsRequest.newBuilder().setTopic(topic).build();
+ return listTopicSnapshots(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Lists the names of the snapshots on this topic. Snapshots are used in <a
+ * href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a> operations, which
+ * allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment
+ * state of messages in an existing subscription to the state captured by a snapshot.
+ *
+ * Sample code:
+ *
+ *
+ * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+ * TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
+ * ListTopicSnapshotsRequest request = ListTopicSnapshotsRequest.newBuilder()
+ * .setTopic(topic.toString())
+ * .build();
+ * for (String element : topicAdminClient.listTopicSnapshots(request).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ /* package-private */ final ListTopicSnapshotsPagedResponse listTopicSnapshots(
+ ListTopicSnapshotsRequest request) {
+ return listTopicSnapshotsPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Lists the names of the snapshots on this topic. Snapshots are used in <a
+ * href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a> operations, which
+ * allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment
+ * state of messages in an existing subscription to the state captured by a snapshot.
+ *
+ * Sample code:
+ *
+ *
+ * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+ * TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
+ * ListTopicSnapshotsRequest request = ListTopicSnapshotsRequest.newBuilder()
+ * .setTopic(topic.toString())
+ * .build();
+ * ApiFuture<ListTopicSnapshotsPagedResponse> future = topicAdminClient.listTopicSnapshotsPagedCallable().futureCall(request);
+ * // Do something
+ * for (String element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ */
+ /* package-private */ final UnaryCallable<
+ ListTopicSnapshotsRequest, ListTopicSnapshotsPagedResponse>
+ listTopicSnapshotsPagedCallable() {
+ return stub.listTopicSnapshotsPagedCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Lists the names of the snapshots on this topic. Snapshots are used in <a
+ * href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a> operations, which
+ * allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment
+ * state of messages in an existing subscription to the state captured by a snapshot.
+ *
+ * Sample code:
+ *
+ *
+ * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+ * TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
+ * ListTopicSnapshotsRequest request = ListTopicSnapshotsRequest.newBuilder()
+ * .setTopic(topic.toString())
+ * .build();
+ * while (true) {
+ * ListTopicSnapshotsResponse response = topicAdminClient.listTopicSnapshotsCallable().call(request);
+ * for (String element : response.getSnapshotsList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ *
+ */
+ /* package-private */ final UnaryCallable
+ listTopicSnapshotsCallable() {
+ return stub.listTopicSnapshotsCallable();
+ }
+
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Deletes the topic with the given name. Returns `NOT_FOUND` if the topic does not exist. After a
@@ -1016,7 +1169,7 @@ public final UnaryCallable deleteTopicCallable() {
/**
* Sets the access control policy on the specified resource. Replaces any existing policy.
*
- * Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED
+ *
Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
*
*
Sample code:
*
@@ -1073,7 +1226,7 @@ public final Policy setIamPolicy(String resource, Policy policy) {
/**
* Sets the access control policy on the specified resource. Replaces any existing policy.
*
- *
Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED
+ *
Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
*
*
Sample code:
*
@@ -1169,7 +1322,7 @@ public final UnaryCallable getIamPolicyCallable() {
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* 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.
+ * exist, this will return an empty set of permissions, not a `NOT_FOUND` error.
*
* Note: This operation is designed to be used for building permission-aware UIs and
* command-line tools, not for authorization checking. This operation may "fail open" without
@@ -1236,7 +1389,7 @@ public final TestIamPermissionsResponse testIamPermissions(
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* 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.
+ * exist, this will return an empty set of permissions, not a `NOT_FOUND` error.
*
*
Note: This operation is designed to be used for building permission-aware UIs and
* command-line tools, not for authorization checking. This operation may "fail open" without
@@ -1501,4 +1654,86 @@ public ProjectSubscriptionName apply(String arg0) {
});
}
}
+
+ public static class ListTopicSnapshotsPagedResponse
+ extends AbstractPagedListResponse<
+ ListTopicSnapshotsRequest,
+ ListTopicSnapshotsResponse,
+ String,
+ ListTopicSnapshotsPage,
+ ListTopicSnapshotsFixedSizeCollection> {
+
+ public static ApiFuture createAsync(
+ PageContext context,
+ ApiFuture futureResponse) {
+ ApiFuture futurePage =
+ ListTopicSnapshotsPage.createEmptyPage().createPageAsync(context, futureResponse);
+ return ApiFutures.transform(
+ futurePage,
+ new ApiFunction() {
+ @Override
+ public ListTopicSnapshotsPagedResponse apply(ListTopicSnapshotsPage input) {
+ return new ListTopicSnapshotsPagedResponse(input);
+ }
+ },
+ MoreExecutors.directExecutor());
+ }
+
+ private ListTopicSnapshotsPagedResponse(ListTopicSnapshotsPage page) {
+ super(page, ListTopicSnapshotsFixedSizeCollection.createEmptyCollection());
+ }
+ }
+
+ public static class ListTopicSnapshotsPage
+ extends AbstractPage<
+ ListTopicSnapshotsRequest, ListTopicSnapshotsResponse, String, ListTopicSnapshotsPage> {
+
+ private ListTopicSnapshotsPage(
+ PageContext context,
+ ListTopicSnapshotsResponse response) {
+ super(context, response);
+ }
+
+ private static ListTopicSnapshotsPage createEmptyPage() {
+ return new ListTopicSnapshotsPage(null, null);
+ }
+
+ @Override
+ protected ListTopicSnapshotsPage createPage(
+ PageContext context,
+ ListTopicSnapshotsResponse response) {
+ return new ListTopicSnapshotsPage(context, response);
+ }
+
+ @Override
+ public ApiFuture createPageAsync(
+ PageContext context,
+ ApiFuture futureResponse) {
+ return super.createPageAsync(context, futureResponse);
+ }
+ }
+
+ public static class ListTopicSnapshotsFixedSizeCollection
+ extends AbstractFixedSizeCollection<
+ ListTopicSnapshotsRequest,
+ ListTopicSnapshotsResponse,
+ String,
+ ListTopicSnapshotsPage,
+ ListTopicSnapshotsFixedSizeCollection> {
+
+ private ListTopicSnapshotsFixedSizeCollection(
+ List pages, int collectionSize) {
+ super(pages, collectionSize);
+ }
+
+ private static ListTopicSnapshotsFixedSizeCollection createEmptyCollection() {
+ return new ListTopicSnapshotsFixedSizeCollection(null, 0);
+ }
+
+ @Override
+ protected ListTopicSnapshotsFixedSizeCollection createCollection(
+ List pages, int collectionSize) {
+ return new ListTopicSnapshotsFixedSizeCollection(pages, collectionSize);
+ }
+ }
}
diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminSettings.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminSettings.java
index 9b125b8cc..59119e19b 100644
--- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminSettings.java
+++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminSettings.java
@@ -15,6 +15,7 @@
*/
package com.google.cloud.pubsub.v1;
+import static com.google.cloud.pubsub.v1.TopicAdminClient.ListTopicSnapshotsPagedResponse;
import static com.google.cloud.pubsub.v1.TopicAdminClient.ListTopicSubscriptionsPagedResponse;
import static com.google.cloud.pubsub.v1.TopicAdminClient.ListTopicsPagedResponse;
@@ -39,6 +40,8 @@
import com.google.protobuf.Empty;
import com.google.pubsub.v1.DeleteTopicRequest;
import com.google.pubsub.v1.GetTopicRequest;
+import com.google.pubsub.v1.ListTopicSnapshotsRequest;
+import com.google.pubsub.v1.ListTopicSnapshotsResponse;
import com.google.pubsub.v1.ListTopicSubscriptionsRequest;
import com.google.pubsub.v1.ListTopicSubscriptionsResponse;
import com.google.pubsub.v1.ListTopicsRequest;
@@ -119,6 +122,13 @@ public UnaryCallSettings getTopicSettings() {
return ((PublisherStubSettings) getStubSettings()).listTopicSubscriptionsSettings();
}
+ /** Returns the object with the settings used for calls to listTopicSnapshots. */
+ /* package-private */ PagedCallSettings<
+ ListTopicSnapshotsRequest, ListTopicSnapshotsResponse, ListTopicSnapshotsPagedResponse>
+ listTopicSnapshotsSettings() {
+ return ((PublisherStubSettings) getStubSettings()).listTopicSnapshotsSettings();
+ }
+
/** Returns the object with the settings used for calls to deleteTopic. */
public UnaryCallSettings deleteTopicSettings() {
return ((PublisherStubSettings) getStubSettings()).deleteTopicSettings();
@@ -272,6 +282,13 @@ public UnaryCallSettings.Builder getTopicSettings() {
return getStubSettingsBuilder().listTopicSubscriptionsSettings();
}
+ /** Returns the builder for the settings used for calls to listTopicSnapshots. */
+ /* package-private */ PagedCallSettings.Builder<
+ ListTopicSnapshotsRequest, ListTopicSnapshotsResponse, ListTopicSnapshotsPagedResponse>
+ listTopicSnapshotsSettings() {
+ return getStubSettingsBuilder().listTopicSnapshotsSettings();
+ }
+
/** Returns the builder for the settings used for calls to deleteTopic. */
public UnaryCallSettings.Builder deleteTopicSettings() {
return getStubSettingsBuilder().deleteTopicSettings();
diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcPublisherStub.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcPublisherStub.java
index f42bb6bce..02baa7378 100644
--- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcPublisherStub.java
+++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcPublisherStub.java
@@ -15,6 +15,7 @@
*/
package com.google.cloud.pubsub.v1.stub;
+import static com.google.cloud.pubsub.v1.TopicAdminClient.ListTopicSnapshotsPagedResponse;
import static com.google.cloud.pubsub.v1.TopicAdminClient.ListTopicSubscriptionsPagedResponse;
import static com.google.cloud.pubsub.v1.TopicAdminClient.ListTopicsPagedResponse;
@@ -35,6 +36,8 @@
import com.google.protobuf.Empty;
import com.google.pubsub.v1.DeleteTopicRequest;
import com.google.pubsub.v1.GetTopicRequest;
+import com.google.pubsub.v1.ListTopicSnapshotsRequest;
+import com.google.pubsub.v1.ListTopicSnapshotsResponse;
import com.google.pubsub.v1.ListTopicSubscriptionsRequest;
import com.google.pubsub.v1.ListTopicSubscriptionsResponse;
import com.google.pubsub.v1.ListTopicsRequest;
@@ -108,6 +111,16 @@ public class GrpcPublisherStub extends PublisherStub {
.setResponseMarshaller(
ProtoUtils.marshaller(ListTopicSubscriptionsResponse.getDefaultInstance()))
.build();
+ private static final MethodDescriptor
+ listTopicSnapshotsMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName("google.pubsub.v1.Publisher/ListTopicSnapshots")
+ .setRequestMarshaller(
+ ProtoUtils.marshaller(ListTopicSnapshotsRequest.getDefaultInstance()))
+ .setResponseMarshaller(
+ ProtoUtils.marshaller(ListTopicSnapshotsResponse.getDefaultInstance()))
+ .build();
private static final MethodDescriptor deleteTopicMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
@@ -152,6 +165,10 @@ public class GrpcPublisherStub extends PublisherStub {
listTopicSubscriptionsCallable;
private final UnaryCallable
listTopicSubscriptionsPagedCallable;
+ private final UnaryCallable
+ listTopicSnapshotsCallable;
+ private final UnaryCallable
+ listTopicSnapshotsPagedCallable;
private final UnaryCallable deleteTopicCallable;
private final UnaryCallable setIamPolicyCallable;
private final UnaryCallable getIamPolicyCallable;
@@ -276,6 +293,20 @@ public Map extract(ListTopicSubscriptionsRequest request) {
}
})
.build();
+ GrpcCallSettings
+ listTopicSnapshotsTransportSettings =
+ GrpcCallSettings.newBuilder()
+ .setMethodDescriptor(listTopicSnapshotsMethodDescriptor)
+ .setParamsExtractor(
+ new RequestParamsExtractor() {
+ @Override
+ public Map extract(ListTopicSnapshotsRequest request) {
+ ImmutableMap.Builder params = ImmutableMap.builder();
+ params.put("topic", String.valueOf(request.getTopic()));
+ return params.build();
+ }
+ })
+ .build();
GrpcCallSettings deleteTopicTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(deleteTopicMethodDescriptor)
@@ -358,6 +389,16 @@ public Map extract(TestIamPermissionsRequest request) {
listTopicSubscriptionsTransportSettings,
settings.listTopicSubscriptionsSettings(),
clientContext);
+ this.listTopicSnapshotsCallable =
+ callableFactory.createUnaryCallable(
+ listTopicSnapshotsTransportSettings,
+ settings.listTopicSnapshotsSettings(),
+ clientContext);
+ this.listTopicSnapshotsPagedCallable =
+ callableFactory.createPagedCallable(
+ listTopicSnapshotsTransportSettings,
+ settings.listTopicSnapshotsSettings(),
+ clientContext);
this.deleteTopicCallable =
callableFactory.createUnaryCallable(
deleteTopicTransportSettings, settings.deleteTopicSettings(), clientContext);
@@ -410,6 +451,16 @@ public UnaryCallable listTopicsCallable()
return listTopicSubscriptionsCallable;
}
+ public UnaryCallable
+ listTopicSnapshotsPagedCallable() {
+ return listTopicSnapshotsPagedCallable;
+ }
+
+ public UnaryCallable
+ listTopicSnapshotsCallable() {
+ return listTopicSnapshotsCallable;
+ }
+
public UnaryCallable deleteTopicCallable() {
return deleteTopicCallable;
}
diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcSubscriberStub.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcSubscriberStub.java
index 5b2310807..6d5ecda6e 100644
--- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcSubscriberStub.java
+++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcSubscriberStub.java
@@ -38,6 +38,7 @@
import com.google.pubsub.v1.CreateSnapshotRequest;
import com.google.pubsub.v1.DeleteSnapshotRequest;
import com.google.pubsub.v1.DeleteSubscriptionRequest;
+import com.google.pubsub.v1.GetSnapshotRequest;
import com.google.pubsub.v1.GetSubscriptionRequest;
import com.google.pubsub.v1.ListSnapshotsRequest;
import com.google.pubsub.v1.ListSnapshotsResponse;
@@ -117,6 +118,13 @@ public class GrpcSubscriberStub extends SubscriberStub {
ProtoUtils.marshaller(DeleteSubscriptionRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance()))
.build();
+ private static final MethodDescriptor getSnapshotMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName("google.pubsub.v1.Subscriber/GetSnapshot")
+ .setRequestMarshaller(ProtoUtils.marshaller(GetSnapshotRequest.getDefaultInstance()))
+ .setResponseMarshaller(ProtoUtils.marshaller(Snapshot.getDefaultInstance()))
+ .build();
private static final MethodDescriptor
modifyAckDeadlineMethodDescriptor =
MethodDescriptor.newBuilder()
@@ -238,6 +246,7 @@ public class GrpcSubscriberStub extends SubscriberStub {
private final UnaryCallable
listSubscriptionsPagedCallable;
private final UnaryCallable deleteSubscriptionCallable;
+ private final UnaryCallable getSnapshotCallable;
private final UnaryCallable modifyAckDeadlineCallable;
private final UnaryCallable acknowledgeCallable;
private final UnaryCallable pullCallable;
@@ -362,6 +371,19 @@ public Map extract(DeleteSubscriptionRequest request) {
}
})
.build();
+ GrpcCallSettings getSnapshotTransportSettings =
+ GrpcCallSettings.newBuilder()
+ .setMethodDescriptor(getSnapshotMethodDescriptor)
+ .setParamsExtractor(
+ new RequestParamsExtractor() {
+ @Override
+ public Map extract(GetSnapshotRequest request) {
+ ImmutableMap.Builder params = ImmutableMap.builder();
+ params.put("snapshot", String.valueOf(request.getSnapshot()));
+ return params.build();
+ }
+ })
+ .build();
GrpcCallSettings modifyAckDeadlineTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(modifyAckDeadlineMethodDescriptor)
@@ -552,6 +574,9 @@ public Map extract(TestIamPermissionsRequest request) {
deleteSubscriptionTransportSettings,
settings.deleteSubscriptionSettings(),
clientContext);
+ this.getSnapshotCallable =
+ callableFactory.createUnaryCallable(
+ getSnapshotTransportSettings, settings.getSnapshotSettings(), clientContext);
this.modifyAckDeadlineCallable =
callableFactory.createUnaryCallable(
modifyAckDeadlineTransportSettings,
@@ -628,6 +653,10 @@ public UnaryCallable deleteSubscriptionCallabl
return deleteSubscriptionCallable;
}
+ public UnaryCallable getSnapshotCallable() {
+ return getSnapshotCallable;
+ }
+
public UnaryCallable modifyAckDeadlineCallable() {
return modifyAckDeadlineCallable;
}
diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStub.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStub.java
index 65956640f..6ff2d02f8 100644
--- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStub.java
+++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStub.java
@@ -15,6 +15,7 @@
*/
package com.google.cloud.pubsub.v1.stub;
+import static com.google.cloud.pubsub.v1.TopicAdminClient.ListTopicSnapshotsPagedResponse;
import static com.google.cloud.pubsub.v1.TopicAdminClient.ListTopicSubscriptionsPagedResponse;
import static com.google.cloud.pubsub.v1.TopicAdminClient.ListTopicsPagedResponse;
@@ -29,6 +30,8 @@
import com.google.protobuf.Empty;
import com.google.pubsub.v1.DeleteTopicRequest;
import com.google.pubsub.v1.GetTopicRequest;
+import com.google.pubsub.v1.ListTopicSnapshotsRequest;
+import com.google.pubsub.v1.ListTopicSnapshotsResponse;
import com.google.pubsub.v1.ListTopicSubscriptionsRequest;
import com.google.pubsub.v1.ListTopicSubscriptionsResponse;
import com.google.pubsub.v1.ListTopicsRequest;
@@ -84,6 +87,16 @@ public UnaryCallable listTopicsCallable()
throw new UnsupportedOperationException("Not implemented: listTopicSubscriptionsCallable()");
}
+ public UnaryCallable
+ listTopicSnapshotsPagedCallable() {
+ throw new UnsupportedOperationException("Not implemented: listTopicSnapshotsPagedCallable()");
+ }
+
+ public UnaryCallable
+ listTopicSnapshotsCallable() {
+ throw new UnsupportedOperationException("Not implemented: listTopicSnapshotsCallable()");
+ }
+
public UnaryCallable deleteTopicCallable() {
throw new UnsupportedOperationException("Not implemented: deleteTopicCallable()");
}
diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStubSettings.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStubSettings.java
index d47225785..ee84a4ab3 100644
--- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStubSettings.java
+++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStubSettings.java
@@ -15,6 +15,7 @@
*/
package com.google.cloud.pubsub.v1.stub;
+import static com.google.cloud.pubsub.v1.TopicAdminClient.ListTopicSnapshotsPagedResponse;
import static com.google.cloud.pubsub.v1.TopicAdminClient.ListTopicSubscriptionsPagedResponse;
import static com.google.cloud.pubsub.v1.TopicAdminClient.ListTopicsPagedResponse;
@@ -60,6 +61,8 @@
import com.google.protobuf.Empty;
import com.google.pubsub.v1.DeleteTopicRequest;
import com.google.pubsub.v1.GetTopicRequest;
+import com.google.pubsub.v1.ListTopicSnapshotsRequest;
+import com.google.pubsub.v1.ListTopicSnapshotsResponse;
import com.google.pubsub.v1.ListTopicSubscriptionsRequest;
import com.google.pubsub.v1.ListTopicSubscriptionsResponse;
import com.google.pubsub.v1.ListTopicsRequest;
@@ -126,6 +129,9 @@ public class PublisherStubSettings extends StubSettings {
ListTopicSubscriptionsResponse,
ListTopicSubscriptionsPagedResponse>
listTopicSubscriptionsSettings;
+ private final PagedCallSettings<
+ ListTopicSnapshotsRequest, ListTopicSnapshotsResponse, ListTopicSnapshotsPagedResponse>
+ listTopicSnapshotsSettings;
private final UnaryCallSettings deleteTopicSettings;
private final UnaryCallSettings setIamPolicySettings;
private final UnaryCallSettings getIamPolicySettings;
@@ -167,6 +173,13 @@ public UnaryCallSettings getTopicSettings() {
return listTopicSubscriptionsSettings;
}
+ /** Returns the object with the settings used for calls to listTopicSnapshots. */
+ public PagedCallSettings<
+ ListTopicSnapshotsRequest, ListTopicSnapshotsResponse, ListTopicSnapshotsPagedResponse>
+ listTopicSnapshotsSettings() {
+ return listTopicSnapshotsSettings;
+ }
+
/** Returns the object with the settings used for calls to deleteTopic. */
public UnaryCallSettings deleteTopicSettings() {
return deleteTopicSettings;
@@ -262,6 +275,7 @@ protected PublisherStubSettings(Builder settingsBuilder) throws IOException {
getTopicSettings = settingsBuilder.getTopicSettings().build();
listTopicsSettings = settingsBuilder.listTopicsSettings().build();
listTopicSubscriptionsSettings = settingsBuilder.listTopicSubscriptionsSettings().build();
+ listTopicSnapshotsSettings = settingsBuilder.listTopicSnapshotsSettings().build();
deleteTopicSettings = settingsBuilder.deleteTopicSettings().build();
setIamPolicySettings = settingsBuilder.setIamPolicySettings().build();
getIamPolicySettings = settingsBuilder.getIamPolicySettings().build();
@@ -346,6 +360,45 @@ public Iterable extractResources(ListTopicSubscriptionsResponse payload)
}
};
+ private static final PagedListDescriptor<
+ ListTopicSnapshotsRequest, ListTopicSnapshotsResponse, String>
+ LIST_TOPIC_SNAPSHOTS_PAGE_STR_DESC =
+ new PagedListDescriptor() {
+ @Override
+ public String emptyToken() {
+ return "";
+ }
+
+ @Override
+ public ListTopicSnapshotsRequest injectToken(
+ ListTopicSnapshotsRequest payload, String token) {
+ return ListTopicSnapshotsRequest.newBuilder(payload).setPageToken(token).build();
+ }
+
+ @Override
+ public ListTopicSnapshotsRequest injectPageSize(
+ ListTopicSnapshotsRequest payload, int pageSize) {
+ return ListTopicSnapshotsRequest.newBuilder(payload).setPageSize(pageSize).build();
+ }
+
+ @Override
+ public Integer extractPageSize(ListTopicSnapshotsRequest payload) {
+ return payload.getPageSize();
+ }
+
+ @Override
+ public String extractNextToken(ListTopicSnapshotsResponse payload) {
+ return payload.getNextPageToken();
+ }
+
+ @Override
+ public Iterable extractResources(ListTopicSnapshotsResponse payload) {
+ return payload.getSnapshotsList() != null
+ ? payload.getSnapshotsList()
+ : ImmutableList.of();
+ }
+ };
+
private static final PagedListResponseFactory<
ListTopicsRequest, ListTopicsResponse, ListTopicsPagedResponse>
LIST_TOPICS_PAGE_STR_FACT =
@@ -387,6 +440,27 @@ public ApiFuture getFuturePagedResponse(
}
};
+ private static final PagedListResponseFactory<
+ ListTopicSnapshotsRequest, ListTopicSnapshotsResponse, ListTopicSnapshotsPagedResponse>
+ LIST_TOPIC_SNAPSHOTS_PAGE_STR_FACT =
+ new PagedListResponseFactory<
+ ListTopicSnapshotsRequest,
+ ListTopicSnapshotsResponse,
+ ListTopicSnapshotsPagedResponse>() {
+ @Override
+ public ApiFuture getFuturePagedResponse(
+ UnaryCallable callable,
+ ListTopicSnapshotsRequest request,
+ ApiCallContext context,
+ ApiFuture futureResponse) {
+ PageContext
+ pageContext =
+ PageContext.create(
+ callable, LIST_TOPIC_SNAPSHOTS_PAGE_STR_DESC, request, context);
+ return ListTopicSnapshotsPagedResponse.createAsync(pageContext, futureResponse);
+ }
+ };
+
private static final BatchingDescriptor PUBLISH_BATCHING_DESC =
new BatchingDescriptor() {
@Override
@@ -469,6 +543,9 @@ public static class Builder extends StubSettings.Builder
listTopicSubscriptionsSettings;
+ private final PagedCallSettings.Builder<
+ ListTopicSnapshotsRequest, ListTopicSnapshotsResponse, ListTopicSnapshotsPagedResponse>
+ listTopicSnapshotsSettings;
private final UnaryCallSettings.Builder deleteTopicSettings;
private final UnaryCallSettings.Builder setIamPolicySettings;
private final UnaryCallSettings.Builder getIamPolicySettings;
@@ -489,6 +566,11 @@ public static class Builder extends StubSettings.BuildernewArrayList(StatusCode.Code.UNAVAILABLE)));
+ definitions.put(
+ "idempotent2",
+ ImmutableSet.copyOf(
+ Lists.newArrayList(
+ StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
definitions.put("none", ImmutableSet.copyOf(Lists.newArrayList()));
definitions.put(
"publish",
@@ -556,6 +638,8 @@ protected Builder(ClientContext clientContext) {
listTopicSubscriptionsSettings =
PagedCallSettings.newBuilder(LIST_TOPIC_SUBSCRIPTIONS_PAGE_STR_FACT);
+ listTopicSnapshotsSettings = PagedCallSettings.newBuilder(LIST_TOPIC_SNAPSHOTS_PAGE_STR_FACT);
+
deleteTopicSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
setIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
@@ -572,6 +656,7 @@ protected Builder(ClientContext clientContext) {
getTopicSettings,
listTopicsSettings,
listTopicSubscriptionsSettings,
+ listTopicSnapshotsSettings,
deleteTopicSettings,
setIamPolicySettings,
getIamPolicySettings,
@@ -633,6 +718,11 @@ private static Builder initDefaults(Builder builder) {
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
+ builder
+ .listTopicSnapshotsSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent2"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
+
builder
.deleteTopicSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
@@ -665,6 +755,7 @@ protected Builder(PublisherStubSettings settings) {
getTopicSettings = settings.getTopicSettings.toBuilder();
listTopicsSettings = settings.listTopicsSettings.toBuilder();
listTopicSubscriptionsSettings = settings.listTopicSubscriptionsSettings.toBuilder();
+ listTopicSnapshotsSettings = settings.listTopicSnapshotsSettings.toBuilder();
deleteTopicSettings = settings.deleteTopicSettings.toBuilder();
setIamPolicySettings = settings.setIamPolicySettings.toBuilder();
getIamPolicySettings = settings.getIamPolicySettings.toBuilder();
@@ -678,6 +769,7 @@ protected Builder(PublisherStubSettings settings) {
getTopicSettings,
listTopicsSettings,
listTopicSubscriptionsSettings,
+ listTopicSnapshotsSettings,
deleteTopicSettings,
setIamPolicySettings,
getIamPolicySettings,
@@ -735,6 +827,13 @@ public UnaryCallSettings.Builder getTopicSettings() {
return listTopicSubscriptionsSettings;
}
+ /** Returns the builder for the settings used for calls to listTopicSnapshots. */
+ public PagedCallSettings.Builder<
+ ListTopicSnapshotsRequest, ListTopicSnapshotsResponse, ListTopicSnapshotsPagedResponse>
+ listTopicSnapshotsSettings() {
+ return listTopicSnapshotsSettings;
+ }
+
/** Returns the builder for the settings used for calls to deleteTopic. */
public UnaryCallSettings.Builder deleteTopicSettings() {
return deleteTopicSettings;
diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/SubscriberStub.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/SubscriberStub.java
index 66f365ee0..da19f2a6f 100644
--- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/SubscriberStub.java
+++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/SubscriberStub.java
@@ -32,6 +32,7 @@
import com.google.pubsub.v1.CreateSnapshotRequest;
import com.google.pubsub.v1.DeleteSnapshotRequest;
import com.google.pubsub.v1.DeleteSubscriptionRequest;
+import com.google.pubsub.v1.GetSnapshotRequest;
import com.google.pubsub.v1.GetSubscriptionRequest;
import com.google.pubsub.v1.ListSnapshotsRequest;
import com.google.pubsub.v1.ListSnapshotsResponse;
@@ -87,6 +88,10 @@ public UnaryCallable deleteSubscriptionCallabl
throw new UnsupportedOperationException("Not implemented: deleteSubscriptionCallable()");
}
+ public UnaryCallable getSnapshotCallable() {
+ throw new UnsupportedOperationException("Not implemented: getSnapshotCallable()");
+ }
+
public UnaryCallable modifyAckDeadlineCallable() {
throw new UnsupportedOperationException("Not implemented: modifyAckDeadlineCallable()");
}
diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/SubscriberStubSettings.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/SubscriberStubSettings.java
index 2b2276135..a6d1a9826 100644
--- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/SubscriberStubSettings.java
+++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/SubscriberStubSettings.java
@@ -55,6 +55,7 @@
import com.google.pubsub.v1.CreateSnapshotRequest;
import com.google.pubsub.v1.DeleteSnapshotRequest;
import com.google.pubsub.v1.DeleteSubscriptionRequest;
+import com.google.pubsub.v1.GetSnapshotRequest;
import com.google.pubsub.v1.GetSubscriptionRequest;
import com.google.pubsub.v1.ListSnapshotsRequest;
import com.google.pubsub.v1.ListSnapshotsResponse;
@@ -125,6 +126,7 @@ public class SubscriberStubSettings extends StubSettings
ListSubscriptionsRequest, ListSubscriptionsResponse, ListSubscriptionsPagedResponse>
listSubscriptionsSettings;
private final UnaryCallSettings deleteSubscriptionSettings;
+ private final UnaryCallSettings getSnapshotSettings;
private final UnaryCallSettings modifyAckDeadlineSettings;
private final UnaryCallSettings acknowledgeSettings;
private final UnaryCallSettings pullSettings;
@@ -170,6 +172,11 @@ public UnaryCallSettings deleteSubscriptionSet
return deleteSubscriptionSettings;
}
+ /** Returns the object with the settings used for calls to getSnapshot. */
+ public UnaryCallSettings getSnapshotSettings() {
+ return getSnapshotSettings;
+ }
+
/** Returns the object with the settings used for calls to modifyAckDeadline. */
public UnaryCallSettings modifyAckDeadlineSettings() {
return modifyAckDeadlineSettings;
@@ -311,6 +318,7 @@ protected SubscriberStubSettings(Builder settingsBuilder) throws IOException {
updateSubscriptionSettings = settingsBuilder.updateSubscriptionSettings().build();
listSubscriptionsSettings = settingsBuilder.listSubscriptionsSettings().build();
deleteSubscriptionSettings = settingsBuilder.deleteSubscriptionSettings().build();
+ getSnapshotSettings = settingsBuilder.getSnapshotSettings().build();
modifyAckDeadlineSettings = settingsBuilder.modifyAckDeadlineSettings().build();
acknowledgeSettings = settingsBuilder.acknowledgeSettings().build();
pullSettings = settingsBuilder.pullSettings().build();
@@ -454,6 +462,7 @@ public static class Builder extends StubSettings.Builder
deleteSubscriptionSettings;
+ private final UnaryCallSettings.Builder getSnapshotSettings;
private final UnaryCallSettings.Builder
modifyAckDeadlineSettings;
private final UnaryCallSettings.Builder acknowledgeSettings;
@@ -488,6 +497,11 @@ public static class Builder extends StubSettings.BuildernewArrayList(StatusCode.Code.UNAVAILABLE)));
+ definitions.put(
+ "idempotent2",
+ ImmutableSet.copyOf(
+ Lists.newArrayList(
+ StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
definitions.put(
"streaming_pull",
ImmutableSet.copyOf(
@@ -558,6 +572,8 @@ protected Builder(ClientContext clientContext) {
deleteSubscriptionSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+ getSnapshotSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+
modifyAckDeadlineSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
acknowledgeSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
@@ -591,6 +607,7 @@ protected Builder(ClientContext clientContext) {
updateSubscriptionSettings,
listSubscriptionsSettings,
deleteSubscriptionSettings,
+ getSnapshotSettings,
modifyAckDeadlineSettings,
acknowledgeSettings,
pullSettings,
@@ -643,6 +660,11 @@ private static Builder initDefaults(Builder builder) {
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
+ builder
+ .getSnapshotSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent2"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
+
builder
.modifyAckDeadlineSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
@@ -714,6 +736,7 @@ protected Builder(SubscriberStubSettings settings) {
updateSubscriptionSettings = settings.updateSubscriptionSettings.toBuilder();
listSubscriptionsSettings = settings.listSubscriptionsSettings.toBuilder();
deleteSubscriptionSettings = settings.deleteSubscriptionSettings.toBuilder();
+ getSnapshotSettings = settings.getSnapshotSettings.toBuilder();
modifyAckDeadlineSettings = settings.modifyAckDeadlineSettings.toBuilder();
acknowledgeSettings = settings.acknowledgeSettings.toBuilder();
pullSettings = settings.pullSettings.toBuilder();
@@ -735,6 +758,7 @@ protected Builder(SubscriberStubSettings settings) {
updateSubscriptionSettings,
listSubscriptionsSettings,
deleteSubscriptionSettings,
+ getSnapshotSettings,
modifyAckDeadlineSettings,
acknowledgeSettings,
pullSettings,
@@ -795,6 +819,11 @@ public UnaryCallSettings.Builder createSubscriptionS
return deleteSubscriptionSettings;
}
+ /** Returns the builder for the settings used for calls to getSnapshot. */
+ public UnaryCallSettings.Builder getSnapshotSettings() {
+ return getSnapshotSettings;
+ }
+
/** Returns the builder for the settings used for calls to modifyAckDeadline. */
public UnaryCallSettings.Builder modifyAckDeadlineSettings() {
return modifyAckDeadlineSettings;
diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockPublisherImpl.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockPublisherImpl.java
index a8c18fb04..0d49c4288 100644
--- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockPublisherImpl.java
+++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockPublisherImpl.java
@@ -20,6 +20,8 @@
import com.google.protobuf.Empty;
import com.google.pubsub.v1.DeleteTopicRequest;
import com.google.pubsub.v1.GetTopicRequest;
+import com.google.pubsub.v1.ListTopicSnapshotsRequest;
+import com.google.pubsub.v1.ListTopicSnapshotsResponse;
import com.google.pubsub.v1.ListTopicSubscriptionsRequest;
import com.google.pubsub.v1.ListTopicSubscriptionsResponse;
import com.google.pubsub.v1.ListTopicsRequest;
@@ -154,6 +156,22 @@ public void listTopicSubscriptions(
}
}
+ @Override
+ public void listTopicSnapshots(
+ ListTopicSnapshotsRequest request,
+ StreamObserver responseObserver) {
+ Object response = responses.remove();
+ if (response instanceof ListTopicSnapshotsResponse) {
+ requests.add(request);
+ responseObserver.onNext((ListTopicSnapshotsResponse) response);
+ responseObserver.onCompleted();
+ } else if (response instanceof Exception) {
+ responseObserver.onError((Exception) response);
+ } else {
+ responseObserver.onError(new IllegalArgumentException("Unrecognized response type"));
+ }
+ }
+
@Override
public void deleteTopic(DeleteTopicRequest request, StreamObserver responseObserver) {
Object response = responses.remove();
diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockSubscriberImpl.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockSubscriberImpl.java
index 2e9e647e6..3d3c2013d 100644
--- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockSubscriberImpl.java
+++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockSubscriberImpl.java
@@ -22,6 +22,7 @@
import com.google.pubsub.v1.CreateSnapshotRequest;
import com.google.pubsub.v1.DeleteSnapshotRequest;
import com.google.pubsub.v1.DeleteSubscriptionRequest;
+import com.google.pubsub.v1.GetSnapshotRequest;
import com.google.pubsub.v1.GetSubscriptionRequest;
import com.google.pubsub.v1.ListSnapshotsRequest;
import com.google.pubsub.v1.ListSnapshotsResponse;
@@ -200,11 +201,12 @@ public void pull(PullRequest request, StreamObserver responseObser
@Override
public StreamObserver streamingPull(
final StreamObserver responseObserver) {
- final Object response = responses.remove();
StreamObserver requestObserver =
new StreamObserver() {
@Override
public void onNext(StreamingPullRequest value) {
+ requests.add(value);
+ final Object response = responses.remove();
if (response instanceof StreamingPullResponse) {
responseObserver.onNext((StreamingPullResponse) response);
} else if (response instanceof Exception) {
@@ -242,6 +244,20 @@ public void modifyPushConfig(
}
}
+ @Override
+ public void getSnapshot(GetSnapshotRequest request, StreamObserver responseObserver) {
+ Object response = responses.remove();
+ if (response instanceof Snapshot) {
+ requests.add(request);
+ responseObserver.onNext((Snapshot) response);
+ responseObserver.onCompleted();
+ } else if (response instanceof Exception) {
+ responseObserver.onError((Exception) response);
+ } else {
+ responseObserver.onError(new IllegalArgumentException("Unrecognized response type"));
+ }
+ }
+
@Override
public void listSnapshots(
ListSnapshotsRequest request, StreamObserver responseObserver) {
diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/SubscriptionAdminClientTest.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/SubscriptionAdminClientTest.java
index bfe959b50..2d40f14bf 100644
--- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/SubscriptionAdminClientTest.java
+++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/SubscriptionAdminClientTest.java
@@ -45,6 +45,7 @@
import com.google.pubsub.v1.CreateSnapshotRequest;
import com.google.pubsub.v1.DeleteSnapshotRequest;
import com.google.pubsub.v1.DeleteSubscriptionRequest;
+import com.google.pubsub.v1.GetSnapshotRequest;
import com.google.pubsub.v1.GetSubscriptionRequest;
import com.google.pubsub.v1.ListSnapshotsRequest;
import com.google.pubsub.v1.ListSnapshotsResponse;
@@ -404,6 +405,47 @@ public void deleteSubscriptionExceptionTest() throws Exception {
}
}
+ @Test
+ @SuppressWarnings("all")
+ public void getSnapshotTest() {
+ ProjectSnapshotName name = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
+ TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
+ Snapshot expectedResponse =
+ Snapshot.newBuilder().setName(name.toString()).setTopic(topic.toString()).build();
+ mockSubscriber.addResponse(expectedResponse);
+
+ ProjectSnapshotName snapshot = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
+
+ Snapshot actualResponse = client.getSnapshot(snapshot);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockSubscriber.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ GetSnapshotRequest actualRequest = (GetSnapshotRequest) actualRequests.get(0);
+
+ Assert.assertEquals(snapshot, ProjectSnapshotName.parse(actualRequest.getSnapshot()));
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ @SuppressWarnings("all")
+ public void getSnapshotExceptionTest() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
+ mockSubscriber.addException(exception);
+
+ try {
+ ProjectSnapshotName snapshot = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
+
+ client.getSnapshot(snapshot);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception
+ }
+ }
+
@Test
@SuppressWarnings("all")
public void modifyAckDeadlineTest() {
diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/TopicAdminClientTest.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/TopicAdminClientTest.java
index 7d524361b..43510c154 100644
--- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/TopicAdminClientTest.java
+++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/TopicAdminClientTest.java
@@ -15,6 +15,7 @@
*/
package com.google.cloud.pubsub.v1;
+import static com.google.cloud.pubsub.v1.TopicAdminClient.ListTopicSnapshotsPagedResponse;
import static com.google.cloud.pubsub.v1.TopicAdminClient.ListTopicSubscriptionsPagedResponse;
import static com.google.cloud.pubsub.v1.TopicAdminClient.ListTopicsPagedResponse;
@@ -38,6 +39,8 @@
import com.google.protobuf.FieldMask;
import com.google.pubsub.v1.DeleteTopicRequest;
import com.google.pubsub.v1.GetTopicRequest;
+import com.google.pubsub.v1.ListTopicSnapshotsRequest;
+import com.google.pubsub.v1.ListTopicSnapshotsResponse;
import com.google.pubsub.v1.ListTopicSubscriptionsRequest;
import com.google.pubsub.v1.ListTopicSubscriptionsResponse;
import com.google.pubsub.v1.ListTopicsRequest;
@@ -390,6 +393,54 @@ public void listTopicSubscriptionsExceptionTest() throws Exception {
}
}
+ @Test
+ @SuppressWarnings("all")
+ public void listTopicSnapshotsTest() {
+ String nextPageToken = "";
+ String snapshotsElement = "snapshotsElement1339034092";
+ List snapshots = Arrays.asList(snapshotsElement);
+ ListTopicSnapshotsResponse expectedResponse =
+ ListTopicSnapshotsResponse.newBuilder()
+ .setNextPageToken(nextPageToken)
+ .addAllSnapshots(snapshots)
+ .build();
+ mockPublisher.addResponse(expectedResponse);
+
+ TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
+
+ ListTopicSnapshotsPagedResponse pagedListResponse = client.listTopicSnapshots(topic);
+
+ List resources = Lists.newArrayList(pagedListResponse.iterateAll());
+ Assert.assertEquals(1, resources.size());
+ Assert.assertEquals(expectedResponse.getSnapshotsList().get(0), resources.get(0));
+
+ List actualRequests = mockPublisher.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ ListTopicSnapshotsRequest actualRequest = (ListTopicSnapshotsRequest) actualRequests.get(0);
+
+ Assert.assertEquals(topic, TopicName.parse(actualRequest.getTopic()));
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ @SuppressWarnings("all")
+ public void listTopicSnapshotsExceptionTest() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
+ mockPublisher.addException(exception);
+
+ try {
+ TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
+
+ client.listTopicSnapshots(topic);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception
+ }
+ }
+
@Test
@SuppressWarnings("all")
public void deleteTopicTest() {
diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PushConfig.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PushConfig.java
index e461881d5..5557855c8 100644
--- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PushConfig.java
+++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PushConfig.java
@@ -1140,7 +1140,7 @@ public AuthenticationMethodCase getAuthenticationMethodCase() {
*
*
* A URL locating the endpoint to which messages should be pushed.
- * For example, a Webhook endpoint might use "https://example.com/push".
+ * For example, a Webhook endpoint might use `https://example.com/push`.
*
*
* string push_endpoint = 1;
@@ -1163,7 +1163,7 @@ public java.lang.String getPushEndpoint() {
*
*
* A URL locating the endpoint to which messages should be pushed.
- * For example, a Webhook endpoint might use "https://example.com/push".
+ * For example, a Webhook endpoint might use `https://example.com/push`.
*
*
* string push_endpoint = 1;
@@ -1808,7 +1808,7 @@ public Builder clearAuthenticationMethod() {
*
*
* A URL locating the endpoint to which messages should be pushed.
- * For example, a Webhook endpoint might use "https://example.com/push".
+ * For example, a Webhook endpoint might use `https://example.com/push`.
*
*
* string push_endpoint = 1;
@@ -1831,7 +1831,7 @@ public java.lang.String getPushEndpoint() {
*
*
* A URL locating the endpoint to which messages should be pushed.
- * For example, a Webhook endpoint might use "https://example.com/push".
+ * For example, a Webhook endpoint might use `https://example.com/push`.
*
*
* string push_endpoint = 1;
@@ -1854,7 +1854,7 @@ public com.google.protobuf.ByteString getPushEndpointBytes() {
*
*
* A URL locating the endpoint to which messages should be pushed.
- * For example, a Webhook endpoint might use "https://example.com/push".
+ * For example, a Webhook endpoint might use `https://example.com/push`.
*
*
* string push_endpoint = 1;
@@ -1876,7 +1876,7 @@ public Builder setPushEndpoint(java.lang.String value) {
*
*
* A URL locating the endpoint to which messages should be pushed.
- * For example, a Webhook endpoint might use "https://example.com/push".
+ * For example, a Webhook endpoint might use `https://example.com/push`.
*
*
* string push_endpoint = 1;
@@ -1894,7 +1894,7 @@ public Builder clearPushEndpoint() {
*
*
* A URL locating the endpoint to which messages should be pushed.
- * For example, a Webhook endpoint might use "https://example.com/push".
+ * For example, a Webhook endpoint might use `https://example.com/push`.
*
*
* string push_endpoint = 1;
diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PushConfigOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PushConfigOrBuilder.java
index 873e0074a..091a066f9 100644
--- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PushConfigOrBuilder.java
+++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PushConfigOrBuilder.java
@@ -28,7 +28,7 @@ public interface PushConfigOrBuilder
*
*
* A URL locating the endpoint to which messages should be pushed.
- * For example, a Webhook endpoint might use "https://example.com/push".
+ * For example, a Webhook endpoint might use `https://example.com/push`.
*
*
* string push_endpoint = 1;
@@ -41,7 +41,7 @@ public interface PushConfigOrBuilder
*
*
* A URL locating the endpoint to which messages should be pushed.
- * For example, a Webhook endpoint might use "https://example.com/push".
+ * For example, a Webhook endpoint might use `https://example.com/push`.
*
*
* string push_endpoint = 1;
diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ReceivedMessage.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ReceivedMessage.java
index b366d91da..298013f30 100644
--- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ReceivedMessage.java
+++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ReceivedMessage.java
@@ -227,19 +227,18 @@ public com.google.pubsub.v1.PubsubMessageOrBuilder getMessageOrBuilder() {
*
*
*
- * Delivery attempt counter is 1 + (the sum of number of NACKs and number of
- * ack_deadline exceeds) for this message.
+ * The approximate number of times that Cloud Pub/Sub has attempted to deliver
+ * the associated message to a subscriber.
+ * More precisely, this is 1 + (number of NACKs) +
+ * (number of ack_deadline exceeds) for this message.
* A NACK is any call to ModifyAckDeadline with a 0 deadline. An ack_deadline
* exceeds event is whenever a message is not acknowledged within
* ack_deadline. Note that ack_deadline is initially
* Subscription.ackDeadlineSeconds, but may get extended automatically by
* the client library.
- * The first delivery of a given message will have this value as 1. The value
- * is calculated at best effort and is approximate.
+ * Upon the first delivery of a given message, `delivery_attempt` will have a
+ * value of 1. The value is calculated at best effort and is approximate.
* If a DeadLetterPolicy is not set on the subscription, this will be 0.
- * <b>EXPERIMENTAL:</b> This feature is part of a closed alpha release. This
- * API might be changed in backward-incompatible ways and is not recommended
- * for production use. It is not subject to any SLA or deprecation policy.
*
*
* int32 delivery_attempt = 3;
@@ -902,19 +901,18 @@ public com.google.pubsub.v1.PubsubMessageOrBuilder getMessageOrBuilder() {
*
*
*
- * Delivery attempt counter is 1 + (the sum of number of NACKs and number of
- * ack_deadline exceeds) for this message.
+ * The approximate number of times that Cloud Pub/Sub has attempted to deliver
+ * the associated message to a subscriber.
+ * More precisely, this is 1 + (number of NACKs) +
+ * (number of ack_deadline exceeds) for this message.
* A NACK is any call to ModifyAckDeadline with a 0 deadline. An ack_deadline
* exceeds event is whenever a message is not acknowledged within
* ack_deadline. Note that ack_deadline is initially
* Subscription.ackDeadlineSeconds, but may get extended automatically by
* the client library.
- * The first delivery of a given message will have this value as 1. The value
- * is calculated at best effort and is approximate.
+ * Upon the first delivery of a given message, `delivery_attempt` will have a
+ * value of 1. The value is calculated at best effort and is approximate.
* If a DeadLetterPolicy is not set on the subscription, this will be 0.
- * <b>EXPERIMENTAL:</b> This feature is part of a closed alpha release. This
- * API might be changed in backward-incompatible ways and is not recommended
- * for production use. It is not subject to any SLA or deprecation policy.
*
*
* int32 delivery_attempt = 3;
@@ -928,19 +926,18 @@ public int getDeliveryAttempt() {
*
*
*
- * Delivery attempt counter is 1 + (the sum of number of NACKs and number of
- * ack_deadline exceeds) for this message.
+ * The approximate number of times that Cloud Pub/Sub has attempted to deliver
+ * the associated message to a subscriber.
+ * More precisely, this is 1 + (number of NACKs) +
+ * (number of ack_deadline exceeds) for this message.
* A NACK is any call to ModifyAckDeadline with a 0 deadline. An ack_deadline
* exceeds event is whenever a message is not acknowledged within
* ack_deadline. Note that ack_deadline is initially
* Subscription.ackDeadlineSeconds, but may get extended automatically by
* the client library.
- * The first delivery of a given message will have this value as 1. The value
- * is calculated at best effort and is approximate.
+ * Upon the first delivery of a given message, `delivery_attempt` will have a
+ * value of 1. The value is calculated at best effort and is approximate.
* If a DeadLetterPolicy is not set on the subscription, this will be 0.
- * <b>EXPERIMENTAL:</b> This feature is part of a closed alpha release. This
- * API might be changed in backward-incompatible ways and is not recommended
- * for production use. It is not subject to any SLA or deprecation policy.
*
*
* int32 delivery_attempt = 3;
@@ -958,19 +955,18 @@ public Builder setDeliveryAttempt(int value) {
*
*
*
- * Delivery attempt counter is 1 + (the sum of number of NACKs and number of
- * ack_deadline exceeds) for this message.
+ * The approximate number of times that Cloud Pub/Sub has attempted to deliver
+ * the associated message to a subscriber.
+ * More precisely, this is 1 + (number of NACKs) +
+ * (number of ack_deadline exceeds) for this message.
* A NACK is any call to ModifyAckDeadline with a 0 deadline. An ack_deadline
* exceeds event is whenever a message is not acknowledged within
* ack_deadline. Note that ack_deadline is initially
* Subscription.ackDeadlineSeconds, but may get extended automatically by
* the client library.
- * The first delivery of a given message will have this value as 1. The value
- * is calculated at best effort and is approximate.
+ * Upon the first delivery of a given message, `delivery_attempt` will have a
+ * value of 1. The value is calculated at best effort and is approximate.
* If a DeadLetterPolicy is not set on the subscription, this will be 0.
- * <b>EXPERIMENTAL:</b> This feature is part of a closed alpha release. This
- * API might be changed in backward-incompatible ways and is not recommended
- * for production use. It is not subject to any SLA or deprecation policy.
*
*
* int32 delivery_attempt = 3;
diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ReceivedMessageOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ReceivedMessageOrBuilder.java
index eb54e43f1..805690b39 100644
--- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ReceivedMessageOrBuilder.java
+++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ReceivedMessageOrBuilder.java
@@ -87,19 +87,18 @@ public interface ReceivedMessageOrBuilder
*
*
*
- * Delivery attempt counter is 1 + (the sum of number of NACKs and number of
- * ack_deadline exceeds) for this message.
+ * The approximate number of times that Cloud Pub/Sub has attempted to deliver
+ * the associated message to a subscriber.
+ * More precisely, this is 1 + (number of NACKs) +
+ * (number of ack_deadline exceeds) for this message.
* A NACK is any call to ModifyAckDeadline with a 0 deadline. An ack_deadline
* exceeds event is whenever a message is not acknowledged within
* ack_deadline. Note that ack_deadline is initially
* Subscription.ackDeadlineSeconds, but may get extended automatically by
* the client library.
- * The first delivery of a given message will have this value as 1. The value
- * is calculated at best effort and is approximate.
+ * Upon the first delivery of a given message, `delivery_attempt` will have a
+ * value of 1. The value is calculated at best effort and is approximate.
* If a DeadLetterPolicy is not set on the subscription, this will be 0.
- * <b>EXPERIMENTAL:</b> This feature is part of a closed alpha release. This
- * API might be changed in backward-incompatible ways and is not recommended
- * for production use. It is not subject to any SLA or deprecation policy.
*
*
* int32 delivery_attempt = 3;
diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/Subscription.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/Subscription.java
index c91b6d10f..64391376b 100644
--- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/Subscription.java
+++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/Subscription.java
@@ -773,9 +773,6 @@ public com.google.protobuf.ByteString getFilterBytes() {
* parent project (i.e.,
* service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
* permission to Acknowledge() messages on this subscription.
- * <b>EXPERIMENTAL:</b> This feature is part of a closed alpha release. This
- * API might be changed in backward-incompatible ways and is not recommended
- * for production use. It is not subject to any SLA or deprecation policy.
*
*
* .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13;
@@ -796,9 +793,6 @@ public boolean hasDeadLetterPolicy() {
* parent project (i.e.,
* service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
* permission to Acknowledge() messages on this subscription.
- * <b>EXPERIMENTAL:</b> This feature is part of a closed alpha release. This
- * API might be changed in backward-incompatible ways and is not recommended
- * for production use. It is not subject to any SLA or deprecation policy.
*
*
* .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13;
@@ -821,9 +815,6 @@ public com.google.pubsub.v1.DeadLetterPolicy getDeadLetterPolicy() {
* parent project (i.e.,
* service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
* permission to Acknowledge() messages on this subscription.
- * <b>EXPERIMENTAL:</b> This feature is part of a closed alpha release. This
- * API might be changed in backward-incompatible ways and is not recommended
- * for production use. It is not subject to any SLA or deprecation policy.
*
*
* .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13;
@@ -2948,9 +2939,6 @@ public Builder setFilterBytes(com.google.protobuf.ByteString value) {
* parent project (i.e.,
* service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
* permission to Acknowledge() messages on this subscription.
- * <b>EXPERIMENTAL:</b> This feature is part of a closed alpha release. This
- * API might be changed in backward-incompatible ways and is not recommended
- * for production use. It is not subject to any SLA or deprecation policy.
*
*
* .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13;
@@ -2971,9 +2959,6 @@ public boolean hasDeadLetterPolicy() {
* parent project (i.e.,
* service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
* permission to Acknowledge() messages on this subscription.
- * <b>EXPERIMENTAL:</b> This feature is part of a closed alpha release. This
- * API might be changed in backward-incompatible ways and is not recommended
- * for production use. It is not subject to any SLA or deprecation policy.
*
*
* .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13;
@@ -3000,9 +2985,6 @@ public com.google.pubsub.v1.DeadLetterPolicy getDeadLetterPolicy() {
* parent project (i.e.,
* service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
* permission to Acknowledge() messages on this subscription.
- * <b>EXPERIMENTAL:</b> This feature is part of a closed alpha release. This
- * API might be changed in backward-incompatible ways and is not recommended
- * for production use. It is not subject to any SLA or deprecation policy.
*
*
* .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13;
@@ -3031,9 +3013,6 @@ public Builder setDeadLetterPolicy(com.google.pubsub.v1.DeadLetterPolicy value)
* parent project (i.e.,
* service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
* permission to Acknowledge() messages on this subscription.
- * <b>EXPERIMENTAL:</b> This feature is part of a closed alpha release. This
- * API might be changed in backward-incompatible ways and is not recommended
- * for production use. It is not subject to any SLA or deprecation policy.
*
*
* .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13;
@@ -3060,9 +3039,6 @@ public Builder setDeadLetterPolicy(
* parent project (i.e.,
* service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
* permission to Acknowledge() messages on this subscription.
- * <b>EXPERIMENTAL:</b> This feature is part of a closed alpha release. This
- * API might be changed in backward-incompatible ways and is not recommended
- * for production use. It is not subject to any SLA or deprecation policy.
*
*
* .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13;
@@ -3095,9 +3071,6 @@ public Builder mergeDeadLetterPolicy(com.google.pubsub.v1.DeadLetterPolicy value
* parent project (i.e.,
* service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
* permission to Acknowledge() messages on this subscription.
- * <b>EXPERIMENTAL:</b> This feature is part of a closed alpha release. This
- * API might be changed in backward-incompatible ways and is not recommended
- * for production use. It is not subject to any SLA or deprecation policy.
*
*
* .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13;
@@ -3124,9 +3097,6 @@ public Builder clearDeadLetterPolicy() {
* parent project (i.e.,
* service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
* permission to Acknowledge() messages on this subscription.
- * <b>EXPERIMENTAL:</b> This feature is part of a closed alpha release. This
- * API might be changed in backward-incompatible ways and is not recommended
- * for production use. It is not subject to any SLA or deprecation policy.
*
*
* .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13;
@@ -3147,9 +3117,6 @@ public com.google.pubsub.v1.DeadLetterPolicy.Builder getDeadLetterPolicyBuilder(
* parent project (i.e.,
* service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
* permission to Acknowledge() messages on this subscription.
- * <b>EXPERIMENTAL:</b> This feature is part of a closed alpha release. This
- * API might be changed in backward-incompatible ways and is not recommended
- * for production use. It is not subject to any SLA or deprecation policy.
*
*
* .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13;
@@ -3174,9 +3141,6 @@ public com.google.pubsub.v1.DeadLetterPolicyOrBuilder getDeadLetterPolicyOrBuild
* parent project (i.e.,
* service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
* permission to Acknowledge() messages on this subscription.
- * <b>EXPERIMENTAL:</b> This feature is part of a closed alpha release. This
- * API might be changed in backward-incompatible ways and is not recommended
- * for production use. It is not subject to any SLA or deprecation policy.
*
*
* .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13;
diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SubscriptionOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SubscriptionOrBuilder.java
index 0c1a6fe40..dd48671fb 100644
--- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SubscriptionOrBuilder.java
+++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SubscriptionOrBuilder.java
@@ -406,9 +406,6 @@ public interface SubscriptionOrBuilder
* parent project (i.e.,
* service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
* permission to Acknowledge() messages on this subscription.
- * <b>EXPERIMENTAL:</b> This feature is part of a closed alpha release. This
- * API might be changed in backward-incompatible ways and is not recommended
- * for production use. It is not subject to any SLA or deprecation policy.
*
*
* .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13;
@@ -427,9 +424,6 @@ public interface SubscriptionOrBuilder
* parent project (i.e.,
* service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
* permission to Acknowledge() messages on this subscription.
- * <b>EXPERIMENTAL:</b> This feature is part of a closed alpha release. This
- * API might be changed in backward-incompatible ways and is not recommended
- * for production use. It is not subject to any SLA or deprecation policy.
*
*
* .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13;
@@ -448,9 +442,6 @@ public interface SubscriptionOrBuilder
* parent project (i.e.,
* service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
* permission to Acknowledge() messages on this subscription.
- * <b>EXPERIMENTAL:</b> This feature is part of a closed alpha release. This
- * API might be changed in backward-incompatible ways and is not recommended
- * for production use. It is not subject to any SLA or deprecation policy.
*
*
* .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13;
diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/TopicName.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/TopicName.java
index 09996bf5e..14d871ac5 100644
--- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/TopicName.java
+++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/TopicName.java
@@ -22,8 +22,6 @@
import com.google.api.resourcenames.ResourceName;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap;
-import java.util.ArrayList;
-import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -119,28 +117,6 @@ public static TopicName parse(String formattedString) {
throw new ValidationException("JobName.parse: formattedString not in valid format");
}
- @BetaApi("The method will be renamed to parseList after subclasses of this class are removed.")
- public static List parse(List formattedStrings) {
- List list = new ArrayList<>(formattedStrings.size());
- for (String formattedString : formattedStrings) {
- list.add(parse(formattedString));
- }
- return list;
- }
-
- @BetaApi("The method will be renamed to toStringList after subclasses of this class are removed.")
- public static List toStrings(List values) {
- List list = new ArrayList<>(values.size());
- for (TopicName value : values) {
- if (value == null) {
- list.add("");
- } else {
- list.add(value.toString());
- }
- }
- return list;
- }
-
public static boolean isParsableFrom(String formattedString) {
return PROJECT_TOPIC_PATH_TEMPLATE.matches(formattedString)
|| DELETED_TOPIC_FIXED_VALUE.equals(formattedString);
diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateTopicRequest.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateTopicRequest.java
index 5309c9bd7..44b586ae1 100644
--- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateTopicRequest.java
+++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateTopicRequest.java
@@ -182,9 +182,9 @@ public com.google.pubsub.v1.TopicOrBuilder getTopicOrBuilder() {
*
* Required. Indicates which fields in the provided topic to update. Must be
* specified and non-empty. Note that if `update_mask` contains
- * "message_storage_policy" then the new value will be determined based on the
- * policy configured at the project or organization level. The
- * `message_storage_policy` must not be set in the `topic` provided above.
+ * "message_storage_policy" but the `message_storage_policy` is not set in
+ * the `topic` provided above, then the updated value is determined by the
+ * policy configured at the project or organization level.
*
*
* .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED];
@@ -201,9 +201,9 @@ public boolean hasUpdateMask() {
*
* Required. Indicates which fields in the provided topic to update. Must be
* specified and non-empty. Note that if `update_mask` contains
- * "message_storage_policy" then the new value will be determined based on the
- * policy configured at the project or organization level. The
- * `message_storage_policy` must not be set in the `topic` provided above.
+ * "message_storage_policy" but the `message_storage_policy` is not set in
+ * the `topic` provided above, then the updated value is determined by the
+ * policy configured at the project or organization level.
*
*
* .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED];
@@ -220,9 +220,9 @@ public com.google.protobuf.FieldMask getUpdateMask() {
*
* Required. Indicates which fields in the provided topic to update. Must be
* specified and non-empty. Note that if `update_mask` contains
- * "message_storage_policy" then the new value will be determined based on the
- * policy configured at the project or organization level. The
- * `message_storage_policy` must not be set in the `topic` provided above.
+ * "message_storage_policy" but the `message_storage_policy` is not set in
+ * the `topic` provided above, then the updated value is determined by the
+ * policy configured at the project or organization level.
*
*
* .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED];
@@ -776,9 +776,9 @@ public com.google.pubsub.v1.TopicOrBuilder getTopicOrBuilder() {
*
* Required. Indicates which fields in the provided topic to update. Must be
* specified and non-empty. Note that if `update_mask` contains
- * "message_storage_policy" then the new value will be determined based on the
- * policy configured at the project or organization level. The
- * `message_storage_policy` must not be set in the `topic` provided above.
+ * "message_storage_policy" but the `message_storage_policy` is not set in
+ * the `topic` provided above, then the updated value is determined by the
+ * policy configured at the project or organization level.
*
*
* .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED];
@@ -795,9 +795,9 @@ public boolean hasUpdateMask() {
*
* Required. Indicates which fields in the provided topic to update. Must be
* specified and non-empty. Note that if `update_mask` contains
- * "message_storage_policy" then the new value will be determined based on the
- * policy configured at the project or organization level. The
- * `message_storage_policy` must not be set in the `topic` provided above.
+ * "message_storage_policy" but the `message_storage_policy` is not set in
+ * the `topic` provided above, then the updated value is determined by the
+ * policy configured at the project or organization level.
*
*
* .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED];
@@ -820,9 +820,9 @@ public com.google.protobuf.FieldMask getUpdateMask() {
*
* Required. Indicates which fields in the provided topic to update. Must be
* specified and non-empty. Note that if `update_mask` contains
- * "message_storage_policy" then the new value will be determined based on the
- * policy configured at the project or organization level. The
- * `message_storage_policy` must not be set in the `topic` provided above.
+ * "message_storage_policy" but the `message_storage_policy` is not set in
+ * the `topic` provided above, then the updated value is determined by the
+ * policy configured at the project or organization level.
*
*
* .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED];
@@ -847,9 +847,9 @@ public Builder setUpdateMask(com.google.protobuf.FieldMask value) {
*
* Required. Indicates which fields in the provided topic to update. Must be
* specified and non-empty. Note that if `update_mask` contains
- * "message_storage_policy" then the new value will be determined based on the
- * policy configured at the project or organization level. The
- * `message_storage_policy` must not be set in the `topic` provided above.
+ * "message_storage_policy" but the `message_storage_policy` is not set in
+ * the `topic` provided above, then the updated value is determined by the
+ * policy configured at the project or organization level.
*
*
* .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED];
@@ -871,9 +871,9 @@ public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForVal
*
* Required. Indicates which fields in the provided topic to update. Must be
* specified and non-empty. Note that if `update_mask` contains
- * "message_storage_policy" then the new value will be determined based on the
- * policy configured at the project or organization level. The
- * `message_storage_policy` must not be set in the `topic` provided above.
+ * "message_storage_policy" but the `message_storage_policy` is not set in
+ * the `topic` provided above, then the updated value is determined by the
+ * policy configured at the project or organization level.
*
*
* .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED];
@@ -900,9 +900,9 @@ public Builder mergeUpdateMask(com.google.protobuf.FieldMask value) {
*
* Required. Indicates which fields in the provided topic to update. Must be
* specified and non-empty. Note that if `update_mask` contains
- * "message_storage_policy" then the new value will be determined based on the
- * policy configured at the project or organization level. The
- * `message_storage_policy` must not be set in the `topic` provided above.
+ * "message_storage_policy" but the `message_storage_policy` is not set in
+ * the `topic` provided above, then the updated value is determined by the
+ * policy configured at the project or organization level.
*
*
* .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED];
@@ -925,9 +925,9 @@ public Builder clearUpdateMask() {
*
* Required. Indicates which fields in the provided topic to update. Must be
* specified and non-empty. Note that if `update_mask` contains
- * "message_storage_policy" then the new value will be determined based on the
- * policy configured at the project or organization level. The
- * `message_storage_policy` must not be set in the `topic` provided above.
+ * "message_storage_policy" but the `message_storage_policy` is not set in
+ * the `topic` provided above, then the updated value is determined by the
+ * policy configured at the project or organization level.
*
*
* .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED];
@@ -944,9 +944,9 @@ public com.google.protobuf.FieldMask.Builder getUpdateMaskBuilder() {
*
* Required. Indicates which fields in the provided topic to update. Must be
* specified and non-empty. Note that if `update_mask` contains
- * "message_storage_policy" then the new value will be determined based on the
- * policy configured at the project or organization level. The
- * `message_storage_policy` must not be set in the `topic` provided above.
+ * "message_storage_policy" but the `message_storage_policy` is not set in
+ * the `topic` provided above, then the updated value is determined by the
+ * policy configured at the project or organization level.
*
*
* .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED];
@@ -967,9 +967,9 @@ public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() {
*
* Required. Indicates which fields in the provided topic to update. Must be
* specified and non-empty. Note that if `update_mask` contains
- * "message_storage_policy" then the new value will be determined based on the
- * policy configured at the project or organization level. The
- * `message_storage_policy` must not be set in the `topic` provided above.
+ * "message_storage_policy" but the `message_storage_policy` is not set in
+ * the `topic` provided above, then the updated value is determined by the
+ * policy configured at the project or organization level.
*
*
* .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED];
diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateTopicRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateTopicRequestOrBuilder.java
index 257f0fdb8..c65735f57 100644
--- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateTopicRequestOrBuilder.java
+++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateTopicRequestOrBuilder.java
@@ -64,9 +64,9 @@ public interface UpdateTopicRequestOrBuilder
*
* Required. Indicates which fields in the provided topic to update. Must be
* specified and non-empty. Note that if `update_mask` contains
- * "message_storage_policy" then the new value will be determined based on the
- * policy configured at the project or organization level. The
- * `message_storage_policy` must not be set in the `topic` provided above.
+ * "message_storage_policy" but the `message_storage_policy` is not set in
+ * the `topic` provided above, then the updated value is determined by the
+ * policy configured at the project or organization level.
*
*
* .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED];
@@ -81,9 +81,9 @@ public interface UpdateTopicRequestOrBuilder
*
* Required. Indicates which fields in the provided topic to update. Must be
* specified and non-empty. Note that if `update_mask` contains
- * "message_storage_policy" then the new value will be determined based on the
- * policy configured at the project or organization level. The
- * `message_storage_policy` must not be set in the `topic` provided above.
+ * "message_storage_policy" but the `message_storage_policy` is not set in
+ * the `topic` provided above, then the updated value is determined by the
+ * policy configured at the project or organization level.
*
*
* .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED];
@@ -98,9 +98,9 @@ public interface UpdateTopicRequestOrBuilder
*
* Required. Indicates which fields in the provided topic to update. Must be
* specified and non-empty. Note that if `update_mask` contains
- * "message_storage_policy" then the new value will be determined based on the
- * policy configured at the project or organization level. The
- * `message_storage_policy` must not be set in the `topic` provided above.
+ * "message_storage_policy" but the `message_storage_policy` is not set in
+ * the `topic` provided above, then the updated value is determined by the
+ * policy configured at the project or organization level.
*
*
* .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED];
diff --git a/proto-google-cloud-pubsub-v1/src/main/proto/google/pubsub/v1/pubsub.proto b/proto-google-cloud-pubsub-v1/src/main/proto/google/pubsub/v1/pubsub.proto
index b49b30ed4..a42d03220 100644
--- a/proto-google-cloud-pubsub-v1/src/main/proto/google/pubsub/v1/pubsub.proto
+++ b/proto-google-cloud-pubsub-v1/src/main/proto/google/pubsub/v1/pubsub.proto
@@ -222,9 +222,9 @@ message UpdateTopicRequest {
// Required. Indicates which fields in the provided topic to update. Must be
// specified and non-empty. Note that if `update_mask` contains
- // "message_storage_policy" then the new value will be determined based on the
- // policy configured at the project or organization level. The
- // `message_storage_policy` must not be set in the `topic` provided above.
+ // "message_storage_policy" but the `message_storage_policy` is not set in
+ // the `topic` provided above, then the updated value is determined by the
+ // policy configured at the project or organization level.
google.protobuf.FieldMask update_mask = 2
[(google.api.field_behavior) = REQUIRED];
}
@@ -689,9 +689,6 @@ message Subscription {
// parent project (i.e.,
// service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
// permission to Acknowledge() messages on this subscription.
- // EXPERIMENTAL: This feature is part of a closed alpha release. This
- // API might be changed in backward-incompatible ways and is not recommended
- // for production use. It is not subject to any SLA or deprecation policy.
DeadLetterPolicy dead_letter_policy = 13;
// A policy that specifies how Cloud Pub/Sub retries message delivery for this
@@ -796,7 +793,7 @@ message PushConfig {
}
// A URL locating the endpoint to which messages should be pushed.
- // For example, a Webhook endpoint might use "https://example.com/push".
+ // For example, a Webhook endpoint might use `https://example.com/push`.
string push_endpoint = 1;
// Endpoint configuration attributes that can be used to control different
@@ -842,8 +839,11 @@ message ReceivedMessage {
// The message.
PubsubMessage message = 2;
- // Delivery attempt counter is 1 + (the sum of number of NACKs and number of
- // ack_deadline exceeds) for this message.
+ // The approximate number of times that Cloud Pub/Sub has attempted to deliver
+ // the associated message to a subscriber.
+ //
+ // More precisely, this is 1 + (number of NACKs) +
+ // (number of ack_deadline exceeds) for this message.
//
// A NACK is any call to ModifyAckDeadline with a 0 deadline. An ack_deadline
// exceeds event is whenever a message is not acknowledged within
@@ -851,13 +851,10 @@ message ReceivedMessage {
// Subscription.ackDeadlineSeconds, but may get extended automatically by
// the client library.
//
- // The first delivery of a given message will have this value as 1. The value
- // is calculated at best effort and is approximate.
+ // Upon the first delivery of a given message, `delivery_attempt` will have a
+ // value of 1. The value is calculated at best effort and is approximate.
//
// If a DeadLetterPolicy is not set on the subscription, this will be 0.
- // EXPERIMENTAL: This feature is part of a closed alpha release. This
- // API might be changed in backward-incompatible ways and is not recommended
- // for production use. It is not subject to any SLA or deprecation policy.
int32 delivery_attempt = 3;
}
diff --git a/synth.metadata b/synth.metadata
index a508982a7..4effe7abd 100644
--- a/synth.metadata
+++ b/synth.metadata
@@ -3,23 +3,23 @@
{
"git": {
"name": ".",
- "remote": "git@github.com:googleapis/java-pubsub.git",
- "sha": "b4e0b77255ebb04eead8bf3e5c7be0fe76ac4c89"
+ "remote": "https://github.com/googleapis/java-pubsub.git",
+ "sha": "e1d285147accf85dc47417646388b8298f8c484e"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
- "sha": "b5e9b0b09cc15c263f07da92fa64db31b2e4dd07",
- "internalRef": "307068250"
+ "sha": "edd3b80fb770548d6ad780105f1782de6ff73ea0",
+ "internalRef": "311053644"
}
},
{
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
- "sha": "f8a9933e5e98202b04ef427f28d1d79221190fa4"
+ "sha": "5b48b0716a36ca069db3038da7e205c87a22ed19"
}
}
],
From 270bd941008121b30be26560d0722c7d15abeb55 Mon Sep 17 00:00:00 2001
From: Yoshi Automation Bot
Date: Sun, 24 May 2020 15:44:09 -0700
Subject: [PATCH 03/22] chore(java): allow overriding minimum supported Java
version in templates (#577) (#208)
* changes without context
autosynth cannot find the source of changes triggered by earlier changes in this
repository, or by version upgrades to tools such as linters.
* chore(java): allow overriding minimum supported Java version in templates (#577)
Source-Author: Jeff Ching
Source-Date: Thu May 21 17:51:49 2020 -0700
Source-Repo: googleapis/synthtool
Source-Sha: 65f8c647c0bc0c6b38211b969a2a003e271a5ef1
Source-Link: https://github.com/googleapis/synthtool/commit/65f8c647c0bc0c6b38211b969a2a003e271a5ef1
---
README.md | 24 ++++++++++++++++++------
synth.metadata | 4 ++--
2 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/README.md b/README.md
index be3c05769..7c91db712 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file
com.google.cloud
libraries-bom
- 5.3.0
+ 5.4.0
pom
import
@@ -47,11 +47,11 @@ If you are using Maven without BOM, add this to your dependencies:
If you are using Gradle, add this to your dependencies
```Groovy
-compile 'com.google.cloud:google-cloud-pubsub:1.106.0'
+compile 'com.google.cloud:google-cloud-pubsub:1.105.1'
```
If you are using SBT, add this to your dependencies
```Scala
-libraryDependencies += "com.google.cloud" % "google-cloud-pubsub" % "1.106.0"
+libraryDependencies += "com.google.cloud" % "google-cloud-pubsub" % "1.105.1"
```
[//]: # ({x-version-update-end})
@@ -218,6 +218,19 @@ In [CreateTopicAndPublishMessages.java](https://github.com/googleapis/google-clo
+## Samples
+
+Samples are in the [`samples/`](https://github.com/googleapis/java-pubsub/tree/master/samples) directory. The samples' `README.md`
+has instructions for running the samples.
+
+| Sample | Source Code | Try it |
+| --------------------------- | --------------------------------- | ------ |
+| Create Subscription With Dead Letter Policy Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/CreateSubscriptionWithDeadLetterPolicyExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/CreateSubscriptionWithDeadLetterPolicyExample.java) |
+| Receive Messages With Delivery Attempts Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/ReceiveMessagesWithDeliveryAttemptsExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/ReceiveMessagesWithDeliveryAttemptsExample.java) |
+| Remove Dead Letter Policy Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/RemoveDeadLetterPolicyExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/RemoveDeadLetterPolicyExample.java) |
+| Update Dead Letter Policy Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/UpdateDeadLetterPolicyExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/UpdateDeadLetterPolicyExample.java) |
+
+
## Troubleshooting
@@ -252,14 +265,13 @@ Apache 2.0 - See [LICENSE][license] for more information.
Java Version | Status
------------ | ------
-Java 7 | [![Kokoro CI][kokoro-badge-image-1]][kokoro-badge-link-1]
-Java 8 | [![Kokoro CI][kokoro-badge-image-2]][kokoro-badge-link-2]
+Java 7 | [![Kokoro CI][kokoro-badge-image-1]][kokoro-badge-link-1]Java 8 | [![Kokoro CI][kokoro-badge-image-2]][kokoro-badge-link-2]
Java 8 OSX | [![Kokoro CI][kokoro-badge-image-3]][kokoro-badge-link-3]
Java 8 Windows | [![Kokoro CI][kokoro-badge-image-4]][kokoro-badge-link-4]
Java 11 | [![Kokoro CI][kokoro-badge-image-5]][kokoro-badge-link-5]
[product-docs]: https://cloud.google.com/pubsub/docs/
-[javadocs]: https://googleapis.dev/java/google-cloud-pubusb/latest/index.html
+[javadocs]: https://googleapis.dev/java/google-cloud-pubsub/latest/index.html
[kokoro-badge-image-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-pubsub/java7.svg
[kokoro-badge-link-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-pubsub/java7.html
[kokoro-badge-image-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-pubsub/java8.svg
diff --git a/synth.metadata b/synth.metadata
index 4effe7abd..8b91264df 100644
--- a/synth.metadata
+++ b/synth.metadata
@@ -4,7 +4,7 @@
"git": {
"name": ".",
"remote": "https://github.com/googleapis/java-pubsub.git",
- "sha": "e1d285147accf85dc47417646388b8298f8c484e"
+ "sha": "16624f88ad19ccaf2ea074a62242496be103659f"
}
},
{
@@ -19,7 +19,7 @@
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
- "sha": "5b48b0716a36ca069db3038da7e205c87a22ed19"
+ "sha": "65f8c647c0bc0c6b38211b969a2a003e271a5ef1"
}
}
],
From 15f71ed143dd990e0bf1089571d1a3d14ceaf491 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate
Date: Mon, 25 May 2020 19:06:29 +0200
Subject: [PATCH 04/22] chore(deps): update dependency
com.google.cloud:google-cloud-pubsub to v1.106.0 (#210)
---
samples/install-without-bom/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml
index 2fdd67dd8..51d291456 100644
--- a/samples/install-without-bom/pom.xml
+++ b/samples/install-without-bom/pom.xml
@@ -44,7 +44,7 @@
com.google.cloud
google-cloud-pubsub
- 1.105.1
+ 1.106.0
From 63a0e7a423ca0e9de9e446f0686aec6e6368f67c Mon Sep 17 00:00:00 2001
From: "release-please[bot]"
<55107282+release-please[bot]@users.noreply.github.com>
Date: Mon, 25 May 2020 12:08:31 -0700
Subject: [PATCH 05/22] chore: release 1.106.1-SNAPSHOT (#209)
* updated versions.txt [ci skip]
* updated samples/install-without-bom/pom.xml [ci skip]
* updated samples/pom.xml [ci skip]
* updated samples/snippets/pom.xml [ci skip]
* updated google-cloud-pubsub-bom/pom.xml [ci skip]
* updated google-cloud-pubsub/pom.xml [ci skip]
* updated grpc-google-cloud-pubsub-v1/pom.xml [ci skip]
* updated pom.xml [ci skip]
* updated proto-google-cloud-pubsub-v1/pom.xml [ci skip]
* updated samples/snapshot/pom.xml
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
---
google-cloud-pubsub-bom/pom.xml | 8 ++++----
google-cloud-pubsub/pom.xml | 4 ++--
grpc-google-cloud-pubsub-v1/pom.xml | 4 ++--
pom.xml | 8 ++++----
proto-google-cloud-pubsub-v1/pom.xml | 4 ++--
samples/snapshot/pom.xml | 2 +-
versions.txt | 6 +++---
7 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/google-cloud-pubsub-bom/pom.xml b/google-cloud-pubsub-bom/pom.xml
index e95c8dcb3..8ba10396b 100644
--- a/google-cloud-pubsub-bom/pom.xml
+++ b/google-cloud-pubsub-bom/pom.xml
@@ -3,7 +3,7 @@
4.0.0
com.google.cloud
google-cloud-pubsub-bom
- 1.106.0
+ 1.106.1-SNAPSHOT
pom
com.google.cloud
@@ -64,17 +64,17 @@
com.google.api.grpc
proto-google-cloud-pubsub-v1
- 1.88.0
+ 1.88.1-SNAPSHOT
com.google.api.grpc
grpc-google-cloud-pubsub-v1
- 1.88.0
+ 1.88.1-SNAPSHOT
com.google.cloud
google-cloud-pubsub
- 1.106.0
+ 1.106.1-SNAPSHOT
diff --git a/google-cloud-pubsub/pom.xml b/google-cloud-pubsub/pom.xml
index 2858a653c..5b3e98761 100644
--- a/google-cloud-pubsub/pom.xml
+++ b/google-cloud-pubsub/pom.xml
@@ -3,7 +3,7 @@
4.0.0
com.google.cloud
google-cloud-pubsub
- 1.106.0
+ 1.106.1-SNAPSHOT
jar
Google Cloud Pub/Sub
https://github.com/googleapis/java-pubsub
@@ -11,7 +11,7 @@
com.google.cloud
google-cloud-pubsub-parent
- 1.106.0
+ 1.106.1-SNAPSHOT
google-cloud-pubsub
diff --git a/grpc-google-cloud-pubsub-v1/pom.xml b/grpc-google-cloud-pubsub-v1/pom.xml
index b5f99563b..cf0c8d698 100644
--- a/grpc-google-cloud-pubsub-v1/pom.xml
+++ b/grpc-google-cloud-pubsub-v1/pom.xml
@@ -4,13 +4,13 @@
4.0.0
com.google.api.grpc
grpc-google-cloud-pubsub-v1
- 1.88.0
+ 1.88.1-SNAPSHOT
grpc-google-cloud-pubsub-v1
GRPC library for grpc-google-cloud-pubsub-v1
com.google.cloud
google-cloud-pubsub-parent
- 1.106.0
+ 1.106.1-SNAPSHOT
diff --git a/pom.xml b/pom.xml
index c03a20744..af518b3ce 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
com.google.cloud
google-cloud-pubsub-parent
pom
- 1.106.0
+ 1.106.1-SNAPSHOT
Google Cloud Pub/Sub Parent
https://github.com/googleapis/java-pubsub
@@ -82,17 +82,17 @@
com.google.api.grpc
proto-google-cloud-pubsub-v1
- 1.88.0
+ 1.88.1-SNAPSHOT
com.google.api.grpc
grpc-google-cloud-pubsub-v1
- 1.88.0
+ 1.88.1-SNAPSHOT
com.google.cloud
google-cloud-pubsub
- 1.106.0
+ 1.106.1-SNAPSHOT
diff --git a/proto-google-cloud-pubsub-v1/pom.xml b/proto-google-cloud-pubsub-v1/pom.xml
index bad1c0920..f30bb9ea9 100644
--- a/proto-google-cloud-pubsub-v1/pom.xml
+++ b/proto-google-cloud-pubsub-v1/pom.xml
@@ -4,13 +4,13 @@
4.0.0
com.google.api.grpc
proto-google-cloud-pubsub-v1
- 1.88.0
+ 1.88.1-SNAPSHOT
proto-google-cloud-pubsub-v1
PROTO library for proto-google-cloud-pubsub-v1
com.google.cloud
google-cloud-pubsub-parent
- 1.106.0
+ 1.106.1-SNAPSHOT
diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml
index a394ade69..ddbb83147 100644
--- a/samples/snapshot/pom.xml
+++ b/samples/snapshot/pom.xml
@@ -43,7 +43,7 @@
com.google.cloud
google-cloud-pubsub
- 1.106.0
+ 1.106.1-SNAPSHOT
diff --git a/versions.txt b/versions.txt
index 436efd860..57cecb2f3 100644
--- a/versions.txt
+++ b/versions.txt
@@ -1,6 +1,6 @@
# Format:
# module:released-version:current-version
-proto-google-cloud-pubsub-v1:1.88.0:1.88.0
-grpc-google-cloud-pubsub-v1:1.88.0:1.88.0
-google-cloud-pubsub:1.106.0:1.106.0
\ No newline at end of file
+proto-google-cloud-pubsub-v1:1.88.0:1.88.1-SNAPSHOT
+grpc-google-cloud-pubsub-v1:1.88.0:1.88.1-SNAPSHOT
+google-cloud-pubsub:1.106.0:1.106.1-SNAPSHOT
\ No newline at end of file
From 48fb4002706d495bcca018a211ba1387171b1416 Mon Sep 17 00:00:00 2001
From: Yoshi Automation Bot
Date: Wed, 27 May 2020 07:10:11 -0700
Subject: [PATCH 06/22] chore(java): fix inadvertent whitespace changes (#578)
(#214)
* changes without context
autosynth cannot find the source of changes triggered by earlier changes in this
repository, or by version upgrades to tools such as linters.
* chore(java): fix inadvertent whitespace changes (#578)
Source-Author: Jeff Ching
Source-Date: Tue May 26 08:37:51 2020 -0700
Source-Repo: googleapis/synthtool
Source-Sha: 388f7aafee3d7a067c23db6c13b7e83fb361c64a
Source-Link: https://github.com/googleapis/synthtool/commit/388f7aafee3d7a067c23db6c13b7e83fb361c64a
---
README.md | 9 +++++----
synth.metadata | 4 ++--
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/README.md b/README.md
index 7c91db712..cf44cb0f7 100644
--- a/README.md
+++ b/README.md
@@ -38,7 +38,7 @@ If you are using Maven without BOM, add this to your dependencies:
com.google.cloud
google-cloud-pubsub
- 1.105.1
+ 1.106.0
```
@@ -47,11 +47,11 @@ If you are using Maven without BOM, add this to your dependencies:
If you are using Gradle, add this to your dependencies
```Groovy
-compile 'com.google.cloud:google-cloud-pubsub:1.105.1'
+compile 'com.google.cloud:google-cloud-pubsub:1.106.0'
```
If you are using SBT, add this to your dependencies
```Scala
-libraryDependencies += "com.google.cloud" % "google-cloud-pubsub" % "1.105.1"
+libraryDependencies += "com.google.cloud" % "google-cloud-pubsub" % "1.106.0"
```
[//]: # ({x-version-update-end})
@@ -265,7 +265,8 @@ Apache 2.0 - See [LICENSE][license] for more information.
Java Version | Status
------------ | ------
-Java 7 | [![Kokoro CI][kokoro-badge-image-1]][kokoro-badge-link-1]Java 8 | [![Kokoro CI][kokoro-badge-image-2]][kokoro-badge-link-2]
+Java 7 | [![Kokoro CI][kokoro-badge-image-1]][kokoro-badge-link-1]
+Java 8 | [![Kokoro CI][kokoro-badge-image-2]][kokoro-badge-link-2]
Java 8 OSX | [![Kokoro CI][kokoro-badge-image-3]][kokoro-badge-link-3]
Java 8 Windows | [![Kokoro CI][kokoro-badge-image-4]][kokoro-badge-link-4]
Java 11 | [![Kokoro CI][kokoro-badge-image-5]][kokoro-badge-link-5]
diff --git a/synth.metadata b/synth.metadata
index 8b91264df..67e6c7384 100644
--- a/synth.metadata
+++ b/synth.metadata
@@ -4,7 +4,7 @@
"git": {
"name": ".",
"remote": "https://github.com/googleapis/java-pubsub.git",
- "sha": "16624f88ad19ccaf2ea074a62242496be103659f"
+ "sha": "63a0e7a423ca0e9de9e446f0686aec6e6368f67c"
}
},
{
@@ -19,7 +19,7 @@
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
- "sha": "65f8c647c0bc0c6b38211b969a2a003e271a5ef1"
+ "sha": "388f7aafee3d7a067c23db6c13b7e83fb361c64a"
}
}
],
From 49ecc69fb6a63abf6a83f82f2820ff386cdaf5fb Mon Sep 17 00:00:00 2001
From: Stephanie Wang
Date: Wed, 27 May 2020 14:00:11 -0400
Subject: [PATCH 07/22] deps: bump shared-deps version and add back certain
test deps (#218)
---
pom.xml | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index af518b3ce..9aff1afe3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -74,7 +74,7 @@
com.google.cloud
google-cloud-shared-dependencies
- 0.4.0
+ 0.5.0
pom
import
@@ -105,12 +105,32 @@
error_prone_annotations
${errorprone.version}
+
+
+
+ junit
+ junit
+ 4.13
+ test
+
+
+ com.google.api.grpc
+ grpc-google-iam-v1
+ 0.13.0
+ test
+
org.easymock
easymock
${easymock.version}
test
+
+ com.google.truth
+ truth
+ 1.0.1
+ test
+
From c6fc69d47dea6f3833a9a2945d27ed3f9e310c52 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate
Date: Thu, 28 May 2020 18:42:04 +0200
Subject: [PATCH 08/22] deps: update dependency
com.google.cloud:google-cloud-shared-dependencies to v0.6.0 (#219)
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 9aff1afe3..158ae28a8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -74,7 +74,7 @@
com.google.cloud
google-cloud-shared-dependencies
- 0.5.0
+ 0.6.0
pom
import
From 28ab5211c344d60743c3cb11f568c8f2a4e2c040 Mon Sep 17 00:00:00 2001
From: Stephanie Wang
Date: Thu, 28 May 2020 19:27:23 -0400
Subject: [PATCH 09/22] deps: remove grpc test dep since it's now in
shared-deps (#220)
---
pom.xml | 6 ------
1 file changed, 6 deletions(-)
diff --git a/pom.xml b/pom.xml
index 158ae28a8..e2222c990 100644
--- a/pom.xml
+++ b/pom.xml
@@ -113,12 +113,6 @@
4.13
test
-
- com.google.api.grpc
- grpc-google-iam-v1
- 0.13.0
- test
-
org.easymock
easymock
From 85eff94c3b8b437f91d5d70218089edee2c5752c Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate
Date: Fri, 29 May 2020 20:42:13 +0200
Subject: [PATCH 10/22] chore(deps): update dependency
com.google.cloud:libraries-bom to v5.5.0 (#224)
This PR contains the following updates:
| Package | Update | Change |
|---|---|---|
| [com.google.cloud:libraries-bom](https://togithub.com/GoogleCloudPlatform/cloud-opensource-java) | minor | `5.4.0` -> `5.5.0` |
---
### Renovate configuration
:date: **Schedule**: At any time (no schedule defined).
:vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied.
:recycle: **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.
---
- [ ] If you want to rebase/retry this PR, check this box
---
This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#googleapis/java-pubsub).
---
samples/snippets/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml
index d8a58f407..b8373ed8a 100644
--- a/samples/snippets/pom.xml
+++ b/samples/snippets/pom.xml
@@ -45,7 +45,7 @@
com.google.cloud
libraries-bom
- 5.4.0
+ 5.5.0
pom
import
From 89eae9a6c3dc585926f85fc0de2b80f7dbfedb42 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate
Date: Tue, 2 Jun 2020 19:22:55 +0200
Subject: [PATCH 11/22] deps: update dependency
com.google.cloud:google-cloud-shared-dependencies to v0.7.0 (#221)
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index e2222c990..0ffd24d3d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -74,7 +74,7 @@
com.google.cloud
google-cloud-shared-dependencies
- 0.6.0
+ 0.7.0
pom
import
From f375ecbbd66e518a25c1d0459ba0634121ddced1 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate
Date: Tue, 2 Jun 2020 19:24:15 +0200
Subject: [PATCH 12/22] deps: update dependency
com.google.errorprone:error_prone_annotations to v2.4.0 (#225)
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 0ffd24d3d..8b4b9a0a2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -65,7 +65,7 @@
google-cloud-pubsub-parent
4.2
1.3.2
- 2.3.4
+ 2.4.0
1.7.2
From ed222384f58d1b3b61d9844bfefe55d71961fbc4 Mon Sep 17 00:00:00 2001
From: Yoshi Automation Bot
Date: Wed, 3 Jun 2020 11:46:15 -0700
Subject: [PATCH 13/22] chore: regenerate README versions (#213)
This PR was generated using Autosynth. :rainbow:
Synth log will be available here:
https://source.cloud.google.com/results/invocations/92fae1bc-c876-439b-aed4-253c36a9f7b1/targets
From 19aba2e657ec55f8ba20f142c51c9f95c87acdc3 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate
Date: Thu, 4 Jun 2020 22:33:28 +0200
Subject: [PATCH 14/22] build(deps): update dependency
org.apache.maven.plugins:maven-project-info-reports-plugin to v3.1.0 (#226)
This PR contains the following updates:
| Package | Update | Change |
|---|---|---|
| org.apache.maven.plugins:maven-project-info-reports-plugin | minor | `3.0.0` -> `3.1.0` |
---
### Renovate configuration
:date: **Schedule**: At any time (no schedule defined).
:vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied.
:recycle: **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.
---
- [ ] If you want to rebase/retry this PR, check this box
---
This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#googleapis/java-pubsub).
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 8b4b9a0a2..d70aea590 100644
--- a/pom.xml
+++ b/pom.xml
@@ -164,7 +164,7 @@
org.apache.maven.plugins
maven-project-info-reports-plugin
- 3.0.0
+ 3.1.0
From 3d1052a15a0f3ab57cb8199ad890c16a0c1ef035 Mon Sep 17 00:00:00 2001
From: Tianzi Cai
Date: Fri, 5 Jun 2020 11:24:53 -0700
Subject: [PATCH 15/22] samples: migrate publisher samples and add tests (#227)
* add publisher examples
* remove enable-samples and format plugin
---
pom.xml | 10 --
...bscriptionWithDeadLetterPolicyExample.java | 8 +-
.../PublishWithBatchSettingsExample.java | 93 ++++++++++++++++++
.../PublishWithConcurrencyControlExample.java | 85 ++++++++++++++++
.../PublishWithCustomAttributesExample.java | 71 ++++++++++++++
.../PublishWithErrorHandlerExample.java | 96 +++++++++++++++++++
.../PublishWithRetrySettingsExample.java | 88 +++++++++++++++++
...veMessagesWithDeliveryAttemptsExample.java | 4 +-
.../pubsub/RemoveDeadLetterPolicyExample.java | 6 +-
.../pubsub/UpdateDeadLetterPolicyExample.java | 8 +-
.../src/test/java/pubsub/PublisherIT.java | 88 +++++++++++++++++
11 files changed, 534 insertions(+), 23 deletions(-)
create mode 100644 samples/snippets/src/main/java/pubsub/PublishWithBatchSettingsExample.java
create mode 100644 samples/snippets/src/main/java/pubsub/PublishWithConcurrencyControlExample.java
create mode 100644 samples/snippets/src/main/java/pubsub/PublishWithCustomAttributesExample.java
create mode 100644 samples/snippets/src/main/java/pubsub/PublishWithErrorHandlerExample.java
create mode 100644 samples/snippets/src/main/java/pubsub/PublishWithRetrySettingsExample.java
create mode 100644 samples/snippets/src/test/java/pubsub/PublisherIT.java
diff --git a/pom.xml b/pom.xml
index d70aea590..6813a9d5a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -149,16 +149,6 @@
google-cloud-pubsub-bom
-
-
-
- enable-samples
-
- samples
-
-
-
-
diff --git a/samples/snippets/src/main/java/pubsub/CreateSubscriptionWithDeadLetterPolicyExample.java b/samples/snippets/src/main/java/pubsub/CreateSubscriptionWithDeadLetterPolicyExample.java
index c9a07fb4a..90a492f74 100644
--- a/samples/snippets/src/main/java/pubsub/CreateSubscriptionWithDeadLetterPolicyExample.java
+++ b/samples/snippets/src/main/java/pubsub/CreateSubscriptionWithDeadLetterPolicyExample.java
@@ -28,15 +28,15 @@ public class CreateSubscriptionWithDeadLetterPolicyExample {
public static void main(String... args) throws Exception {
// TODO(developer): Replace these variables before running the sample.
- String projectId = "Your Project ID";
+ String projectId = "your-project-id";
// This is the subscription you want to create with a dead letter policy.
- String subscriptionId = "Your Subscription ID";
+ String subscriptionId = "your-subscription-id";
// This is an existing topic that you want to attach the subscription with dead letter policy
// to.
- String topicId = "Your Topic ID";
+ String topicId = "your-topic-id";
// This is an existing topic that the subscription with dead letter policy forwards dead letter
// messages to.
- String deadLetterTopicId = "Your Dead Letter Topic ID";
+ String deadLetterTopicId = "your-dead-letter-topic-id";
CreateSubscriptionWithDeadLetterPolicyExample.createSubscriptionWithDeadLetterPolicyExample(
projectId, subscriptionId, topicId, deadLetterTopicId);
diff --git a/samples/snippets/src/main/java/pubsub/PublishWithBatchSettingsExample.java b/samples/snippets/src/main/java/pubsub/PublishWithBatchSettingsExample.java
new file mode 100644
index 000000000..e970607bf
--- /dev/null
+++ b/samples/snippets/src/main/java/pubsub/PublishWithBatchSettingsExample.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2020 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package pubsub;
+
+// [START pubsub_publisher_batch_settings]
+
+import com.google.api.core.ApiFuture;
+import com.google.api.core.ApiFutures;
+import com.google.api.gax.batching.BatchingSettings;
+import com.google.cloud.pubsub.v1.Publisher;
+import com.google.protobuf.ByteString;
+import com.google.pubsub.v1.PubsubMessage;
+import com.google.pubsub.v1.TopicName;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import org.threeten.bp.Duration;
+
+public class PublishWithBatchSettingsExample {
+ public static void main(String... args) throws Exception {
+ // TODO(developer): Replace these variables before running the sample.
+ String projectId = "your-project-id";
+ String topicId = "your-topic-id";
+
+ publishWithBatchSettingsExample(projectId, topicId);
+ }
+
+ public static void publishWithBatchSettingsExample(String projectId, String topicId)
+ throws IOException, ExecutionException, InterruptedException {
+ TopicName topicName = TopicName.of(projectId, topicId);
+ Publisher publisher = null;
+ List> messageIdFutures = new ArrayList<>();
+
+ try {
+ // Batch settings control how the publisher batches messages
+ long requestBytesThreshold = 5000L; // default : 1 byte
+ long messageCountBatchSize = 100L; // default : 1 message
+
+ Duration publishDelayThreshold = Duration.ofMillis(100); // default : 1 ms
+
+ // Publish request get triggered based on request size, messages count & time since last
+ // publish
+ BatchingSettings batchingSettings =
+ BatchingSettings.newBuilder()
+ .setElementCountThreshold(messageCountBatchSize)
+ .setRequestByteThreshold(requestBytesThreshold)
+ .setDelayThreshold(publishDelayThreshold)
+ .build();
+
+ // Create a publisher instance with default settings bound to the topic
+ publisher = Publisher.newBuilder(topicName).setBatchingSettings(batchingSettings).build();
+
+ // schedule publishing one message at a time : messages get automatically batched
+ for (int i = 0; i < 100; i++) {
+ String message = "message " + i;
+ ByteString data = ByteString.copyFromUtf8(message);
+ PubsubMessage pubsubMessage = PubsubMessage.newBuilder().setData(data).build();
+
+ // Once published, returns a server-assigned message id (unique within the topic)
+ ApiFuture messageIdFuture = publisher.publish(pubsubMessage);
+ messageIdFutures.add(messageIdFuture);
+ }
+ } finally {
+ // Wait on any pending publish requests.
+ List messageIds = ApiFutures.allAsList(messageIdFutures).get();
+
+ System.out.println("Published " + messageIds.size() + " messages with batch settings.");
+
+ if (publisher != null) {
+ // When finished with the publisher, shutdown to free up resources.
+ publisher.shutdown();
+ publisher.awaitTermination(1, TimeUnit.MINUTES);
+ }
+ }
+ }
+}
+// [END pubsub_publisher_batch_settings]
diff --git a/samples/snippets/src/main/java/pubsub/PublishWithConcurrencyControlExample.java b/samples/snippets/src/main/java/pubsub/PublishWithConcurrencyControlExample.java
new file mode 100644
index 000000000..35b72415a
--- /dev/null
+++ b/samples/snippets/src/main/java/pubsub/PublishWithConcurrencyControlExample.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2020 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package pubsub;
+
+// [START pubsub_publisher_concurrency_control]
+
+import com.google.api.core.ApiFuture;
+import com.google.api.core.ApiFutures;
+import com.google.api.gax.core.ExecutorProvider;
+import com.google.api.gax.core.InstantiatingExecutorProvider;
+import com.google.cloud.pubsub.v1.Publisher;
+import com.google.protobuf.ByteString;
+import com.google.pubsub.v1.PubsubMessage;
+import com.google.pubsub.v1.TopicName;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+
+public class PublishWithConcurrencyControlExample {
+ public static void main(String... args) throws Exception {
+ // TODO(developer): Replace these variables before running the sample.
+ String projectId = "your-project-id";
+ String topicId = "your-topic-id";
+
+ publishWithConcurrencyControlExample(projectId, topicId);
+ }
+
+ public static void publishWithConcurrencyControlExample(String projectId, String topicId)
+ throws IOException, ExecutionException, InterruptedException {
+ TopicName topicName = TopicName.of(projectId, topicId);
+ Publisher publisher = null;
+ List> messageIdFutures = new ArrayList<>();
+
+ try {
+ // Provides an executor service for processing messages. The default
+ // `executorProvider` used by the publisher has a default thread count of
+ // 5 * the number of processors available to the Java virtual machine.
+ ExecutorProvider executorProvider =
+ InstantiatingExecutorProvider.newBuilder().setExecutorThreadCount(4).build();
+
+ // `setExecutorProvider` configures an executor for the publisher.
+ publisher = Publisher.newBuilder(topicName).setExecutorProvider(executorProvider).build();
+
+ // schedule publishing one message at a time : messages get automatically batched
+ for (int i = 0; i < 100; i++) {
+ String message = "message " + i;
+ ByteString data = ByteString.copyFromUtf8(message);
+ PubsubMessage pubsubMessage = PubsubMessage.newBuilder().setData(data).build();
+
+ // Once published, returns a server-assigned message id (unique within the topic)
+ ApiFuture messageIdFuture = publisher.publish(pubsubMessage);
+ messageIdFutures.add(messageIdFuture);
+ }
+ } finally {
+ // Wait on any pending publish requests.
+ List messageIds = ApiFutures.allAsList(messageIdFutures).get();
+
+ System.out.println("Published " + messageIds.size() + " messages with concurrency control.");
+
+ if (publisher != null) {
+ // When finished with the publisher, shutdown to free up resources.
+ publisher.shutdown();
+ publisher.awaitTermination(1, TimeUnit.MINUTES);
+ }
+ }
+ }
+}
+
+// [END pubsub_publisher_concurrency_control]
diff --git a/samples/snippets/src/main/java/pubsub/PublishWithCustomAttributesExample.java b/samples/snippets/src/main/java/pubsub/PublishWithCustomAttributesExample.java
new file mode 100644
index 000000000..990b9a03d
--- /dev/null
+++ b/samples/snippets/src/main/java/pubsub/PublishWithCustomAttributesExample.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2020 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package pubsub;
+
+// [START pubsub_publish_custom_attributes]
+
+import com.google.api.core.ApiFuture;
+import com.google.cloud.pubsub.v1.Publisher;
+import com.google.common.collect.ImmutableMap;
+import com.google.protobuf.ByteString;
+import com.google.pubsub.v1.PubsubMessage;
+import com.google.pubsub.v1.TopicName;
+import java.io.IOException;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+
+public class PublishWithCustomAttributesExample {
+ public static void main(String... args) throws Exception {
+ // TODO(developer): Replace these variables before running the sample.
+ String projectId = "your-project-id";
+ String topicId = "your-topic-id";
+
+ publishWithCustomAttributesExample(projectId, topicId);
+ }
+
+ public static void publishWithCustomAttributesExample(String projectId, String topicId)
+ throws IOException, ExecutionException, InterruptedException {
+ TopicName topicName = TopicName.of(projectId, topicId);
+ Publisher publisher = null;
+
+ try {
+ // Create a publisher instance with default settings bound to the topic
+ publisher = Publisher.newBuilder(topicName).build();
+
+ String message = "first message";
+ ByteString data = ByteString.copyFromUtf8(message);
+ PubsubMessage pubsubMessage =
+ PubsubMessage.newBuilder()
+ .setData(data)
+ .putAllAttributes(ImmutableMap.of("year", "2020", "author", "unknown"))
+ .build();
+
+ // Once published, returns a server-assigned message id (unique within the topic)
+ ApiFuture messageIdFuture = publisher.publish(pubsubMessage);
+ String messageId = messageIdFuture.get();
+ System.out.println("Published a message with custom attributes: " + messageId);
+
+ } finally {
+ if (publisher != null) {
+ // When finished with the publisher, shutdown to free up resources.
+ publisher.shutdown();
+ publisher.awaitTermination(1, TimeUnit.MINUTES);
+ }
+ }
+ }
+}
+// [END pubsub_publish_custom_attributes]
diff --git a/samples/snippets/src/main/java/pubsub/PublishWithErrorHandlerExample.java b/samples/snippets/src/main/java/pubsub/PublishWithErrorHandlerExample.java
new file mode 100644
index 000000000..88e42d61e
--- /dev/null
+++ b/samples/snippets/src/main/java/pubsub/PublishWithErrorHandlerExample.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2020 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package pubsub;
+
+// [START pubsub_publish_with_error_handler]
+
+import com.google.api.core.ApiFuture;
+import com.google.api.core.ApiFutureCallback;
+import com.google.api.core.ApiFutures;
+import com.google.api.gax.rpc.ApiException;
+import com.google.cloud.pubsub.v1.Publisher;
+import com.google.common.util.concurrent.MoreExecutors;
+import com.google.protobuf.ByteString;
+import com.google.pubsub.v1.PubsubMessage;
+import com.google.pubsub.v1.TopicName;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+public class PublishWithErrorHandlerExample {
+
+ public static void main(String... args) throws Exception {
+ // TODO(developer): Replace these variables before running the sample.
+ String projectId = "your-project-id";
+ String topicId = "your-topic-id";
+
+ publishWithErrorHandlerExample(projectId, topicId);
+ }
+
+ public static void publishWithErrorHandlerExample(String projectId, String topicId)
+ throws IOException, InterruptedException {
+ TopicName topicName = TopicName.of(projectId, topicId);
+ Publisher publisher = null;
+
+ try {
+ // Create a publisher instance with default settings bound to the topic
+ publisher = Publisher.newBuilder(topicName).build();
+
+ List messages = Arrays.asList("first message", "second message");
+
+ for (final String message : messages) {
+ ByteString data = ByteString.copyFromUtf8(message);
+ PubsubMessage pubsubMessage = PubsubMessage.newBuilder().setData(data).build();
+
+ // Once published, returns a server-assigned message id (unique within the topic)
+ ApiFuture future = publisher.publish(pubsubMessage);
+
+ // Add an asynchronous callback to handle success / failure
+ ApiFutures.addCallback(
+ future,
+ new ApiFutureCallback() {
+
+ @Override
+ public void onFailure(Throwable throwable) {
+ if (throwable instanceof ApiException) {
+ ApiException apiException = ((ApiException) throwable);
+ // details on the API exception
+ System.out.println(apiException.getStatusCode().getCode());
+ System.out.println(apiException.isRetryable());
+ }
+ System.out.println("Error publishing message : " + message);
+ }
+
+ @Override
+ public void onSuccess(String messageId) {
+ // Once published, returns server-assigned message ids (unique within the topic)
+ System.out.println("Published message ID: " + messageId);
+ }
+ },
+ MoreExecutors.directExecutor());
+ }
+ } finally {
+ if (publisher != null) {
+ // When finished with the publisher, shutdown to free up resources.
+ publisher.shutdown();
+ publisher.awaitTermination(1, TimeUnit.MINUTES);
+ }
+ }
+ }
+}
+// [END pubsub_publish_with_error_handler]
diff --git a/samples/snippets/src/main/java/pubsub/PublishWithRetrySettingsExample.java b/samples/snippets/src/main/java/pubsub/PublishWithRetrySettingsExample.java
new file mode 100644
index 000000000..909702dec
--- /dev/null
+++ b/samples/snippets/src/main/java/pubsub/PublishWithRetrySettingsExample.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2020 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package pubsub;
+
+// [START pubsub_publisher_retry_settings]
+
+import com.google.api.core.ApiFuture;
+import com.google.api.gax.retrying.RetrySettings;
+import com.google.cloud.pubsub.v1.Publisher;
+import com.google.protobuf.ByteString;
+import com.google.pubsub.v1.PubsubMessage;
+import com.google.pubsub.v1.TopicName;
+import java.io.IOException;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import org.threeten.bp.Duration;
+
+public class PublishWithRetrySettingsExample {
+ public static void main(String... args) throws Exception {
+ // TODO(developer): Replace these variables before running the sample.
+ String projectId = "your-project-id";
+ String topicId = "your-topic-id";
+
+ publishWithRetrySettingsExample(projectId, topicId);
+ }
+
+ public static void publishWithRetrySettingsExample(String projectId, String topicId)
+ throws IOException, ExecutionException, InterruptedException {
+ TopicName topicName = TopicName.of(projectId, topicId);
+ Publisher publisher = null;
+
+ try {
+ // Retry settings control how the publisher handles retry-able failures
+ Duration initialRetryDelay = Duration.ofMillis(100); // default: 100 ms
+ double retryDelayMultiplier = 2.0; // back off for repeated failures, default: 1.3
+ Duration maxRetryDelay = Duration.ofSeconds(60); // default : 60 seconds
+ Duration initialRpcTimeout = Duration.ofSeconds(1); // default: 5 seconds
+ double rpcTimeoutMultiplier = 1.0; // default: 1.0
+ Duration maxRpcTimeout = Duration.ofSeconds(600); // default: 600 seconds
+ Duration totalTimeout = Duration.ofSeconds(600); // default: 600 seconds
+
+ RetrySettings retrySettings =
+ RetrySettings.newBuilder()
+ .setInitialRetryDelay(initialRetryDelay)
+ .setRetryDelayMultiplier(retryDelayMultiplier)
+ .setMaxRetryDelay(maxRetryDelay)
+ .setInitialRpcTimeout(initialRpcTimeout)
+ .setRpcTimeoutMultiplier(rpcTimeoutMultiplier)
+ .setMaxRpcTimeout(maxRpcTimeout)
+ .setTotalTimeout(totalTimeout)
+ .build();
+
+ // Create a publisher instance with default settings bound to the topic
+ publisher = Publisher.newBuilder(topicName).setRetrySettings(retrySettings).build();
+
+ String message = "first message";
+ ByteString data = ByteString.copyFromUtf8(message);
+ PubsubMessage pubsubMessage = PubsubMessage.newBuilder().setData(data).build();
+
+ // Once published, returns a server-assigned message id (unique within the topic)
+ ApiFuture messageIdFuture = publisher.publish(pubsubMessage);
+ String messageId = messageIdFuture.get();
+ System.out.println("Published a message with retry settings: " + messageId);
+
+ } finally {
+ if (publisher != null) {
+ // When finished with the publisher, shutdown to free up resources.
+ publisher.shutdown();
+ publisher.awaitTermination(1, TimeUnit.MINUTES);
+ }
+ }
+ }
+}
+// [END pubsub_publisher_retry_settings]
diff --git a/samples/snippets/src/main/java/pubsub/ReceiveMessagesWithDeliveryAttemptsExample.java b/samples/snippets/src/main/java/pubsub/ReceiveMessagesWithDeliveryAttemptsExample.java
index 8612e45dc..b63ca1dd7 100644
--- a/samples/snippets/src/main/java/pubsub/ReceiveMessagesWithDeliveryAttemptsExample.java
+++ b/samples/snippets/src/main/java/pubsub/ReceiveMessagesWithDeliveryAttemptsExample.java
@@ -30,9 +30,9 @@ public class ReceiveMessagesWithDeliveryAttemptsExample {
public static void main(String... args) throws Exception {
// TODO(developer): Replace these variables before running the sample.
- String projectId = "Your Project ID";
+ String projectId = "your-project-id";
// This is an existing subscription with a dead letter policy.
- String subscriptionId = "Your Subscription ID";
+ String subscriptionId = "your-subscription-id";
ReceiveMessagesWithDeliveryAttemptsExample.receiveMessagesWithDeliveryAttemptsExample(
projectId, subscriptionId);
diff --git a/samples/snippets/src/main/java/pubsub/RemoveDeadLetterPolicyExample.java b/samples/snippets/src/main/java/pubsub/RemoveDeadLetterPolicyExample.java
index 51d23594a..842657b08 100644
--- a/samples/snippets/src/main/java/pubsub/RemoveDeadLetterPolicyExample.java
+++ b/samples/snippets/src/main/java/pubsub/RemoveDeadLetterPolicyExample.java
@@ -29,11 +29,11 @@ public class RemoveDeadLetterPolicyExample {
public static void main(String... args) throws Exception {
// TODO(developer): Replace these variables before running the sample.
- String projectId = "Your Project ID";
+ String projectId = "your-project-id";
// This is an existing subscription with dead letter policy.
- String subscriptionId = "Your Subscription ID";
+ String subscriptionId = "your-subscription-id";
// This is an existing topic that the subscription with dead letter policy is attached to.
- String topicId = "Your Topic ID";
+ String topicId = "your-topic-id";
RemoveDeadLetterPolicyExample.removeDeadLetterPolicyExample(projectId, subscriptionId, topicId);
}
diff --git a/samples/snippets/src/main/java/pubsub/UpdateDeadLetterPolicyExample.java b/samples/snippets/src/main/java/pubsub/UpdateDeadLetterPolicyExample.java
index ff4270ea6..c8d7babee 100644
--- a/samples/snippets/src/main/java/pubsub/UpdateDeadLetterPolicyExample.java
+++ b/samples/snippets/src/main/java/pubsub/UpdateDeadLetterPolicyExample.java
@@ -30,14 +30,14 @@
public class UpdateDeadLetterPolicyExample {
public static void main(String... args) throws Exception {
// TODO(developer): Replace these variables before running the sample.
- String projectId = "Your Project ID";
+ String projectId = "your-project-id";
// This is an existing subscription with a dead letter policy.
- String subscriptionId = "Your Subscription ID";
+ String subscriptionId = "your-subscription-id";
// This is an existing topic that the subscription with dead letter policy is attached to.
- String topicId = "Your Topic ID";
+ String topicId = "your-topic-id";
// This is an existing dead letter topic that the subscription with dead letter policy forwards
// dead letter messages to.
- String deadLetterTopicId = "Your Dead Letter Topic ID";
+ String deadLetterTopicId = "your-dead-letter-topic-id";
UpdateDeadLetterPolicyExample.updateDeadLetterPolicyExample(
projectId, subscriptionId, topicId, deadLetterTopicId);
diff --git a/samples/snippets/src/test/java/pubsub/PublisherIT.java b/samples/snippets/src/test/java/pubsub/PublisherIT.java
new file mode 100644
index 000000000..79fd34c90
--- /dev/null
+++ b/samples/snippets/src/test/java/pubsub/PublisherIT.java
@@ -0,0 +1,88 @@
+package pubsub;
+
+import static com.google.common.truth.Truth.assertThat;
+import static junit.framework.TestCase.assertNotNull;
+
+import com.google.cloud.pubsub.v1.TopicAdminClient;
+import com.google.pubsub.v1.Topic;
+import com.google.pubsub.v1.TopicName;
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+import java.util.UUID;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.Timeout;
+
+public class PublisherIT {
+ private ByteArrayOutputStream bout;
+ private PrintStream out;
+
+ private static final String projectId = System.getenv("GOOGLE_CLOUD_PROJECT");
+ private static final String _suffix = UUID.randomUUID().toString();
+ private static final String topicId = "publisher-test-topic-" + _suffix;
+ private static final TopicName topicName = TopicName.of(projectId, topicId);
+
+ private static void requireEnvVar(String varName) {
+ assertNotNull(
+ "Environment variable " + varName + " is required to perform these tests.",
+ System.getenv(varName));
+ }
+
+ @Rule public Timeout globalTimeout = Timeout.seconds(300); // 5 minute timeout
+
+ @BeforeClass
+ public static void checkRequirements() {
+ requireEnvVar("GOOGLE_CLOUD_PROJECT");
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ bout = new ByteArrayOutputStream();
+ out = new PrintStream(bout);
+ System.setOut(out);
+
+ try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+ Topic topic = Topic.newBuilder().setName(topicName.toString()).build();
+ topicAdminClient.createTopic(topic);
+ }
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+ topicAdminClient.deleteTopic(topicName.toString());
+ }
+
+ System.setOut(null);
+ }
+
+ @Test
+ public void testPublisher() throws Exception {
+ // Test publish with error handling
+ PublishWithErrorHandlerExample.publishWithErrorHandlerExample(projectId, topicId);
+ assertThat(bout.toString()).contains("Published message ID: ");
+
+ bout.reset();
+ // Test publish with custom attributes.
+ PublishWithCustomAttributesExample.publishWithCustomAttributesExample(projectId, topicId);
+ assertThat(bout.toString()).contains("Published a message with custom attributes: ");
+
+ bout.reset();
+ // Test publish with batch settings.
+ PublishWithBatchSettingsExample.publishWithBatchSettingsExample(projectId, topicId);
+ assertThat(bout.toString()).contains("Published 100 messages with batch settings.");
+
+ bout.reset();
+ // Test publish with concurrency control.
+ PublishWithConcurrencyControlExample.publishWithConcurrencyControlExample(projectId, topicId);
+ assertThat(bout.toString()).contains("Published 100 messages with concurrency control.");
+
+ bout.reset();
+ // Test publish with Retry settings.
+ PublishWithRetrySettingsExample.publishWithRetrySettingsExample(projectId, topicId);
+ assertThat(bout.toString()).contains("Published a message with retry settings: ");
+ }
+}
From 507673b54549e0cde8edb12d44a09a57663536eb Mon Sep 17 00:00:00 2001
From: Yoshi Automation Bot
Date: Fri, 5 Jun 2020 12:20:12 -0700
Subject: [PATCH 16/22] chore(java_templates): add default CODEOWNERS files for
samples reviews (#229)
This PR was generated using Autosynth. :rainbow:
Synth log will be available here:
https://source.cloud.google.com/results/invocations/129bf4ce-2255-4b88-83a1-1b40d560e3d3/targets
Source-Link: https://github.com/googleapis/synthtool/commit/8b65daa222d193b689279162781baf0aa1f0ffd2
---
.github/CODEOWNERS | 8 ++++++++
README.md | 2 +-
synth.metadata | 4 ++--
3 files changed, 11 insertions(+), 3 deletions(-)
create mode 100644 .github/CODEOWNERS
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
new file mode 100644
index 000000000..6137bef2a
--- /dev/null
+++ b/.github/CODEOWNERS
@@ -0,0 +1,8 @@
+# Code owners file.
+# This file controls who is tagged for review for any given pull request.
+
+# For syntax help see:
+# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax
+
+# The java-samples-reviewers team is the default owner for samples changes
+samples/**/*.java @googleapis/java-samples-reviewers
diff --git a/README.md b/README.md
index cf44cb0f7..53e551aa3 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file
com.google.cloud
libraries-bom
- 5.4.0
+ 5.5.0
pom
import
diff --git a/synth.metadata b/synth.metadata
index 67e6c7384..3707cd7d4 100644
--- a/synth.metadata
+++ b/synth.metadata
@@ -4,7 +4,7 @@
"git": {
"name": ".",
"remote": "https://github.com/googleapis/java-pubsub.git",
- "sha": "63a0e7a423ca0e9de9e446f0686aec6e6368f67c"
+ "sha": "ed222384f58d1b3b61d9844bfefe55d71961fbc4"
}
},
{
@@ -19,7 +19,7 @@
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
- "sha": "388f7aafee3d7a067c23db6c13b7e83fb361c64a"
+ "sha": "8b65daa222d193b689279162781baf0aa1f0ffd2"
}
}
],
From 8414ee7fc30d581f22becd00d3cca0dc156cc2ac Mon Sep 17 00:00:00 2001
From: Yoshi Automation Bot
Date: Fri, 5 Jun 2020 12:34:02 -0700
Subject: [PATCH 17/22] changes without context (#228)
autosynth cannot find the source of changes triggered by earlier changes in this
repository, or by version upgrades to tools such as linters.
Co-authored-by: Tianzi Cai
From 09866b0d36e2dd1c994b4c91807d71552b65c8e1 Mon Sep 17 00:00:00 2001
From: Yoshi Automation Bot
Date: Fri, 5 Jun 2020 13:18:17 -0700
Subject: [PATCH 18/22] feat: add detach subscription rpc (#216)
* changes without context
autosynth cannot find the source of changes triggered by earlier changes in this
repository, or by version upgrades to tools such as linters.
* Add DetachSubscription RPC
PiperOrigin-RevId: 313276022
Source-Author: Google APIs
Source-Date: Tue May 26 15:11:32 2020 -0700
Source-Repo: googleapis/googleapis
Source-Sha: f5f268f5293e60143ac742a4eeb7dd6306ebf505
Source-Link: https://github.com/googleapis/googleapis/commit/f5f268f5293e60143ac742a4eeb7dd6306ebf505
---
.../cloud/pubsub/v1/TopicAdminClient.java | 62 +-
.../cloud/pubsub/v1/TopicAdminSettings.java | 14 +
.../pubsub/v1/stub/GrpcPublisherStub.java | 38 +
.../cloud/pubsub/v1/stub/PublisherStub.java | 7 +
.../pubsub/v1/stub/PublisherStubSettings.java | 35 +-
.../cloud/pubsub/v1/MockPublisherImpl.java | 18 +
.../cloud/pubsub/v1/TopicAdminClientTest.java | 44 ++
.../com/google/pubsub/v1/PublisherGrpc.java | 138 +++-
.../pubsub/v1/DetachSubscriptionRequest.java | 653 ++++++++++++++++++
.../DetachSubscriptionRequestOrBuilder.java | 56 ++
.../pubsub/v1/DetachSubscriptionResponse.java | 457 ++++++++++++
.../DetachSubscriptionResponseOrBuilder.java | 24 +
.../v1/ListTopicSubscriptionsResponse.java | 26 +-
...stTopicSubscriptionsResponseOrBuilder.java | 8 +-
.../com/google/pubsub/v1/PubsubProto.java | 499 ++++++-------
.../main/proto/google/pubsub/v1/pubsub.proto | 29 +-
synth.metadata | 6 +-
17 files changed, 1846 insertions(+), 268 deletions(-)
create mode 100644 proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DetachSubscriptionRequest.java
create mode 100644 proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DetachSubscriptionRequestOrBuilder.java
create mode 100644 proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DetachSubscriptionResponse.java
create mode 100644 proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DetachSubscriptionResponseOrBuilder.java
diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminClient.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminClient.java
index 548523021..04c4bc231 100644
--- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminClient.java
+++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminClient.java
@@ -37,6 +37,8 @@
import com.google.iam.v1.TestIamPermissionsResponse;
import com.google.protobuf.Empty;
import com.google.pubsub.v1.DeleteTopicRequest;
+import com.google.pubsub.v1.DetachSubscriptionRequest;
+import com.google.pubsub.v1.DetachSubscriptionResponse;
import com.google.pubsub.v1.GetTopicRequest;
import com.google.pubsub.v1.ListTopicSnapshotsRequest;
import com.google.pubsub.v1.ListTopicSnapshotsResponse;
@@ -724,7 +726,7 @@ public final UnaryCallable listTopicsCall
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
- * Lists the names of the subscriptions on this topic.
+ * Lists the names of the attached subscriptions on this topic.
*
* Sample code:
*
@@ -751,7 +753,7 @@ public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions(TopicNam
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
- * Lists the names of the subscriptions on this topic.
+ * Lists the names of the attached subscriptions on this topic.
*
*
Sample code:
*
@@ -804,7 +806,7 @@ public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions(ProjectT
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
- * Lists the names of the subscriptions on this topic.
+ * Lists the names of the attached subscriptions on this topic.
*
*
Sample code:
*
@@ -830,7 +832,7 @@ public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions(
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
- * Lists the names of the subscriptions on this topic.
+ * Lists the names of the attached subscriptions on this topic.
*
*
Sample code:
*
@@ -855,7 +857,7 @@ public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions(
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
- * Lists the names of the subscriptions on this topic.
+ * Lists the names of the attached subscriptions on this topic.
*
*
Sample code:
*
@@ -1416,6 +1418,56 @@ public final TestIamPermissionsResponse testIamPermissions(
return stub.testIamPermissionsCallable();
}
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Detaches a subscription from this topic. All messages retained in the subscription are dropped.
+ * Subsequent `Pull` and `StreamingPull` requests will return FAILED_PRECONDITION. If the
+ * subscription is a push subscription, pushes to the endpoint will stop.
+ *
+ *
Sample code:
+ *
+ *
+ * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+ * TopicName subscription = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
+ * DetachSubscriptionRequest request = DetachSubscriptionRequest.newBuilder()
+ * .setSubscription(subscription.toString())
+ * .build();
+ * DetachSubscriptionResponse response = topicAdminClient.detachSubscription(request);
+ * }
+ *
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final DetachSubscriptionResponse detachSubscription(DetachSubscriptionRequest request) {
+ return detachSubscriptionCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Detaches a subscription from this topic. All messages retained in the subscription are dropped.
+ * Subsequent `Pull` and `StreamingPull` requests will return FAILED_PRECONDITION. If the
+ * subscription is a push subscription, pushes to the endpoint will stop.
+ *
+ * Sample code:
+ *
+ *
+ * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+ * TopicName subscription = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
+ * DetachSubscriptionRequest request = DetachSubscriptionRequest.newBuilder()
+ * .setSubscription(subscription.toString())
+ * .build();
+ * ApiFuture<DetachSubscriptionResponse> future = topicAdminClient.detachSubscriptionCallable().futureCall(request);
+ * // Do something
+ * DetachSubscriptionResponse response = future.get();
+ * }
+ *
+ */
+ public final UnaryCallable
+ detachSubscriptionCallable() {
+ return stub.detachSubscriptionCallable();
+ }
+
@Override
public final void close() {
stub.close();
diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminSettings.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminSettings.java
index 59119e19b..7c79aabc7 100644
--- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminSettings.java
+++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminSettings.java
@@ -39,6 +39,8 @@
import com.google.iam.v1.TestIamPermissionsResponse;
import com.google.protobuf.Empty;
import com.google.pubsub.v1.DeleteTopicRequest;
+import com.google.pubsub.v1.DetachSubscriptionRequest;
+import com.google.pubsub.v1.DetachSubscriptionResponse;
import com.google.pubsub.v1.GetTopicRequest;
import com.google.pubsub.v1.ListTopicSnapshotsRequest;
import com.google.pubsub.v1.ListTopicSnapshotsResponse;
@@ -150,6 +152,12 @@ public UnaryCallSettings getIamPolicySettings() {
return ((PublisherStubSettings) getStubSettings()).testIamPermissionsSettings();
}
+ /** Returns the object with the settings used for calls to detachSubscription. */
+ public UnaryCallSettings
+ detachSubscriptionSettings() {
+ return ((PublisherStubSettings) getStubSettings()).detachSubscriptionSettings();
+ }
+
public static final TopicAdminSettings create(PublisherStubSettings stub) throws IOException {
return new TopicAdminSettings.Builder(stub.toBuilder()).build();
}
@@ -310,6 +318,12 @@ public UnaryCallSettings.Builder getIamPolicySettin
return getStubSettingsBuilder().testIamPermissionsSettings();
}
+ /** Returns the builder for the settings used for calls to detachSubscription. */
+ public UnaryCallSettings.Builder
+ detachSubscriptionSettings() {
+ return getStubSettingsBuilder().detachSubscriptionSettings();
+ }
+
@Override
public TopicAdminSettings build() throws IOException {
return new TopicAdminSettings(this);
diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcPublisherStub.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcPublisherStub.java
index 02baa7378..52cdf25dc 100644
--- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcPublisherStub.java
+++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcPublisherStub.java
@@ -35,6 +35,8 @@
import com.google.iam.v1.TestIamPermissionsResponse;
import com.google.protobuf.Empty;
import com.google.pubsub.v1.DeleteTopicRequest;
+import com.google.pubsub.v1.DetachSubscriptionRequest;
+import com.google.pubsub.v1.DetachSubscriptionResponse;
import com.google.pubsub.v1.GetTopicRequest;
import com.google.pubsub.v1.ListTopicSnapshotsRequest;
import com.google.pubsub.v1.ListTopicSnapshotsResponse;
@@ -152,6 +154,16 @@ public class GrpcPublisherStub extends PublisherStub {
.setResponseMarshaller(
ProtoUtils.marshaller(TestIamPermissionsResponse.getDefaultInstance()))
.build();
+ private static final MethodDescriptor
+ detachSubscriptionMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName("google.pubsub.v1.Publisher/DetachSubscription")
+ .setRequestMarshaller(
+ ProtoUtils.marshaller(DetachSubscriptionRequest.getDefaultInstance()))
+ .setResponseMarshaller(
+ ProtoUtils.marshaller(DetachSubscriptionResponse.getDefaultInstance()))
+ .build();
private final BackgroundResource backgroundResources;
@@ -174,6 +186,8 @@ public class GrpcPublisherStub extends PublisherStub {
private final UnaryCallable getIamPolicyCallable;
private final UnaryCallable
testIamPermissionsCallable;
+ private final UnaryCallable
+ detachSubscriptionCallable;
private final GrpcStubCallableFactory callableFactory;
@@ -360,6 +374,20 @@ public Map extract(TestIamPermissionsRequest request) {
}
})
.build();
+ GrpcCallSettings
+ detachSubscriptionTransportSettings =
+ GrpcCallSettings.newBuilder()
+ .setMethodDescriptor(detachSubscriptionMethodDescriptor)
+ .setParamsExtractor(
+ new RequestParamsExtractor() {
+ @Override
+ public Map extract(DetachSubscriptionRequest request) {
+ ImmutableMap.Builder params = ImmutableMap.builder();
+ params.put("subscription", String.valueOf(request.getSubscription()));
+ return params.build();
+ }
+ })
+ .build();
this.createTopicCallable =
callableFactory.createUnaryCallable(
@@ -413,6 +441,11 @@ public Map extract(TestIamPermissionsRequest request) {
testIamPermissionsTransportSettings,
settings.testIamPermissionsSettings(),
clientContext);
+ this.detachSubscriptionCallable =
+ callableFactory.createUnaryCallable(
+ detachSubscriptionTransportSettings,
+ settings.detachSubscriptionSettings(),
+ clientContext);
backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources());
}
@@ -478,6 +511,11 @@ public UnaryCallable getIamPolicyCallable() {
return testIamPermissionsCallable;
}
+ public UnaryCallable
+ detachSubscriptionCallable() {
+ return detachSubscriptionCallable;
+ }
+
@Override
public final void close() {
shutdown();
diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStub.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStub.java
index 6ff2d02f8..93cdf2f03 100644
--- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStub.java
+++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStub.java
@@ -29,6 +29,8 @@
import com.google.iam.v1.TestIamPermissionsResponse;
import com.google.protobuf.Empty;
import com.google.pubsub.v1.DeleteTopicRequest;
+import com.google.pubsub.v1.DetachSubscriptionRequest;
+import com.google.pubsub.v1.DetachSubscriptionResponse;
import com.google.pubsub.v1.GetTopicRequest;
import com.google.pubsub.v1.ListTopicSnapshotsRequest;
import com.google.pubsub.v1.ListTopicSnapshotsResponse;
@@ -114,6 +116,11 @@ public UnaryCallable getIamPolicyCallable() {
throw new UnsupportedOperationException("Not implemented: testIamPermissionsCallable()");
}
+ public UnaryCallable
+ detachSubscriptionCallable() {
+ throw new UnsupportedOperationException("Not implemented: detachSubscriptionCallable()");
+ }
+
@Override
public abstract void close();
}
diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStubSettings.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStubSettings.java
index ee84a4ab3..457731c61 100644
--- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStubSettings.java
+++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStubSettings.java
@@ -60,6 +60,8 @@
import com.google.iam.v1.TestIamPermissionsResponse;
import com.google.protobuf.Empty;
import com.google.pubsub.v1.DeleteTopicRequest;
+import com.google.pubsub.v1.DetachSubscriptionRequest;
+import com.google.pubsub.v1.DetachSubscriptionResponse;
import com.google.pubsub.v1.GetTopicRequest;
import com.google.pubsub.v1.ListTopicSnapshotsRequest;
import com.google.pubsub.v1.ListTopicSnapshotsResponse;
@@ -137,6 +139,8 @@ public class PublisherStubSettings extends StubSettings {
private final UnaryCallSettings getIamPolicySettings;
private final UnaryCallSettings
testIamPermissionsSettings;
+ private final UnaryCallSettings
+ detachSubscriptionSettings;
/** Returns the object with the settings used for calls to createTopic. */
public UnaryCallSettings createTopicSettings() {
@@ -201,6 +205,12 @@ public UnaryCallSettings getIamPolicySettings() {
return testIamPermissionsSettings;
}
+ /** Returns the object with the settings used for calls to detachSubscription. */
+ public UnaryCallSettings
+ detachSubscriptionSettings() {
+ return detachSubscriptionSettings;
+ }
+
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public PublisherStub createStub() throws IOException {
if (getTransportChannelProvider()
@@ -280,6 +290,7 @@ protected PublisherStubSettings(Builder settingsBuilder) throws IOException {
setIamPolicySettings = settingsBuilder.setIamPolicySettings().build();
getIamPolicySettings = settingsBuilder.getIamPolicySettings().build();
testIamPermissionsSettings = settingsBuilder.testIamPermissionsSettings().build();
+ detachSubscriptionSettings = settingsBuilder.detachSubscriptionSettings().build();
}
private static final PagedListDescriptor
@@ -551,6 +562,8 @@ public static class Builder extends StubSettings.Builder getIamPolicySettings;
private final UnaryCallSettings.Builder
testIamPermissionsSettings;
+ private final UnaryCallSettings.Builder
+ detachSubscriptionSettings;
private static final ImmutableMap>
RETRYABLE_CODE_DEFINITIONS;
@@ -563,6 +576,8 @@ public static class Builder extends StubSettings.BuildernewArrayList(
StatusCode.Code.ABORTED, StatusCode.Code.UNAVAILABLE, StatusCode.Code.UNKNOWN)));
+ definitions.put(
+ "non_idempotent2", ImmutableSet.copyOf(Lists.newArrayList()));
definitions.put(
"non_idempotent",
ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE)));
@@ -648,6 +663,8 @@ protected Builder(ClientContext clientContext) {
testIamPermissionsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+ detachSubscriptionSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+
unaryMethodSettingsBuilders =
ImmutableList.>of(
createTopicSettings,
@@ -660,7 +677,8 @@ protected Builder(ClientContext clientContext) {
deleteTopicSettings,
setIamPolicySettings,
getIamPolicySettings,
- testIamPermissionsSettings);
+ testIamPermissionsSettings,
+ detachSubscriptionSettings);
initDefaults(this);
}
@@ -743,6 +761,11 @@ private static Builder initDefaults(Builder builder) {
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
+ builder
+ .detachSubscriptionSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent2"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
+
return builder;
}
@@ -760,6 +783,7 @@ protected Builder(PublisherStubSettings settings) {
setIamPolicySettings = settings.setIamPolicySettings.toBuilder();
getIamPolicySettings = settings.getIamPolicySettings.toBuilder();
testIamPermissionsSettings = settings.testIamPermissionsSettings.toBuilder();
+ detachSubscriptionSettings = settings.detachSubscriptionSettings.toBuilder();
unaryMethodSettingsBuilders =
ImmutableList.>of(
@@ -773,7 +797,8 @@ protected Builder(PublisherStubSettings settings) {
deleteTopicSettings,
setIamPolicySettings,
getIamPolicySettings,
- testIamPermissionsSettings);
+ testIamPermissionsSettings,
+ detachSubscriptionSettings);
}
// NEXT_MAJOR_VER: remove 'throws Exception'
@@ -855,6 +880,12 @@ public UnaryCallSettings.Builder getIamPolicySettin
return testIamPermissionsSettings;
}
+ /** Returns the builder for the settings used for calls to detachSubscription. */
+ public UnaryCallSettings.Builder
+ detachSubscriptionSettings() {
+ return detachSubscriptionSettings;
+ }
+
@Override
public PublisherStubSettings build() throws IOException {
return new PublisherStubSettings(this);
diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockPublisherImpl.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockPublisherImpl.java
index 0d49c4288..420a757ad 100644
--- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockPublisherImpl.java
+++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockPublisherImpl.java
@@ -19,6 +19,8 @@
import com.google.protobuf.AbstractMessage;
import com.google.protobuf.Empty;
import com.google.pubsub.v1.DeleteTopicRequest;
+import com.google.pubsub.v1.DetachSubscriptionRequest;
+import com.google.pubsub.v1.DetachSubscriptionResponse;
import com.google.pubsub.v1.GetTopicRequest;
import com.google.pubsub.v1.ListTopicSnapshotsRequest;
import com.google.pubsub.v1.ListTopicSnapshotsResponse;
@@ -185,4 +187,20 @@ public void deleteTopic(DeleteTopicRequest request, StreamObserver respon
responseObserver.onError(new IllegalArgumentException("Unrecognized response type"));
}
}
+
+ @Override
+ public void detachSubscription(
+ DetachSubscriptionRequest request,
+ StreamObserver responseObserver) {
+ Object response = responses.remove();
+ if (response instanceof DetachSubscriptionResponse) {
+ requests.add(request);
+ responseObserver.onNext((DetachSubscriptionResponse) response);
+ responseObserver.onCompleted();
+ } else if (response instanceof Exception) {
+ responseObserver.onError((Exception) response);
+ } else {
+ responseObserver.onError(new IllegalArgumentException("Unrecognized response type"));
+ }
+ }
}
diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/TopicAdminClientTest.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/TopicAdminClientTest.java
index 43510c154..3bc0c77a3 100644
--- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/TopicAdminClientTest.java
+++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/TopicAdminClientTest.java
@@ -38,6 +38,8 @@
import com.google.protobuf.Empty;
import com.google.protobuf.FieldMask;
import com.google.pubsub.v1.DeleteTopicRequest;
+import com.google.pubsub.v1.DetachSubscriptionRequest;
+import com.google.pubsub.v1.DetachSubscriptionResponse;
import com.google.pubsub.v1.GetTopicRequest;
import com.google.pubsub.v1.ListTopicSnapshotsRequest;
import com.google.pubsub.v1.ListTopicSnapshotsResponse;
@@ -622,4 +624,46 @@ public void testIamPermissionsExceptionTest() throws Exception {
// Expected exception
}
}
+
+ @Test
+ @SuppressWarnings("all")
+ public void detachSubscriptionTest() {
+ DetachSubscriptionResponse expectedResponse = DetachSubscriptionResponse.newBuilder().build();
+ mockPublisher.addResponse(expectedResponse);
+
+ TopicName subscription = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
+ DetachSubscriptionRequest request =
+ DetachSubscriptionRequest.newBuilder().setSubscription(subscription.toString()).build();
+
+ DetachSubscriptionResponse actualResponse = client.detachSubscription(request);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockPublisher.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ DetachSubscriptionRequest actualRequest = (DetachSubscriptionRequest) actualRequests.get(0);
+
+ Assert.assertEquals(subscription, TopicName.parse(actualRequest.getSubscription()));
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ @SuppressWarnings("all")
+ public void detachSubscriptionExceptionTest() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
+ mockPublisher.addException(exception);
+
+ try {
+ TopicName subscription = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
+ DetachSubscriptionRequest request =
+ DetachSubscriptionRequest.newBuilder().setSubscription(subscription.toString()).build();
+
+ client.detachSubscription(request);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception
+ }
+ }
}
diff --git a/grpc-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PublisherGrpc.java b/grpc-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PublisherGrpc.java
index a4df9a4bf..8ddccd07f 100644
--- a/grpc-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PublisherGrpc.java
+++ b/grpc-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PublisherGrpc.java
@@ -369,6 +369,51 @@ private PublisherGrpc() {}
return getDeleteTopicMethod;
}
+ private static volatile io.grpc.MethodDescriptor<
+ com.google.pubsub.v1.DetachSubscriptionRequest,
+ com.google.pubsub.v1.DetachSubscriptionResponse>
+ getDetachSubscriptionMethod;
+
+ @io.grpc.stub.annotations.RpcMethod(
+ fullMethodName = SERVICE_NAME + '/' + "DetachSubscription",
+ requestType = com.google.pubsub.v1.DetachSubscriptionRequest.class,
+ responseType = com.google.pubsub.v1.DetachSubscriptionResponse.class,
+ methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
+ public static io.grpc.MethodDescriptor<
+ com.google.pubsub.v1.DetachSubscriptionRequest,
+ com.google.pubsub.v1.DetachSubscriptionResponse>
+ getDetachSubscriptionMethod() {
+ io.grpc.MethodDescriptor<
+ com.google.pubsub.v1.DetachSubscriptionRequest,
+ com.google.pubsub.v1.DetachSubscriptionResponse>
+ getDetachSubscriptionMethod;
+ if ((getDetachSubscriptionMethod = PublisherGrpc.getDetachSubscriptionMethod) == null) {
+ synchronized (PublisherGrpc.class) {
+ if ((getDetachSubscriptionMethod = PublisherGrpc.getDetachSubscriptionMethod) == null) {
+ PublisherGrpc.getDetachSubscriptionMethod =
+ getDetachSubscriptionMethod =
+ io.grpc.MethodDescriptor
+ .
+ newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName(generateFullMethodName(SERVICE_NAME, "DetachSubscription"))
+ .setSampledToLocalTracing(true)
+ .setRequestMarshaller(
+ io.grpc.protobuf.ProtoUtils.marshaller(
+ com.google.pubsub.v1.DetachSubscriptionRequest.getDefaultInstance()))
+ .setResponseMarshaller(
+ io.grpc.protobuf.ProtoUtils.marshaller(
+ com.google.pubsub.v1.DetachSubscriptionResponse.getDefaultInstance()))
+ .setSchemaDescriptor(
+ new PublisherMethodDescriptorSupplier("DetachSubscription"))
+ .build();
+ }
+ }
+ }
+ return getDetachSubscriptionMethod;
+ }
+
/** Creates a new async stub that supports all call types for the service */
public static PublisherStub newStub(io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory factory =
@@ -492,7 +537,7 @@ public void listTopics(
*
*
*
- * Lists the names of the subscriptions on this topic.
+ * Lists the names of the attached subscriptions on this topic.
*
*/
public void listTopicSubscriptions(
@@ -538,6 +583,23 @@ public void deleteTopic(
asyncUnimplementedUnaryCall(getDeleteTopicMethod(), responseObserver);
}
+ /**
+ *
+ *
+ *
+ * Detaches a subscription from this topic. All messages retained in the
+ * subscription are dropped. Subsequent `Pull` and `StreamingPull` requests
+ * will return FAILED_PRECONDITION. If the subscription is a push
+ * subscription, pushes to the endpoint will stop.
+ *
+ */
+ public void detachSubscription(
+ com.google.pubsub.v1.DetachSubscriptionRequest request,
+ io.grpc.stub.StreamObserver
+ responseObserver) {
+ asyncUnimplementedUnaryCall(getDetachSubscriptionMethod(), responseObserver);
+ }
+
@java.lang.Override
public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
@@ -590,6 +652,13 @@ public final io.grpc.ServerServiceDefinition bindService() {
new MethodHandlers<
com.google.pubsub.v1.DeleteTopicRequest, com.google.protobuf.Empty>(
this, METHODID_DELETE_TOPIC)))
+ .addMethod(
+ getDetachSubscriptionMethod(),
+ asyncUnaryCall(
+ new MethodHandlers<
+ com.google.pubsub.v1.DetachSubscriptionRequest,
+ com.google.pubsub.v1.DetachSubscriptionResponse>(
+ this, METHODID_DETACH_SUBSCRIPTION)))
.build();
}
}
@@ -694,7 +763,7 @@ public void listTopics(
*
*
*
- * Lists the names of the subscriptions on this topic.
+ * Lists the names of the attached subscriptions on this topic.
*
*/
public void listTopicSubscriptions(
@@ -748,6 +817,26 @@ public void deleteTopic(
request,
responseObserver);
}
+
+ /**
+ *
+ *
+ *
+ * Detaches a subscription from this topic. All messages retained in the
+ * subscription are dropped. Subsequent `Pull` and `StreamingPull` requests
+ * will return FAILED_PRECONDITION. If the subscription is a push
+ * subscription, pushes to the endpoint will stop.
+ *
+ */
+ public void detachSubscription(
+ com.google.pubsub.v1.DetachSubscriptionRequest request,
+ io.grpc.stub.StreamObserver
+ responseObserver) {
+ asyncUnaryCall(
+ getChannel().newCall(getDetachSubscriptionMethod(), getCallOptions()),
+ request,
+ responseObserver);
+ }
}
/**
@@ -835,7 +924,7 @@ public com.google.pubsub.v1.ListTopicsResponse listTopics(
*
*
*
- * Lists the names of the subscriptions on this topic.
+ * Lists the names of the attached subscriptions on this topic.
*
*/
public com.google.pubsub.v1.ListTopicSubscriptionsResponse listTopicSubscriptions(
@@ -876,6 +965,22 @@ public com.google.pubsub.v1.ListTopicSnapshotsResponse listTopicSnapshots(
public com.google.protobuf.Empty deleteTopic(com.google.pubsub.v1.DeleteTopicRequest request) {
return blockingUnaryCall(getChannel(), getDeleteTopicMethod(), getCallOptions(), request);
}
+
+ /**
+ *
+ *
+ *
+ * Detaches a subscription from this topic. All messages retained in the
+ * subscription are dropped. Subsequent `Pull` and `StreamingPull` requests
+ * will return FAILED_PRECONDITION. If the subscription is a push
+ * subscription, pushes to the endpoint will stop.
+ *
+ */
+ public com.google.pubsub.v1.DetachSubscriptionResponse detachSubscription(
+ com.google.pubsub.v1.DetachSubscriptionRequest request) {
+ return blockingUnaryCall(
+ getChannel(), getDetachSubscriptionMethod(), getCallOptions(), request);
+ }
}
/**
@@ -969,7 +1074,7 @@ public com.google.common.util.concurrent.ListenableFuture
- * Lists the names of the subscriptions on this topic.
+ * Lists the names of the attached subscriptions on this topic.
*
*/
public com.google.common.util.concurrent.ListenableFuture<
@@ -1014,6 +1119,23 @@ public com.google.common.util.concurrent.ListenableFuture
+ * Detaches a subscription from this topic. All messages retained in the
+ * subscription are dropped. Subsequent `Pull` and `StreamingPull` requests
+ * will return FAILED_PRECONDITION. If the subscription is a push
+ * subscription, pushes to the endpoint will stop.
+ *
+ */
+ public com.google.common.util.concurrent.ListenableFuture<
+ com.google.pubsub.v1.DetachSubscriptionResponse>
+ detachSubscription(com.google.pubsub.v1.DetachSubscriptionRequest request) {
+ return futureUnaryCall(
+ getChannel().newCall(getDetachSubscriptionMethod(), getCallOptions()), request);
+ }
}
private static final int METHODID_CREATE_TOPIC = 0;
@@ -1024,6 +1146,7 @@ public com.google.common.util.concurrent.ListenableFuture
implements io.grpc.stub.ServerCalls.UnaryMethod,
@@ -1085,6 +1208,12 @@ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserv
(com.google.pubsub.v1.DeleteTopicRequest) request,
(io.grpc.stub.StreamObserver