-
Notifications
You must be signed in to change notification settings - Fork 227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rumqttc: unable to specify subscription options in v5 #697
Comments
Create `FilterBuilder` to build `Filter` using the builder pattern. Closes bytebeamio#697
@swanandx I made a PR that:
It looks like a big breaking change. I'm not sure if this is the best way to do that, but I liked how the API looks receiving a Filter instance built with the builder pattern: client
.subscribe(
Filter::builder()
.path("hello/world")
.qos(Some(QoS::AtLeastOnce))
.build(),
)
.await
.unwrap(); |
hey @ecarrara , thank you so much for the PR! ( I didn't expect PR this fast haha 🚀 )
Yes, I do agree with that. We are planning to reconsider the APIs and integrate builder pattern wherever required in rumqttc, then we can introduce breaking changes at once, but currently we are totally occupied with rumqttd related tasks 😅 , so it might take a while to review #698 . Thank you for understanding. |
It is possible to construct a |
RetainForwardRule is private, see bytebeamio/rumqtt#697 (comment)
And likewise the |
Hey @drauschenbach , good catch! would you like to open PR to solve the issue? ( just need to add Otherwise, I will do it first thing tomorrow! Thanks 😁 |
The current API of v5 client doesn't let us specify subscription options while subscribing.
Context
MQTTv5 introduces subscription options. This options like
preserve_retain
,retain_forward_rule
are preset inFilter
defined here:but currently we can't pass this options to
Filter::new(_)
, instead it uses default values:we should be able to pass down those options while creating
Filter
.Possible solutions ideas / challenges
We can either just add more arguments to
new(_)
or use a builder pattern for creatingFilter
, whichever is better.We also need to think upon how the users will specify them:
subscribe(_)
? ( would make API very verbose unnecessary as most users won't use these )What I would prefer is: Instead of passing `topic`, `qos` to `subscribe(_)`, user will build `Filter` using builder pattern and the pass it to `subscribe(filter: Filter)`. Something like:
Please feel free to comment your ideas / suggestions 🚀
The text was updated successfully, but these errors were encountered: