Closed wills721 closed 3 months ago
Nuc version is 2.12.4. Sorry I missed that.
Hi @wills721,
Pubsub and MQTT are different. You cannot use the MQTT test client to verify that local pubsub is working. If you want to use MQTT, you use subscribeToIotCore and publishToIotCore.
Local pubsub is described here: https://docs.aws.amazon.com/greengrass/v2/developerguide/ipc-publish-subscribe.html. MQTT is described here: https://docs.aws.amazon.com/greengrass/v2/developerguide/ipc-iot-core-mqtt.html
Which of these do you really want to do?
For my Publish side I am using Local but its target is IoT core. In this manner events send up to AWS are cached in core device in the event of an Internet outage. This works and is tested. For subscribe, perhaps I have this backwards? GG should subscribe to the MQTT?
If you want to use MQTT, then you need to follow the documentation for MQTT here: https://docs.aws.amazon.com/greengrass/v2/developerguide/ipc-iot-core-mqtt.html.
Your current code is not using MQTT. It is using local pubsub, which is different. Please use subscribeToIotCore and publishToIotCore if you wish to use MQTT.
Yes, I did have it backwards. Thank you!
Describe the bug Using the sample code, I cannot even get the same code to work: https://docs.aws.amazon.com/greengrass/v2/developerguide/interprocess-communication.html
Although I have a question up on AWS post here (https://repost.aws/questions/QU58bI2ot_TiS-hmfED4oetg#ANbju3JtOETGi0drOBFAxqHQ) I am starting to wonder if there is some bug. I have tried several ways to get a subscribe to work on in Python on my greengrass core device but nothing is coming down. I'm using the MQTT test client to test.
My access is here (out of desperation this version splits up the sub and pub) "accessControl": { "aws.greengrass.ipc.pubsub": { "com.thio.coredevice.thio_bp:pubsub:1": { "policyDescription": "Allows access to publish/subscribe to topics.", "operations": [ "aws.greengrass#SubscribeToTopic", "aws.greengrass#PublishToTopic" ], "resources": [ "thio_bin_demo" ] }, "com.thio.coredevice.thio_bp:pubsub:2": { "policyDescription": "Allows access to publish/subscribe to topics.", "operations": [ "aws.greengrass#SubscribeToTopic", "aws.greengrass#PublishToTopic" ], "resources": [ "thio_bin_demo/request" ] } } },
The call below succeeds -- no exception is thrown yet still no messages on the topic: _, operation = ipc_client.subscribe_to_topic(topic=core_device_sub_topic, on_stream_event=stream_event, on_stream_error=stream_error, on_stream_closed=stream_closed)
To Reproduce Try the sample code. Only publish works.
Expected behavior Subscription in Greengrass core device, using Python, work.
Actual behavior Tell us what actually happened.
Environment
Additional context Add any other context about the problem here.
E.g. what is the impact of the bug?