Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [hono-dev] Command & Control response buffering

>However, there's a certain amount of work at the border (adapter) and in the application to manage the round trips. So I run again through all the steps and the previous emails and considered the new point that you >introduced with the improved version of the proposal, i.e. converting the final reply to a "long-runner command response event" in the adapter. At the end it seems to me that this extra work could be avoided with no >loss of information if the device simply sent the new event message directly.

 

This is undoubtedly true – the device can send the new event message directly without loss of information.

My point was not to introduce something that could not have been achieved by existing patterns before, but to try to make it usable as “nice as possible”.

In this way the device would not need to contact the event API to send messages that belong to a command.

I can see the description page for it already explaining why long-runner commands always need the Event API to publish their result – which is possible, but still does not fully satisfy me.

 

To your concern of the extra work in the adapter:

An event received via HTTP must be converted to an AMQP 1.0 message as well – just as a command reply. So IMHO the extra work should be almost nothing  – it differs just regarding which AMQP message is built up in the adapter

and to which AMQP link it is transfered.

 

 

>This brings the discussion a little bit at the beginning. From the previous emails I know you would prefer to keep command response events on the command and control namespace. This time there would be some

>savings anyway. 

 

I am afraid I do not understand the “This time there would be some savings anyway.” What do you mean with “this time” and “savings”?

 

>For http devices one possible benefit of sending the new "command response event" is that a device could set a ttd property into it thus allowing a new command to be chained. 

 

A valid point – but I think the chaining of commands is just another pattern to consider. And IMHO this should behave the same for short or long running commands again.

Probably leading to support the ttd in a command response as well, which then would potentially contain the next command from the application.

 

For me this would be a point 4.) (not specified yet).

 

To find out the best solution for all command patterns I find this discussion really helpful and I appreciate your feedback!

 

WDYT?

 

Karsten



From: hono-dev-bounces@xxxxxxxxxxx <hono-dev-bounces@xxxxxxxxxxx> On Behalf Of Morson, Stefano
Sent: Mittwoch, 27. Juni 2018 17:34
To: hono developer discussions <hono-dev@xxxxxxxxxxx>
Subject: Re: [hono-dev] Command & Control response buffering

 

Well, i don't have the big picture but I'll try to give my feedback the same.

 

Compared to the option of maintaining long lived links from the application to the adapter i think it's better. Connections would be shorter and this would likely benefit scalability as well.

 

However, there's a certain amount of work at the border (adapter) and in the application to manage the round trips. So I run again through all the steps and the previous emails and considered the new point that you introduced with the improved version of the proposal, i.e. converting the final reply to a "long-runner command response event" in the adapter. At the end it seems to me that this extra work could be avoided with no loss of information if the device simply sent the new event message directly.

 

This brings the discussion a little bit at the beginning. From the previous emails I know you would prefer to keep command response events on the command and control namespace. This time there would be some savings anyway. 

 

For http devices one possible benefit of sending the new "command response event" is that a device could set a ttd property into it thus allowing a new command to be chained. 

 

What do you think ?

 

 

S

 


From: hono-dev-bounces@xxxxxxxxxxx <hono-dev-bounces@xxxxxxxxxxx> on behalf of Frank Karsten (INST/ECS4) <Karsten.Frank2@xxxxxxxxxxxx>
Sent: Wednesday, June 27, 2018 1:47:38 PM
To: hono developer discussions
Subject: Re: [hono-dev] Command & Control response buffering

 

Hi Stefano,

 

thanks a lot for your comment!

 

>From your description it looks like that at certain point the device will notify the application that the execution of a "long running" command has been fully completed (not only acknowledged) and the device should do >that with a reply attaching the original request-id. 

>However, I guess that in the meantime the original link used to acknowledge the command has been closed. Since the run can take hours, maybe the application instance that started the >command is no longer alive and another instance is available in its place; how should the application prepare to handle the upcoming "final" reply ?

 

That was the first “idea” : demanding that the application layer has to remember long running commands and thus need to reopen the reply-link when being restarted.

While in some situations this might be suitable, it is problematic and thinking about your good idea changed my mind:


>Should the "final" reply be preceded by an event that allows the application to establish a new link and receive the reply or should the new application instance be aware of the on going >operation and proactively start a new link or something different ? 

 

We could define your proposal as a precondition for long-running commands – first send an event, and then afterwards the command-reply.

It would not demand the application itself anylonger to keep a link always open – which probably is unrealistic anyway.

 

But IMHO we can make it even better:

 

For long running commands:

-         the application closes the link directly after the sending of the command to the device was acknowledged, and does not keep any response link open

