-
Notifications
You must be signed in to change notification settings - Fork 483
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
Response of issueDeviceCommand is not providing CBOR Content-Type header #2272
Comments
|
@FelixTing As I referred to in the previous comment, the steps I have following in my attempt to recreate the reported issue are these:
|
@akramtexas: this smacks of an uninitialized go-mod-core-contracts client (something @brandonforster is currently working on in edgexfoundry/go-mod-core-contracts#196). Unrelated to the underlying issue but something you'll need to understand (and overcome) to be able to reproduce the underlying issue. |
@michaelestrin The input (in your comment above) is deeply appreciated 👍 |
|
|
|
|
|
Gents @tsconn23 @michaelestrin, in sharing here an outline of the design choice(s) we have in order to address the reported behavior, I invite your thoughts in terms of preference on how to proceed:
|
I'm not sure if this is an actual bug. It may be an enhancement request in disguise. I'm not sure if the community agreed to implement CBOR for device commands. I'm also not sure of the use case (though there must be one because this issue was opened). We support CBOR for telemetry -- pushing binary events with readings from a device service through core, support, and appfunc services northward. @tsconn23 @jpwhitemn did the community commit to implement CBOR on the command side? |
@FelixTing I have walked through this with Akram. There is a line in the Device SDK that calls this functionality out as a gap From this I understand your use case to be you are expecting a CBOR response to the REST client invoking a command via core-command that will return some kind of binary reading. Currently that functionality doesn't exist. It only sends an event of the appropriate encoding through core-data. What use case are you implementing where you find that returning a CBOR response in this manner is useful? If you can provide more details, we can consider reclassifying this an an enhancement and potentially have Akram make the changes. |
currently unmarshals JSON only, with reference to the following call stack:
|
|
@akramtexas
We discussed on Friday 24-Jan that if the CBOR Content-Type header value is correctly coming back from the device service, which I understand that it is based on what you've written above, that it would be possible to modify core-command to
|
@tsconn23 This is a great summary 👍 (I also really appreciate your pointing out in particular how the execution of a |
@akramtexas @tsconn23 @akramtexas has reproduced what I encountered when trying to support read operation of binary resource in device-virtual-go:
Thanks for your help. I really appreciate it. |
@FelixTing Welcome back from your Lunar calendar vacation. Thanks for confirming (using the link in your comment above) the specifics of the steps that lead to reported behavior. Is there anything else you would like to add in this connection, to elaborate what use case you are implementing, and where you find that returning a CBOR response in this manner is useful? |
@FelixTing We need to know the use case for the steps you've outlined above. How is this flow utilized in a customer oriented solution? What purpose does it solve? As described above this flow is not implemented and will be an enhancement. Understanding the customer use-case will help us to prioritize. @iain-anderson @jpwhitemn for visibility |
@tsconn23 We don't have use cases so far. The purpose here is to implement the binary support in Virtual Device Service for user test, and we found out this limitation. We can tweak the Virtual Device Service to work only with the current supported behaviors on binary data. |
I've always viewed the command channel as a mechanism to actuate a device or provide an asynchronous prompt to a device service for it to take an action and return the relevant data via the normal manner (i.e. via core-data). I may be misinterpreting; it sounds like you want to obtain data from a device service as a direct reply to a command request sent via core-command. If this is the case, this would effectively create a new data path within the system. Given the design and intent of the system in general and core-command specifically, I'd be interested in @jpwhitemn's take on whether or not this is desirable.
@tobiasmo1 how would this work? In the scenario you describe, the rules engine -- based on a trigger -- would initiate a specific command to a specific device service to obtain some binary data. What would the rules engine to do with that binary data? |
A simple use case in my mind is that when a motion sensor detects something, Get commands would be invoked to retrieve videos or snapshots from the cameras in a specific area. |
Why wouldn't the video/snapshot data be forwarded into core-data by the device service as usual? |
Since the binary data is large, users might not want to collect it constantly. Through rules engine and get command, users could retrieve the binary data when it is necessary. |
I don't think I'm communicating clearly. In your scenario, it could be the data is sent only when the rules engine triggers the command to instruct the device service to gather and send it. There's nothing about the existing data path that requires data to be sent constantly. Assuming the rules engine -- based on a trigger -- initiated a specific command to a specific device service to obtain some binary data in-band, what would the rules engine to do with that binary data? I'm still not clear on the value of creating a separate path (via core-command or otherwise) to receive and process data from device services. |
I got your point now. |
One suggestion that has been floated before is to allow control of the destinations for event data on a per-request basis by use of query parameters. |
I concur -- orthogonal.
With this additional clarity, it seems as if the initial CBOR implementation missed the real possibility of binary data being included in a command response. It sounds like this needs to be addressed. In your opinion (@jpwhitemn @iain-anderson ), is this a forward-facing change (i.e. in master only) or something we should fix in prior releases? |
“Why wouldn't the video/snapshot data be forwarded into core-data by the device service as usual?
If there is no application subscribed to receive the data. I suspect most workflows will AutoEvent or manually trigger an event using a command. But this leaves the third flow we discussed and implemented; legacy command/response behavior that conforms to usual device service behavior for non-binary payloads.
Assuming EdgeX will continue to support command/response for device services (to query and/or actuate a device), it is consistent to facilitate binary/CBOR data alongside other readings (numeric, strings, json, etc.). I suppose there are alternatives to routing the information back to the caller (e.g., using correlation ID, etc.), even to RESTful services that call a device service to “get” a response.
I filed an issue during initial CBOR implementation that the command handling was “overloaded”. (ref: edgexfoundry/device-sdk-go#240). I also reported that Core Command wasn’t reflecting this Content Type header in the response; I don’t find a reference yet. Trevor may recall, I believe we decided to consider supporting this via Accept header.
Toby
From: Cloud Tsai <notifications@github.com>
Sent: Monday, February 3, 2020 11:43 PM
To: edgexfoundry/edgex-go <edgex-go@noreply.github.com>
Cc: Mosby, Tobias <tobias.mosby@intel.com>; Mention <mention@noreply.github.com>
Subject: Re: [edgexfoundry/edgex-go] Response of issueDeviceCommand is not providing CBOR Content-Type header (#2272)
A simple use case in my mind is that when a motion sensor detects something, Get commands would be invoked to retrieve videos or snapshots from the cameras in a specific area.
Why wouldn't the video/snapshot data be forwarded into core-data by the device service as usual?
Since the binary data is large, users might not want to collect it constantly. Through rules engine and get command, users could retrieve the binary data when it is necessary.
@SteveOss<https://github.com/SteveOss> @andyf1967<https://github.com/andyf1967> @iain-anderson<https://github.com/iain-anderson> could you please share your opinions or use cases you know?
Thanks for the effort, @michaelestrin<https://github.com/michaelestrin> @akramtexas<https://github.com/akramtexas> @tsconn23<https://github.com/tsconn23> , we will implement the binary support in virtual device service with the current implementation first anyway.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#2272?email_source=notifications&email_token=AEAJEVKJSRGFJZ7HDG4YXKLRBEMBZA5CNFSM4KFC3UM2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKWUTIQ#issuecomment-581781922>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AEAJEVNPDH5NRJVM5HBUQ3TRBEMBZANCNFSM4KFC3UMQ>.
|
Discussed in February 13th Core WG meeting; community decided to move ahead with correcting this in Geneva release. Re-categorized and assigned @akramtexas. |
@michaelestrin @tsconn23 I will work this for the |
|
Should we split out handling CBOR for write commands (enhancement) from this issue of missing content-type in result of read command (bug) |
…2446) Fix edgexfoundry#2272 Update core-command to propagate `Content-type` header from device service when a GET command is executed. Previously this value was hard-coded to `application/json` and was ignoring the correct value that the device service was providing. Signed-off-by: Akram Ahmad <sftwr2020@gmail.com> Signed-off-by: Andre Srinivasan <andre@redislabs.com>
🐞 Bug Report
Affected Services
The issue is located in: commandIs this a regression?
NoDescription and Minimal Reproduction
Function issueDeviceCommand and issueDeviceCommandByNames is still applying the application/json Content-Type header when the response body is a CBOR event.
The text was updated successfully, but these errors were encountered: