功能
功能 | 描述 |
---|---|
onMessagePublished(主题,处理程序) | 处理发布到 Pub/Sub 主题的消息。 |
onMessagePublished(选项,处理程序) | 处理发布到 Pub/Sub 主题的消息。 |
课程
班级 | 描述 |
---|---|
信息 | 表示 Google Cloud Pub/Sub 消息的接口。 |
接口
界面 | 描述 |
---|---|
消息发布数据 | 在 Pub/Sub 发布订阅中发布的接口。 |
发布订阅选项 | PubSubOptions 扩展了 EventHandlerOptions 但必须包含主题。 |
pubsub.onMessagePublished()
处理发布到 Pub/Sub 主题的消息。
签名:
export declare function onMessagePublished<T = any>(topic: string, handler: (event: CloudEvent<MessagePublishedData<T>>) => any | Promise<any>): CloudFunction<CloudEvent<MessagePublishedData<T>>>;
参数
范围 | 类型 | 描述 |
---|---|---|
话题 | 细绳 | 用于监视消息事件的 Pub/Sub 主题。 |
处理程序 | (事件:云事件<消息发布数据<T>>) => 任意 |承诺<任何> | 每次发布 Cloud Pub/Sub 消息时运行 |
返回:
pubsub.onMessagePublished()
处理发布到 Pub/Sub 主题的消息。
签名:
export declare function onMessagePublished<T = any>(options: PubSubOptions, handler: (event: CloudEvent<MessagePublishedData<T>>) => any | Promise<any>): CloudFunction<CloudEvent<MessagePublishedData<T>>>;
参数
范围 | 类型 | 描述 |
---|---|---|
选项 | 发布订阅选项 | 包含事件信息(主题)的选项 |
处理程序 | (事件:云事件<消息发布数据<T>>) => 任意 |承诺<任何> | 每次发布 Cloud Pub/Sub 消息时运行 |
返回: