Acknowledging a message in Pub/Sub means that you are done with it, and it will not be delivered
to this subscription again. You should avoid acknowledging messages until you have finished
processing them, so that in the event of a failure, you receive the message again.
If exactly-once delivery is enabled on the subscription, the future returned by the ack/nack
methods track the state of acknowledgement operation by the server. If the future completes
successfully, the message is guaranteed NOT to be re-delivered. Otherwise, the future will
contain an exception with more details about the failure and the message may be re-delivered.
If exactly-once delivery is NOT enabled on the subscription, the future returns immediately
with an AckResponse.SUCCESS. Because re-deliveries are possible, you should ensure that your
processing code is idempotent, as you may receive any given message more than once.
Methods
ack()
publicabstractApiFuture<AckResponse>ack()
Acknowledges that the message has been successfully processed. The service will not send the
message again.
A future representing the server response is returned
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-16 UTC."],[],[],null,["# Interface AckReplyConsumerWithResponse (1.141.2)\n\nVersion latestkeyboard_arrow_down\n\n- [1.141.2 (latest)](/java/docs/reference/google-cloud-pubsub/latest/com.google.cloud.pubsub.v1.AckReplyConsumerWithResponse)\n- [1.141.1](/java/docs/reference/google-cloud-pubsub/1.141.1/com.google.cloud.pubsub.v1.AckReplyConsumerWithResponse)\n- [1.140.2](/java/docs/reference/google-cloud-pubsub/1.140.2/com.google.cloud.pubsub.v1.AckReplyConsumerWithResponse)\n- [1.139.4](/java/docs/reference/google-cloud-pubsub/1.139.4/com.google.cloud.pubsub.v1.AckReplyConsumerWithResponse)\n- [1.138.0](/java/docs/reference/google-cloud-pubsub/1.138.0/com.google.cloud.pubsub.v1.AckReplyConsumerWithResponse)\n- [1.137.1](/java/docs/reference/google-cloud-pubsub/1.137.1/com.google.cloud.pubsub.v1.AckReplyConsumerWithResponse)\n- [1.136.1](/java/docs/reference/google-cloud-pubsub/1.136.1/com.google.cloud.pubsub.v1.AckReplyConsumerWithResponse)\n- [1.135.0](/java/docs/reference/google-cloud-pubsub/1.135.0/com.google.cloud.pubsub.v1.AckReplyConsumerWithResponse)\n- [1.134.2](/java/docs/reference/google-cloud-pubsub/1.134.2/com.google.cloud.pubsub.v1.AckReplyConsumerWithResponse)\n- [1.133.1](/java/docs/reference/google-cloud-pubsub/1.133.1/com.google.cloud.pubsub.v1.AckReplyConsumerWithResponse)\n- [1.132.2](/java/docs/reference/google-cloud-pubsub/1.132.2/com.google.cloud.pubsub.v1.AckReplyConsumerWithResponse)\n- [1.131.0](/java/docs/reference/google-cloud-pubsub/1.131.0/com.google.cloud.pubsub.v1.AckReplyConsumerWithResponse)\n- [1.130.0](/java/docs/reference/google-cloud-pubsub/1.130.0/com.google.cloud.pubsub.v1.AckReplyConsumerWithResponse)\n- [1.129.6](/java/docs/reference/google-cloud-pubsub/1.129.6/com.google.cloud.pubsub.v1.AckReplyConsumerWithResponse)\n- [1.127.3](/java/docs/reference/google-cloud-pubsub/1.127.3/com.google.cloud.pubsub.v1.AckReplyConsumerWithResponse)\n- [1.126.6](/java/docs/reference/google-cloud-pubsub/1.126.6/com.google.cloud.pubsub.v1.AckReplyConsumerWithResponse)\n- [1.125.13](/java/docs/reference/google-cloud-pubsub/1.125.13/com.google.cloud.pubsub.v1.AckReplyConsumerWithResponse)\n- [1.123.18](/java/docs/reference/google-cloud-pubsub/1.123.18/com.google.cloud.pubsub.v1.AckReplyConsumerWithResponse)\n- [1.122.2](/java/docs/reference/google-cloud-pubsub/1.122.2/com.google.cloud.pubsub.v1.AckReplyConsumerWithResponse)\n- [1.121.1](/java/docs/reference/google-cloud-pubsub/1.121.1/com.google.cloud.pubsub.v1.AckReplyConsumerWithResponse)\n- [1.120.24](/java/docs/reference/google-cloud-pubsub/1.120.24/com.google.cloud.pubsub.v1.AckReplyConsumerWithResponse)\n- [1.119.1](/java/docs/reference/google-cloud-pubsub/1.119.1/com.google.cloud.pubsub.v1.AckReplyConsumerWithResponse)\n- [1.118.0](/java/docs/reference/google-cloud-pubsub/1.118.0/com.google.cloud.pubsub.v1.AckReplyConsumerWithResponse)\n- [1.117.0](/java/docs/reference/google-cloud-pubsub/1.117.0/com.google.cloud.pubsub.v1.AckReplyConsumerWithResponse)\n- [1.116.4](/java/docs/reference/google-cloud-pubsub/1.116.4/com.google.cloud.pubsub.v1.AckReplyConsumerWithResponse)\n- [1.115.5](/java/docs/reference/google-cloud-pubsub/1.115.5/com.google.cloud.pubsub.v1.AckReplyConsumerWithResponse) \n| **Beta**\n|\n|\n| This library is covered by the [Pre-GA Offerings Terms](/terms/service-terms#1)\n| of the Terms of Service. Pre-GA libraries might have limited support,\n| and changes to pre-GA libraries might not be compatible with other pre-GA versions.\n| For more information, see the\n[launch stage descriptions](/products#product-launch-stages). \n\n public interface AckReplyConsumerWithResponse\n\nAcknowledging a message in Pub/Sub means that you are done with it, and it will not be delivered\nto this subscription again. You should avoid acknowledging messages until you have *finished*\nprocessing them, so that in the event of a failure, you receive the message again.\n\nIf exactly-once delivery is enabled on the subscription, the future returned by the ack/nack\nmethods track the state of acknowledgement operation by the server. If the future completes\nsuccessfully, the message is guaranteed NOT to be re-delivered. Otherwise, the future will\ncontain an exception with more details about the failure and the message may be re-delivered.\n\nIf exactly-once delivery is NOT enabled on the subscription, the future returns immediately\nwith an AckResponse.SUCCESS. Because re-deliveries are possible, you should ensure that your\nprocessing code is idempotent, as you may receive any given message more than once.\n\nMethods\n-------\n\n### ack()\n\n public abstract ApiFuture\u003cAckResponse\u003e ack()\n\nAcknowledges that the message has been successfully processed. The service will not send the\nmessage again.\n\nA future representing the server response is returned\n\n### nack()\n\n public abstract ApiFuture\u003cAckResponse\u003e nack()\n\nSignals that the message has not been successfully processed. The service should resend the\nmessage.\n\nA future representing the server response is returned"]]