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 = any>(topic: string, handler: (event: CloudEvent>) => any | Promise): CloudFunction>>;

Parameters

Parameter Type Description
topic string The Pub/Sub topic to watch for message events.
handler (event: CloudEvent<MessagePublishedData>) => any | Promise runs every time a Cloud Pub/Sub message is published

Returns:

CloudFunction<CloudEvent<MessagePublishedData>>

pubsub.onMessagePublished()

Handle a message being published to a Pub/Sub topic.

Signature:

export declare function onMessagePublished = any>(options: PubSubOptions, handler: (event: CloudEvent>) => any | Promise): CloudFunction>>;

Parameters

Parameter Type Description
options PubSubOptions Option containing information (topic) for event
handler (event: CloudEvent<MessagePublishedData>) => any | Promise runs every time a Cloud Pub/Sub message is published

Returns:

CloudFunction<CloudEvent<MessagePublishedData>>