pubsub.TopicBuilder class

The Google Cloud Pub/Sub topic builder.

Access via functions.pubsub.topic().

Signature:

export declare class TopicBuilder 

Constructors

Constructor Modifiers Description
(constructor)(triggerResource, options) Constructs a new instance of the TopicBuilder class

Methods

Method Modifiers Description
onPublish(handler) Event handler that fires every time a Cloud Pub/Sub message is published.

pubsub.TopicBuilder.(constructor)

Constructs a new instance of the TopicBuilder class

Signature:

constructor(triggerResource: () => string, options: DeploymentOptions);

Parameters

Parameter Type Description
triggerResource () => string
options DeploymentOptions

pubsub.TopicBuilder.onPublish()

Event handler that fires every time a Cloud Pub/Sub message is published.

Signature:

onPublish(handler: (message: Message, context: EventContext) => PromiseLike<any> | any): CloudFunction<Message>;

Parameters

Parameter Type Description
handler (message: Message, context: EventContext) => PromiseLike<any> | any Event handler that runs every time a Cloud Pub/Sub message is published.

Returns:

CloudFunction<Message>

A function that you can export and deploy.