-         the device replies (hours later) to the usual command-reply address to the protocol adapter, but the protocol adapter transforms it to a special event (“long-runner command response event”) that contains the response including all properties. Helper code for the application could even invoke the same callback as if the command was not a “long runner” and hide the event from the application (transforming it to a command response again).

 

This would make life for both sides easier.

Applications would only need to “remember” the command-request-id and bind any business logic to it. And this cannot be prevented anyway.

 

WDYT?

 

Best regards

Karsten

From: hono-dev-bounces@xxxxxxxxxxx <hono-dev-bounces@xxxxxxxxxxx> On Behalf Of Morson, Stefano
Sent: Mittwoch, 27. Juni 2018 12:29
To: hono developer discussions <hono-dev@xxxxxxxxxxx>
Subject: Re: [hono-dev] Command & Control response buffering

 

Hi Karsten,

 

this is an interesting discussion, I have some question regarding the point below (maybe I'm missing some previous discussion, sorry in that case).

 

After 1.) is finished, we extend the pattern to “long or medium runners”: the direct response here only acknowledges the reception of the command. 

IMHO we should make the life of a device as easy as possible : instead of forcing it to send an event (and thus changing to a downstream pattern),

it can reply by using the “command request id” of the original command again. 

The application instance may need to persist it to still know about this command, and to support that the reply reaches a different instance that has not originally sent the command.

 

 

From your description it looks like that at certain point the device will notify the application that the execution of a "long running" command has been fully completed (not only acknowledged) and the device should do that with a reply attaching the original request-id. 

However, I guess that in the mean time the original link used to acknowledge the command has been closed. Since the run can take hours, maybe the application instance that started the command is no longer alive and another instance is available in its place; how should the application prepare to handle the upcoming "final" reply ? Should the "final" reply be preceded by an event that allows the application to establish a new link and receive the reply or should the new application instance be aware of the on going operation and proactively start a new link or something different ? 

 

 

Regards,

Stefano

 


From: hono-dev-bounces@xxxxxxxxxxx <hono-dev-bounces@xxxxxxxxxxx> on behalf of Frank Karsten (INST/ECS4) <Karsten.Frank2@xxxxxxxxxxxx>
Sent: Friday, June 22, 2018 2:29 PM
To: hono developer discussions
Subject: Re: [hono-dev] Command & Control response buffering

 

Hi all,

 

Since the discussion matches well with what I expect from commands in Hono, let me try to make a summary (and some refinement proposals) of what we should provide then:

 

1.)   Focus on the already specified direct request-response pattern, which does not buffer any responses from the device. This is well suited for “short runners”, that can be repeated if the reply never reached the application after a timeout.

This is what we started already for HTTP, and will continue to have this implemented for MQTT as well.

Events could be used to code persisted replies for this pattern, but the correlation needs to be done manually in the application then.

 

2.)   After 1.) is finished, we extend the pattern to “long or medium runners”: the direct response here only acknowledges the reception of the command.

IMHO we should make the life of a device as easy as possible : instead of forcing it to send an event (and thus changing to a downstream pattern),

it can reply by using the “command request id” of the original command again.

The application instance may need to persist it to still know about this command, and to support that the reply reaches a different instance that has not originally sent the command.

 

In this case, the “ttd” of a reply (as proposed by Kai)  should be specified when creating the command in the application, and it should be protected by having an upper limit (e.g. per tenant).

 

Although I agree to Marc, that this is possible already with 1.) (by using events), it would always confuse users and feels not right to me. 2.) would address this concern.

 

3.)   In another step, we can (and IMHO should) support that there will be a number of subsequent replies from the device to the application. All correlated by using the same command-request-id. This could be supported by

-       letting the application specify the number of responses that have to come, or by

-       defining an additional property to signal that a reply is the last in a chain of replies.

 

As I said: IMHO 1.) needs to be completely finished before providing the other ones, since 1.) is the most essential.

 

2.) and 3.) may need some thoughts how to support users/developers in the best and logical way, but we should invest in this I think.

And 2.) seems to be more important to me than 3.)

 

Best regards,

Karsten

 

From: hono-dev-bounces@xxxxxxxxxxx <hono-dev-bounces@xxxxxxxxxxx> On Behalf Of Marinov Avgustin (INST/ECS8)
Sent: Donnerstag, 21. Juni 2018 13:06
To: hono developer discussions <hono-dev@xxxxxxxxxxx>
Subject: Re: [hono-dev] Command & Control response buffering

 

Hi Marc,

 

you’re right that sometimes such buffering may not be needed. If some mechanisms as ttl and size restrictions (as discussed with Kai) are implemented in Hono then you could have user friendly way for handling ‘important’ responses and ‘nice to have’/’not needed’ responses. You would also protect Hono from overloading too.

 

Поздрави / Best regards,

Avgustin Marinov

