pittgoogle.types

Classes defining new types.

PubsubMessageLike(data[, attributes, ...])

Container for an incoming alert.


class pittgoogle.types_.PubsubMessageLike(data: bytes, attributes: dict = NOTHING, message_id: str | None = None, publish_time: datetime | None = None, ordering_key: str | None = None)[source]

Container for an incoming alert.

Do not use this class directly. Use pittgoogle.alert.Alert instead.

Purpose: It is convenient for the Alert class to work with a message as a google.cloud.pubsub_v1.types.PubsubMessage. However, there are many ways to obtain an Alert that do not result in a google.cloud.pubsub_v1.types.PubsubMessage (e.g., an alert packet loaded from disk or an incoming message to a Cloud Functions or Cloud Run module). In those cases, this class is used to create an object with the same attributes as a google.cloud.pubsub_v1.types.PubsubMessage. This object is then assigned to the msg attribute of the Alert.


attributes: dict

Alert attributes. This is custom metadata attached to the Pub/Sub message.

data: bytes

Alert data as bytes. This is also known as the message “payload”.

message_id: str | None

Pub/Sub ID of the published message.

ordering_key: str | None

Pub/Sub ordering key of the published message.

publish_time: datetime | None

Timestamp of the published message.