pubsub.TopicBuilder class
Stay organized with collections
Save and categorize content based on your preferences.
The Google Cloud Pub/Sub topic builder.
Access via functions.pubsub.topic()
.
Signature:
export declare class TopicBuilder
Constructors
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
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.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-04-24 UTC.
[null,null,["Last updated 2023-04-24 UTC."],[],[],null,["# pubsub.TopicBuilder class\n\nThe Google Cloud Pub/Sub topic builder.\n\nAccess via `functions.pubsub.topic()`.\n\n**Signature:** \n\n export declare class TopicBuilder \n\nConstructors\n------------\n\n| Constructor | Modifiers | Description |\n|----------------------------------------------------------------------------------------------------------------------|-----------|-------------------------------------------------------|\n| [(constructor)(triggerResource, options)](./firebase-functions.pubsub.topicbuilder.md#pubsubtopicbuilderconstructor) | | Constructs a new instance of the `TopicBuilder` class |\n\nMethods\n-------\n\n| Method | Modifiers | Description |\n|-----------------------------------------------------------------------------------------------|-----------|---------------------------------------------------------------------------|\n| [onPublish(handler)](./firebase-functions.pubsub.topicbuilder.md#pubsubtopicbuilderonpublish) | | Event handler that fires every time a Cloud Pub/Sub message is published. |\n\npubsub.TopicBuilder.(constructor)\n---------------------------------\n\nConstructs a new instance of the `TopicBuilder` class\n\n**Signature:** \n\n constructor(triggerResource: () =\u003e string, options: DeploymentOptions);\n\n### Parameters\n\n| Parameter | Type | Description |\n|-----------------|--------------------------------------------------------------------------------------------|-------------|\n| triggerResource | () =\\\u003e string | |\n| options | [DeploymentOptions](./firebase-functions.deploymentoptions.md#deploymentoptions_interface) | |\n\npubsub.TopicBuilder.onPublish()\n-------------------------------\n\nEvent handler that fires every time a Cloud Pub/Sub message is published.\n\n**Signature:** \n\n onPublish(handler: (message: Message, context: EventContext) =\u003e PromiseLike\u003cany\u003e | any): CloudFunction\u003cMessage\u003e;\n\n### Parameters\n\n| Parameter | Type | Description |\n|-----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------|\n| handler | (message: [Message](./firebase-functions.pubsub.message.md#pubsubmessage_class), context: [EventContext](./firebase-functions.eventcontext.md#eventcontext_interface)) =\\\u003e PromiseLike\\\u003cany\\\u003e \\| any | Event handler that runs every time a Cloud Pub/Sub message is published. |\n\n**Returns:**\n\n[CloudFunction](./firebase-functions.cloudfunction.md#cloudfunction_interface)\\\u003c[Message](./firebase-functions.pubsub.message.md#pubsubmessage_class)\\\u003e\n\nA function that you can export and deploy."]]