Skip to content

PubSub: Inconsistent documentation on received message types #7128

@enugentdt

Description

@enugentdt

Issue Description

At various points in receiving messages through PubSub, they will come in as different types, which has no documentation on what types occur when. The majority of messages are:

<class 'google.cloud.pubsub_v1.subscriber.message.Message'>

However, I see some:

<class 'google.cloud.pubsub_v1.types.ReceivedMessage'>

Those aren't much of a problem, I just have to do message = message.message. Not great, because I have to detect for those types, but nothing bad really.

Lastly, I see a couple with the name PubsubMessage. They appear to be of the first type above, but they don't have any ack(), nack(), etc. methods. They seem to be messages that the client would create, but not receive? There doesn't appear to be any documentation on when these different message types would occur.

Environment details

Using:
PubSub on OS X Mojave
Python 3.6
google-cloud-pubsub==0.39.1

Steps to reproduce

Loosely, the issue occurs on receiving messages. I can't track it down to anything in particular, because I can't debug the messages themselves.

Stack trace

Traceback (most recent call last):
  File "logger.py", line 56, in <module>
    pubsub.run(process_message)
  File "<projectdir>/pubsub.py", line 68, in run
    pull()
  File "<projectdir>/pubsub.py", line 80, in pull
    pubsub_callback(message)
  File "<projectdir>/pubsub.py", line 57, in pubsub_callback
    messageobj.ack()
AttributeError: 'PubsubMessage' object has no attribute 'ack'

Thanks in advance for the help!

Metadata

Metadata

Assignees

Labels

api: pubsubIssues related to the Pub/Sub API.triaged for GAtype: docsImprovement to the documentation for an API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions