Skip to content
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

Add support for per request MqttRpcTopicPair specification to ExecuteAsync method #1796

Closed
Temppus opened this issue Jul 19, 2023 · 4 comments · Fixed by #1798
Closed

Add support for per request MqttRpcTopicPair specification to ExecuteAsync method #1796

Temppus opened this issue Jul 19, 2023 · 4 comments · Fixed by #1798
Labels
feature-request New feature or request

Comments

@Temppus
Copy link
Contributor

Temppus commented Jul 19, 2023

Describe the feature request

I am using MQTTnet.Extensions.Rpc to do RPC calls via MQTT (great library btw 👍 ).
I would like to use one IMqttRpcClient to do requests to different request/response topics. Prove me wrong but this is not currently supported by library, because ExecuteAsync method overloads only accepts methodName as parameter. So when I want to create dynamic MqttRpcTopicPair for each ExecuteAsync call I have to encode/serialize this to method name and parse it in custom implementation of IMqttRpcClientTopicGenerationStrategy.

Which project is your feature request related to?

  • ManagedClient

Describe the solution you'd like

Add some kind of key value property maybe IDictionary<string, object> to TopicGenerationContext so I do not have to serialize/parse this "per request" topic generation from method name.

Describe alternatives you've considered

Add overload of ExecuteAsync with MqttRpcTopicPair as parameter ?

@Temppus Temppus added the feature-request New feature or request label Jul 19, 2023
@Temppus
Copy link
Contributor Author

Temppus commented Jul 19, 2023

I am open to create PR for this if feature will be accepted and design choice made.

@chkr1011
Copy link
Collaborator

Sounds like a good idea to me. To summarize it:

  • Add a a new optional(!) parameter of type IDictionary<string, object> called "parameters" to the ExecuteAsnyc method
  • Exposing the "Parameters" in the topic generation context so that the users can pass custom data which is required for topic generation.

@Temppus
Copy link
Contributor Author

Temppus commented Jul 24, 2023

Created PR #1798

@Temppus
Copy link
Contributor Author

Temppus commented Jul 30, 2023

Hey @chkr1011 can you find some time to review PR ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants