我正在尝试谷歌物联网和谷歌PubSub。我正在将MQTT消息从设备发送到我所订阅的pubsub队列(我将其称为“服务器”)。在google云控制台中,我更新了设备设置,并在设备中获得了设置消息。
google tutorial中的一切都运行得很好,但我想知道是否有可能以另一种方式设置消息传递:即“服务器”发送消息到设备使用MQTT订阅的pubsub队列。
末尾的模式让我认为只有"config“mqtt队列(/devices/XXXX/config)可以这样使用。
我需要的是从“服务器”到“设备”的一对一通信,恐怕唯一的方法就是使用配置
我有一个Firebase函数,它是由一个消息生成的PubSub。该函数要么使用消息,要么等待稍后使用它。
是否有一种方法可以从这个函数返回,而不承认消息,以便以后会是?
例如,我可以从云函数返回一个吗?如果我读得对,似乎表明这是可能的:
返回non-null functions.CloudFunction containing non-null functions.pubsub.Message A Cloud Function which you can export.
基于官方
我尝试使用"PubSub拉订阅“触发器创建一个云函数。
import base64
def hello_pubsub(event, context):
"""Triggered from a message on a Cloud Pub/Sub topic.
Args:
event (dict): Event payload.
context (google.cloud.functions.Context): Metadata for the event.
"""
我有一个谷歌PubSub Node.js监听器冻结使用拉动的问题。 我使用以下流程: 1. PubSub client is created,
2. Subscription is fetched from the specified topic
3. Listeners are attached to "message" and "error" events. 一开始,它拉取大约500条消息并确认它们,但在那之后它就挂起了,队列中有超过1000条消息。我尝试定期重新启动监听器(removeListener/on),但它只获取很少的消息。重新启动应用程序后,它
在使用pubsub触发函数时,我坚持性能问题。
//this will call on index.ts
export function downloadService() {
// References an existing subscription
const subscription = pubsub.subscription("DOWNLOAD-sub");
// Create an event handler to handle messages
// let messageCount = 0;
const messageHandler = a
我使用的是python标准环境,我想向google pub/sub发布一条消息。然而,谷歌云库似乎没有包含在环境中,至少在没有某种额外配置的情况下是这样的。
from google.cloud import pubsub
ImportError: No module named cloud
这是在已部署的实例上运行的。google给出的使用pub/sub的例子是在灵活的环境中。
我想知道确认PubSub消息(来自推送用户)的正确方式是什么,这是一个Firebase云函数。这是通过返回一个承诺来完成的吗? import * as functions from 'firebase-functions'
import * as admin from 'firebase-admin'
export const listener = functions.pubsub.topic('new_members').onPublish(async (message:any) => {
let data = {
name:
我正在尝试将云函数pubsub订阅转发到一个死信主题,如下所述:
我试过了
$ gcloud pubsub subscriptions update gcf-worker-topic --dead-letter-topic=gcf-worker-dead-letter-topic
并尝试在控制台中修改gcf-worker-topic订阅。两者都给了我相同的错误:
ERROR: (gcloud.pubsub.subscriptions.update) INVALID_ARGUMENT: The supplied AppEngine URL project does not match the s