Engineering Cloud Services Device Manager
(INST/ECS8)
Bosch Software Innovations EOOD | 47B Tsarigradsko Shose | Sofia 1124 | BULGARIA
| www.bosch-si.com
Tel. +359 2 9055801 | Mobile +359 889 464664 | Fax +359 2 9532617 | Avgustin.Marinov@xxxxxxxxxxxx

From: hono-dev-bounces@xxxxxxxxxxx <hono-dev-bounces@xxxxxxxxxxx> On Behalf Of Marc Pellmann
Sent: 20 юни 2018 г. 18:07
To: hono developer discussions <hono-dev@xxxxxxxxxxx>
Subject: Re: [hono-dev] Command & Control response buffering

 

Hi Avgustin

I mean even if the execution takes few seconds, the caller service could restart, or loose connection to the AMQP reply-to topic for a while. Why it should lose the reply?

 

If the service restarts while the command is in sending or the response did to arrived I assume the service to retry the command.

 

Also, sending the result for long living commands as events seems like bypassing the command’s request/response pattern/support.

 

I see this more as a different pattern. For example the direct execution result is useful to turn on a light. A command to upload the firmware would only be acknowledged directly and after the firmware is active the device maybe send an "new_firmware_active" event.

 

And which action I should model like that? Which takes 1 sec, 10 sec, 1 min?

 

I think it is more a question of "direct response" .. and the real amount of time depends on the network/deployment.

 

If reply is not buffered, than I will model all of my commands as command/reply event – then what I’ll benefit of command reply?

 

For direct commands I think it is not easy to handle the complex process of buffered responses in the applications. The application need to be able to handle the responses if it restarts or if the response arrives at a different instance. For something like light=on from above this seems overkill/not needed?

 

But for some cases it might be the best to handle the response just as the acknowledgement of the device and handle the real response as the event. But in principle it might be also possible to configure the AMQP Network to buffer/broker the response. Maybe we should look further into this?!

 

Best regards,

Marc

 

 

Поздрави / Best regards,

Avgustin Marinov

Engineering Cloud Services Device Manager
(INST/ECS8)
Bosch Software Innovations EOOD | 47B Tsarigradsko Shose | Sofia 1124 | BULGARIA
| www.bosch-si.com
Tel. +359 2 9055801 | Mobile +359 889 464664 | Fax +359 2 9532617 | Avgustin.Marinov@xxxxxxxxxxxx

From: hono-dev-bounces@xxxxxxxxxxx <hono-dev-bounces@xxxxxxxxxxx> On Behalf Of Marc Pellmann
Sent: 20 юни 2018 г. 14:09
To: hono developer discussions <hono-dev@xxxxxxxxxxx>
Subject: Re: [hono-dev] Command & Control response buffering

 

Hi Avgustin,

 

as written on the concept page the Command and Control API defines commands that follow a request-response pattern and expect an immediate confirmation of their result. But we do not define that this need to be the result of the execution of the command. The device could also immediately acknowledge receipt as part of the request-response-pattern. 

 

If the use case needs a later response (which then also needs the guarantee of delivery) the device is able to do such with a normal event. In such a case I would also assume that the application has some kind of persistence of the expected execution result correlation because it could not be sure, that it is the same instance who gets the response (this would also be the case if the response would arrive hours or days later on the direct response link - which not an intended case).

 

Maybe it makes sense to define specific properties and e.g. content-type for such command-response events in later versions.

 

Best regards,

Marc

 

 

On Wed, Jun 20, 2018 at 11:53 AM Marinov Avgustin (INST/ECS8) <Avgustin.Marinov@xxxxxxxxxxxx> wrote:

Hi all,

 

as far as I understand, currently, the responses (replies) for the commands will be lost if there is no registered consumer. This could be a problem in some cases. For instance if the command execution on the device side takes too long – e.g. hours.

In that case when the response is returned the backend application may be down and the result of the execution could be lost. I thing that it would be better to have buffering of the command responses on in hono in order to provide guaranties that the response of the commands will reach the backend application. After all, such guaranties are available for the events. And the command results are maybe event more important then events.

 

What do you thing?

 

Поздрави / Best regards,

Avgustin Marinov

Engineering Cloud Services Device Manager
(INST/ECS8)
Bosch Software Innovations EOOD | 47B Tsarigradsko Shose | Sofia 1124 | BULGARIA
| www.bosch-si.com
Tel. +359 2 9055801 | Mobile +359 889 464664 | Fax +359 2 9532617 | Avgustin.Marinov@xxxxxxxxxxxx

_______________________________________________
hono-dev mailing list
hono-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/hono-dev

_______________________________________________
hono-dev mailing list
hono-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/hono-dev


Back to the top