Skip to content

Pubsub Question: Manual Acknowledgement outside of MessageReceiver #1981

Closed

Description

@autodidacticon

I'm attempting to ingest data from PubSub via Apache Spark. Without getting into details, I would like to acknowledge messages outside of the MessageReceiver interface. I am not seeing any public methods that acknowledge messages outside of the MessageReceiver interface.
https://cloud.google.com/pubsub/docs/pull

I see that a REST endpoint exists here:
https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions/acknowledge

But I am unable to find an accompanying method in the legacy api:
https://developers.google.com/resources/api-libraries/documentation/pubsub/v1/java/latest/

Is there any way to manually acknowledge messages in this (google-cloud) or the the legacy APIs?

Activity

  1. autodidacticon commented on Apr 25, 2017

    @autodidacticon
    Author

    Upon deeper inspection, it doesnt look like this use case is supported within this API. It appears that AckId is not visible within the MessageReceiver or AckReplyConsumer interfaces. Without access to this id it does not appear that acknowledgement outside of the receiveMessage method is possible.

  2. pongad commented on May 1, 2017

    @pongad
    Contributor

    @autodidacticon Currently, MessageReceiver is the only way to receive messages, but it might work for your use case. It is possible to save the PubsubMessage and the AckReplyConsumer somewhere, then call ackReplyConsumer.ack() later, outside of the call to receiveMessage. While you cannot get the message ID, you have a "handle" to it. Does this fit your use case?

  3. self-assigned this
    on May 1, 2017
  4. autodidacticon commented on May 1, 2017

    @autodidacticon
    Author

    @pongad Yes, at a high level that approach would work. I've run into serialization issues on the spark side (for some reason I end up having to serialize the closure of the AckReplyConsumer instance) but that does not seem pertinent here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

api: pubsubIssues related to the Pub/Sub API.type: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions