- Más nuevo
- Más votos
- Más comentarios
Thanks for the answer. I was not even AWARE there were "v1" vs "v2" API differences. I would strongly suggest sanitizing all documentation and example code. I know it is a big ask - but I can't help but feel that every single problem I have encountered with Greengrass (and it has been nearly nothing BUT problems) have been in that ALL of the documentation and examples I am encountering are outdated, and no longer pertinent in a standard V2 environment.
Hello Bradley,
Thank you for using Greengrass V2. In order to publish from a Lambda in V2 using the V1 Lambda SDK you must use the Legacy Subscription Router component: https://docs.aws.amazon.com/greengrass/v2/developerguide/legacy-subscription-router-component.html
This allows you to specify routes from given lambdas to either the cloud (AWS IoT Core) or another lambda on the device.
Please have a look at the Move from V1 to V2: https://docs.aws.amazon.com/greengrass/v2/developerguide/move-from-v1.html#run-v1-lambda-functions
Subscriptions
If your Lambda function publishes messages to the local publish/subscribe broker or to AWS IoT Core, specify aws.greengrass.LegacySubscriptionRouter as a component dependency when you import the function. When you deploy the legacy subscription router component, specify the subscriptions that the Lambda function uses. For more information, see Legacy subscription router.
I would highly suggest however that you consider using a native Greengrass V2 component, especially if you are not migrating from Greengrass V1. Greengrass V2 native components can use our V2 IPC SDK: https://docs.aws.amazon.com/greengrass/v2/developerguide/interprocess-communication.html which will allow you to publish and subscribe to topics without setting up static configuration for those "routes" (except for accessControl policies to allow publish or subscribe).
Cheers,
Michael