Description
Describe the feature
This is feedback on the MQTT 5 API.
Cfr. the documentation:
The MQTT5 client has a single message-received callback. Per-subscription callbacks are not supported.
I was quite surprised to discover this, and I'm wondering if there's a good reason for this?
As it stands right now, the MQTT5 API feels very low-level, and not really helpful.
The fact that I seem to have to implement my own topic parsing and routing logic doesn't make it feel like this is a developer-friendly API, yet rather a low-level API meant to be used to build another abstraction layer on top.
Being forced to implement this logic myself feels like re-inventing the wheel, requires a lot of boilerplate code that most developers using this library will probably want, and just opens up my application to potential bugs.
It would be really nice to offer the option to register callbacks with subscriptions (similar to the MQTT 3 API), it makes using the API so much easier. I can imagine there are cases where developers want fine-grained or non-standard control on how to handle topic subscriptions and routing messages, but this feels like it should be a minority.
Use Case
I don't want to implement topic parsing and routing messages to different parts of my code myself.
I thought the MQTT 3 API with per-subscription callbacks was great!
Proposed Solution
A somewhat higher-level, possibly complementary API to create subscriptions and register callbacks?
Or at least offer some utility code to handle the boilerplate of parsing topics, routing messages and registering callbacks.
Other Information
No response
Acknowledgements
- I may be able to implement this feature request
- This feature might incur a breaking change
SDK version used
software.amazon.awssdk.iotdevicesdk:aws-iot-device-sdk:1.15.0
Environment details (OS name and version, etc.)
MacOS Ventura 13.4.1 (M2)