pubsub.TopicBuilder class

The Google Cloud Pub/Sub topic builder.

Access viafunctions.pubsub.topic().

Signature:

exportdeclareclassTopicBuilder

Constructors

ConstructorModifiersDescription
(constructor)(triggerResource, options)Constructs a new instance of theTopicBuilder class

Methods

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

pubsub.TopicBuilder.(constructor)

Constructs a new instance of theTopicBuilder class

Signature:

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

Parameters

ParameterTypeDescription
triggerResource() => string
optionsDeploymentOptions

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

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

Returns:

CloudFunction<Message>

A function that you can export and deploy.

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-24 UTC.