pubsub namespace Stay organized with collections Save and categorize content based on your preferences.
Functions
| Function | Description |
|---|---|
| onMessagePublished(topic, handler) | Handle a message being published to a Pub/Sub topic. |
| onMessagePublished(options, handler) | Handle a message being published to a Pub/Sub topic. |
Classes
| Class | Description |
|---|---|
| Message | Interface representing a Google Cloud Pub/Sub message. |
Interfaces
| Interface | Description |
|---|---|
| MessagePublishedData | The interface published in a Pub/Sub publish subscription. |
| PubSubOptions | PubSubOptions extend EventHandlerOptions but must include a topic. |
pubsub.onMessagePublished()
Handle a message being published to a Pub/Sub topic.
Signature:
exportdeclarefunctiononMessagePublished<T=any>(topic:string,handler:(event:CloudEvent<MessagePublishedData<T>>)=>any|Promise<any>):CloudFunction<CloudEvent<MessagePublishedData<T>>>;Parameters
| Parameter | Type | Description |
|---|---|---|
| topic | string | The Pub/Sub topic to watch for message events. |
| handler | (event:CloudEvent<MessagePublishedData<T>>) => any | Promise<any> | runs every time a Cloud Pub/Sub message is published |
Returns:
CloudFunction<CloudEvent<MessagePublishedData<T>>>
pubsub.onMessagePublished()
Handle a message being published to a Pub/Sub topic.
Signature:
exportdeclarefunctiononMessagePublished<T=any>(options:PubSubOptions,handler:(event:CloudEvent<MessagePublishedData<T>>)=>any|Promise<any>):CloudFunction<CloudEvent<MessagePublishedData<T>>>;Parameters
| Parameter | Type | Description |
|---|---|---|
| options | PubSubOptions | Option containing information (topic) for event |
| handler | (event:CloudEvent<MessagePublishedData<T>>) => any | Promise<any> | runs every time a Cloud Pub/Sub message is published |
Returns:
CloudFunction<CloudEvent<MessagePublishedData<T>>>
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-04-18 UTC.