pubsub namespace

Functions

FunctionDescription
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

ClassDescription
MessageInterface representing a Google Cloud Pub/Sub message.

Interfaces

InterfaceDescription
MessagePublishedDataThe interface published in a Pub/Sub publish subscription.
PubSubOptionsPubSubOptions 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

ParameterTypeDescription
topicstringThe 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

ParameterTypeDescription
optionsPubSubOptionsOption 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.