[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-11-06 UTC."],[],[],null,["# firebase_functions.pubsub_fn module\n\nFunctions to handle events from Google Cloud Pub/Sub.\n\nClasses\n-------\n\n| ### Message *class* firebase_functions.pubsub_fn.Message(*message_id: str* , *publish_time: str* , *attributes: dict\\[str, str\\]* , *data: str* , *ordering_key: str* ) |\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Bases: Generic\\[T\\] Interface representing a Google Cloud Pub/Sub message. attributes*: dict\\[str, str\\]* : User-defined attributes published with the message, if any. data*: str* : The data payload of this message object as a base64-encoded string. | *property* json*: T \\| None* | |------------------------------| | | message_id*: str* : Autogenerated ID that uniquely identifies this message. ordering_key*: str* : User-defined key used to ensure ordering amongst messages with the same key. publish_time*: str* : Time the message was published. |\n\n| ### MessagePublishedData *class* firebase_functions.pubsub_fn.MessagePublishedData(*message: [Message](#firebase_functions.pubsub_fn.Message \"firebase_functions.pubsub_fn.Message\")\\[T\\]* , *subscription: str* ) |\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Bases: Generic\\[T\\] The interface published in a Pub/Sub publish subscription. 'T' Type representing Message.data's JSON format. message*: [Message](#firebase_functions.pubsub_fn.Message \"firebase_functions.pubsub_fn.Message\")\\[T\\]* : Google Cloud Pub/Sub message. subscription*: str* : A subscription resource. |\n\nFunctions\n---------\n\n| ### on_message_published firebase_functions.pubsub_fn.on_message_published(*\\*\\*kwargs* ) → Callable\\[\\[Callable\\[\\[[CloudEvent](/docs/reference/functions/2nd-gen/python/firebase_functions.core#firebase_functions.core.CloudEvent \"firebase_functions.core.CloudEvent\")\\[[MessagePublishedData](#firebase_functions.pubsub_fn.MessagePublishedData \"firebase_functions.pubsub_fn.MessagePublishedData\")\\[T\\]\\]\\], None\\]\\], Callable\\[\\[[CloudEvent](/docs/reference/functions/2nd-gen/python/firebase_functions.core#firebase_functions.core.CloudEvent \"firebase_functions.core.CloudEvent\")\\[[MessagePublishedData](#firebase_functions.pubsub_fn.MessagePublishedData \"firebase_functions.pubsub_fn.MessagePublishedData\")\\[T\\]\\]\\], None\\]\\] |\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Event handler that triggers on a message being published to a Pub/Sub topic. Example: ``` @on_message_published(topic=\"hello-world\") def example(event: CloudEvent[MessagePublishedData[object]]) -\u003e None: pass ``` Parameters: : **\\*\\*kwargs** (as [firebase_functions.options.PubSubOptions](/docs/reference/functions/2nd-gen/python/firebase_functions.options#firebase_functions.options.PubSubOptions \"firebase_functions.options.PubSubOptions\")) -- Pub/Sub options. Return type: : typing.Callable \\[ \\[ [firebase_functions.core.CloudEvent](/docs/reference/functions/2nd-gen/python/firebase_functions.core#firebase_functions.core.CloudEvent \"firebase_functions.core.CloudEvent\") \\[ [firebase_functions.pubsub_fn.MessagePublishedData](#firebase_functions.pubsub_fn.MessagePublishedData \"firebase_functions.pubsub_fn.MessagePublishedData\") \\[ typing.Any \\] \\] \\], None \\] A function that takes a CloudEvent and returns None. |"]]