-
Notifications
You must be signed in to change notification settings - Fork 137
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 explicit support for request/response communication pattern (device to application) #1276
Comments
Initial idea: Device side: Sending the request message
Handling request and response messages in terms of AMQP messages could either be done with Shared Protocol Adapter logic
Application side
Or, AMQP messages could be handled using a fixed number of reusable links (along with mapping incoming responses to the right protocol adapter instance): Shared Protocol Adapter logic
Application side
|
The need for such a feature even becomes even more urgent if Hono is to be used in combination with Ditto: Currently, without adding a piece of software in the north of Ditto, it is not possible to fetch the current state of the Digital Twin from the Cloud. While one can send a Ditto "retrieve" message via the Hub's telemetry/event channel, there is no way to receive the response. Neither synchronously nor asynchronously. This makes it impossible to implement the desired/reported pattern for configuration values, as it is possible for instance in AWS IoT. |
FMPOV Ditto would need to be responsible to push the desired state to a device while the device is responsible to report its current state. However, Ditto needs to support the desired/reported states in order for that to work. I do not think that a device should need to pull the desired state from the back end. We deliberately provided means for devices to signal their intention to receive messages from the back end applications. Ditto would simply need to use it as a trigger to push the desired state to the device using a command ... |
I'm not sure if the Ditto shall implement push state. This could be tricky.
|
I remember times when Hono was supposed (?) to have C&C in both directions (https://www.slideshare.net/dejanb/scaling-out-eclipse-hono 4th slide). Also I thing AWS IoT provides restricted support for request/response from device. |
Some thoughts regarding the resource structure ... HTTP adapter: MQTT adapter: I wonder if we need dedicated link addresses for sending the requests downstream and receiving a response from a downstream application. For sending the request message downstream I see no reason why we cannot simply re-use the telemetry or event link. The message would then have its correlation-id property set to |
Right, the correlation ID can be set by the adapter (if the client hasn't explicitly provided one).
I agree that we should try to prevent adding new links to the AMQP messaging network. However, a reason for not re-using the telemetry or event link here would simply be that the resource names are not so straigthforward anymore then. Currently we use Rather than introducing HTTP adapter: The downstream AMQP message would get a corresponding MQTT adapter: The device would subscribe to _ |
If we don't need the client to specify it, then IMHO we should not allow him to specify one so that there is no chance of using a non-unique correlation ID.
This sounds good in general. However, what if the HTTP adapter receives a command for the device instead of a response to a request? Would the HTTP adapter then release the command? |
Since we would allow the client to specify it for MQTT messages, my intuition would be to also allow it for HTTP, letting it be the responsibility of the device to ensure uniqueness if it chooses to supply a correlation ID. But since for HTTP the usual case should be the adapter-generated ID we can omit that feature in the initial implementation and add it later, if there is a need.
Yes, provided the device hasn't sent another still-ongoing request without a Matching incoming commandsThat means that an incoming command would first be checked for its correlation id, to find a matching protocol adapter instance and command handler. Only if no matching protocol adapter instance is found, the check would be repeated without the correlation id (just with tenant + device id). For an MQTT device, this means that a command with a matched correlation id (ie. an id the device used in a Matching incoming commands - revisedThinking more about commands with unmatched correlation ids: This means we probably should require the actual request-response command messages to have a boolean |
Hi all, looking at the proposals, I personally like the first approach Carsten proposed - dedicated links for request/response to backend application.
IMO, this looks very natural from the user's perspective and keep things consistent. I believe that approach could be also very easy to implement:
Now, we will just have couple of instances for of both types just using different links. What do you think? |
I now longer care. |
@avgustinmm how would the device correlate the response received from the adapter to the request message that it has sent to the adapter? |
@sophokles73 So, let device send request to |
This issue is about a use case where a device sends a request message and expects a corresponding response from a northbound application.
Such a scenario can already be implemented with Hono. The device can send a telemetry/event message with a correlation id property/parameter and with a
ttd
parameter (signaling its readiness to receive a command message). The northbound application can send a one-way command message as response, including the given correlation id. Upon receiving the command message, the device can correlate the message to its initial telemetry/event message using the correlation id.However, such a solution is not very intuitive and requires manual correlation of the messages.
Therefore it would be good to explore the feasibility of adding explicit support for such a communication pattern, including correlation support and matching endpoint names.
The text was updated successfully, but these errors were encountered: