aws.greengrass.ipc.pubsub clarification

0

Overview

I started using aws.greengrass.ipc.pubsub for Greengrass components to communicate with each other (i.e. 1 component publishes and 1 component subscribes within a single Greengrass core device) and have a few questions.

Questions

  1. Do I need any AWS-provided components to leverage "pubsub"? Or is pubsub built-in with Greengrass V2 (i.e. it's part of the Nucleus or something)? For instance, I am a bit confused about whether I need to add a component like aws.greengrass.clientdevices.mqtt.Bridge to my deployments for pubsub rules to work. I did add this, but am not sure if it was necessary and haven't tried without yet.
  2. Generally speaking, what underlying transport mechanism does aws.greengrass.ipc.pubsub use? When using it, the implementation seems somewhat memory and CPU intensive compared to an MQTT broker like mosquitto. For instance, I have observed a couple java "Out of Memory" errors and needed to restart the Greengrass Nucleus when sending bursts (5-10 messages, ~8 MB each) through the pubsub topics.
  3. This may be answered with question #2, but I assume there is no way to use off-the-shelf tools (like mosquitto_pub) to connect and send messages to the pubsub topics. Communication can only be done from properly "registered" Greengrass components and SDK calls. Is that correct?
ttnickb
已提问 8 个月前280 查看次数
1 回答
1
已接受的回答
  1. Pubsub is part of Nucleus. The documentation always tells you what requirements there are, if any: https://docs.aws.amazon.com/greengrass/v2/developerguide/ipc-publish-subscribe.html. MQTT bridge component is only useful when you have client devices connecting to a local Greengrass broker.
  2. Pubsub is implemented on top of eventstreams in C, you can see the implementation is opensource: https://github.com/aws/aws-iot-device-sdk-java-v2. If you are running out of memory then something is pretty wrong. Did you configure Greengrass Nucleus with a maximum java heap size? 8MB is generally very large for messages, it can certainly work if you have enough memory free on the device and allocated to Greengrass's Java, but I'd recommend you do not do bulk data transfer using pubsub. You may instead use pubsub to communicate enough information to then setup a high speed direct transfer mechanism between your components. eg: gRPC, memory mapped files, etc.
  3. Greengrass IPC communication requires authentication and authorization, no external component can connect to Greengrass. The Greengrass local CLI supports publishing and subscribing and the Local Debug Console also supports this.
AWS
专家
已回答 8 个月前
profile pictureAWS
专家
已审核 8 个月前
profile pictureAWS
专家
Greg_B
已审核 8 个月前
  • Thanks so much for the quick response and links!

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则