pubsub namespace

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:

export declare function onMessagePublished<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:

export declare function onMessagePublished<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>>>