.addAllAckIds(ackIds) .setSubscription(getSubscriptionName(context)) .build(); subscriber.acknowledgeCallable().call(acknowledgeRequest);
.setSubscription(subscriptionName) .addAllAckIds(ackIds) .build();
deliveredAckIds.clear(); ListenableFuture<Empty> response = subscriber.ackMessages(requestBuilder.build()); Futures.addCallback( response,
private ApiFuture<Empty> ack(String subscriptionName, Collection<String> ackIds) { AcknowledgeRequest acknowledgeRequest = AcknowledgeRequest.newBuilder() .addAllAckIds(ackIds) .setSubscription(subscriptionName) .build(); return this.subscriberStub.acknowledgeCallable().futureCall(acknowledgeRequest); }
@Override public void acknowledge(SubscriptionPath subscription, List<String> ackIds) throws IOException { AcknowledgeRequest request = AcknowledgeRequest.newBuilder() .setSubscription(subscription.getPath()) .addAllAckIds(ackIds) .build(); subscriberStub().acknowledge(request); // ignore Empty result. }
private ApiFuture<Empty> ack(String subscriptionName, Collection<String> ackIds) { AcknowledgeRequest acknowledgeRequest = AcknowledgeRequest.newBuilder() .addAllAckIds(ackIds) .setSubscription(subscriptionName) .build(); return this.subscriberStub.acknowledgeCallable().futureCall(acknowledgeRequest); }
.setSubscription(subscription) .addAllAckIds(idChunk) .build()); ApiFutures.addCallback(future, loggingCallback);
.setSubscription(subscription == null ? null : subscription.toString()) .addAllAckIds(ackIds) .build(); acknowledge(request);
/** * Acknowledges the messages associated with the `ack_ids` in the `AcknowledgeRequest`. The * Pub/Sub system can remove the relevant messages from the subscription. * * <p>Acknowledging a message whose ack deadline has expired may succeed, but such a message may * be redelivered later. Acknowledging a message more than once will not result in an error. * * <p>Sample code: * * <pre><code> * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) { * ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); * List<String> ackIds = new ArrayList<>(); * subscriptionAdminClient.acknowledge(subscription.toString(), ackIds); * } * </code></pre> * * @param subscription The subscription whose message is being acknowledged. Format is * `projects/{project}/subscriptions/{sub}`. * @param ackIds The acknowledgment ID for the messages being acknowledged that was returned by * the Pub/Sub system in the `Pull` response. Must not be empty. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ /* package-private */ final void acknowledge(String subscription, List<String> ackIds) { AcknowledgeRequest request = AcknowledgeRequest.newBuilder().setSubscription(subscription).addAllAckIds(ackIds).build(); acknowledge(request); }