Skip to content

subscription.pull() should return a list of objects rather than tuples. #913

Description

@jgeewax

Copied from comments in #910

Currently, when pulling messages via a subscription, I'd write:

received=subscription.pull()
forack_id, messageinreceived:
printack_idprintmessage['attr1']
printmessage.data# ?printmessage.id# ?

I think it'd be better to have the return value be an iterable of some more complex object (maybe a pubsub.Message?):

messages=subscription.pull()
formessageinmessages:
printmessage.get_ack_id() # ReceivedMessage.ackId (string)printmessage['attr1'] # PubsubMessage.attributes (dict)printmessage.get_data() # PubsubMessage.data (bytes)printmessage.get_id() # corresponds to PubsubMessage.messageId (string)

Metadata

Metadata

Assignees

Labels

api: pubsubIssues related to the Pub/Sub API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions