aws.greengrass.ipc.pubsub clarification



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.


  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?
asked 10 months ago325 views
1 Answer
Accepted Answer
  1. Pubsub is part of Nucleus. The documentation always tells you what requirements there are, if any: 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: 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.
answered 10 months ago
profile pictureAWS
reviewed 10 months ago
profile pictureAWS
reviewed 10 months ago
  • Thanks so much for the quick response and links!

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions