use of com.google.pubsub.v1.ModifyAckDeadlineRequest in project beam by apache.
the class PubsubGrpcClient method modifyAckDeadline.
@Override
public void modifyAckDeadline(SubscriptionPath subscription, List<String> ackIds, int deadlineSeconds) throws IOException {
ModifyAckDeadlineRequest request = ModifyAckDeadlineRequest.newBuilder().setSubscription(subscription.getPath()).addAllAckIds(ackIds).setAckDeadlineSeconds(deadlineSeconds).build();
// ignore Empty result.
subscriberStub().modifyAckDeadline(request);
}
use of com.google.pubsub.v1.ModifyAckDeadlineRequest in project google-cloud-java by GoogleCloudPlatform.
the class SubscriptionAdminClient method modifyAckDeadline.
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Modifies the ack deadline for a specific message. This method is useful to indicate that more
* time is needed to process a message by the subscriber, or to make the message available for
* redelivery if the processing was interrupted. Note that this does not modify the
* subscription-level `ackDeadlineSeconds` used for subsequent messages.
*
* <p>Sample code:
*
* <pre><code>
* try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
* SubscriptionName subscription = SubscriptionName.create("[PROJECT]", "[SUBSCRIPTION]");
* List<String> ackIds = new ArrayList<>();
* int ackDeadlineSeconds = 0;
* subscriptionAdminClient.modifyAckDeadline(subscription, ackIds, ackDeadlineSeconds);
* }
* </code></pre>
*
* @param subscription The name of the subscription. Format is
* `projects/{project}/subscriptions/{sub}`.
* @param ackIds List of acknowledgment IDs.
* @param ackDeadlineSeconds The new ack deadline with respect to the time this request was sent
* to the Pub/Sub system. For example, if the value is 10, the new ack deadline will expire 10
* seconds after the `ModifyAckDeadline` call was made. Specifying zero may immediately make
* the message available for another pull request. The minimum deadline you can specify is 0
* seconds. The maximum deadline you can specify is 600 seconds (10 minutes).
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
/* package-private */
final void modifyAckDeadline(SubscriptionName subscription, List<String> ackIds, int ackDeadlineSeconds) {
ModifyAckDeadlineRequest request = ModifyAckDeadlineRequest.newBuilder().setSubscriptionWithSubscriptionName(subscription).addAllAckIds(ackIds).setAckDeadlineSeconds(ackDeadlineSeconds).build();
modifyAckDeadline(request);
}
use of com.google.pubsub.v1.ModifyAckDeadlineRequest in project google-cloud-java by GoogleCloudPlatform.
the class SubscriptionAdminClientTest method modifyAckDeadlineTest.
@Test
@SuppressWarnings("all")
public void modifyAckDeadlineTest() {
Empty expectedResponse = Empty.newBuilder().build();
mockSubscriber.addResponse(expectedResponse);
SubscriptionName subscription = SubscriptionName.create("[PROJECT]", "[SUBSCRIPTION]");
List<String> ackIds = new ArrayList<>();
int ackDeadlineSeconds = 2135351438;
client.modifyAckDeadline(subscription, ackIds, ackDeadlineSeconds);
List<GeneratedMessageV3> actualRequests = mockSubscriber.getRequests();
Assert.assertEquals(1, actualRequests.size());
ModifyAckDeadlineRequest actualRequest = (ModifyAckDeadlineRequest) actualRequests.get(0);
Assert.assertEquals(subscription, actualRequest.getSubscriptionAsSubscriptionName());
Assert.assertEquals(ackIds, actualRequest.getAckIdsList());
Assert.assertEquals(ackDeadlineSeconds, actualRequest.getAckDeadlineSeconds());
}
Aggregations