Define API Topics.

class, message_id, attributes=None)[source]#

Bases: object

Messages can be published to a topic and received by subscribers.


  • data (bytes) – the payload of the message.
  • message_id (string) – An ID assigned to the message by the API.
  • attributes (dict or None) – Extra metadata associated by the publisher with the message.

Lazily-constructed attribute dictionary.

classmethod from_api_repr(api_repr)[source]#

Factory: construct message from API representation.

Parameters:api_repr (dict or None) – The API representation of the message
Return type:Message
Returns:The message created from the response.

Return server-set timestamp.

Return type:string
Returns:timestamp (in UTC timezone) in RFC 3339 format

Return sortable timestamp from attributes, if passed.

Allows sorting messages in publication order (assuming consistent clocks across all publishers).

Return type:datetime.datetime
Returns:timestamp (in UTC timezone) parsed from RFC 3339 timestamp
Raises:ValueError if timestamp not in attributes, or if it does not match the RFC 3339 format.