Copied from comments in #910
Currently, when pulling messages via a subscription, I'd write:
received = subscription.pull()
for ack_id, message in received:
print ack_id
print message['attr1']
print message.data # ?
print message.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()
for message in messages:
print message.get_ack_id() # ReceivedMessage.ackId (string)
print message['attr1'] # PubsubMessage.attributes (dict)
print message.get_data() # PubsubMessage.data (bytes)
print message.get_id() # corresponds to PubsubMessage.messageId (string)