Open egekorkan opened 2 years ago
@egekorkan Thanks for flagging the problem. I think we do not have to reference the entire cloud event specification (which is not large btw.) but just select the parts that are relevant for us. As explained in #100, this is only a very small section, which could be just included in the same way.
Apart from not being from a standards body (whether in part or in full), I don't think a dependency on CloudEvents is needed or desirable for the Core Profile, see #100.
@benfrancis I agree, we don't need the full cloud events, however a structured JSON payload with clear properties to be useful. Tying these into specifics of the the protocol binding is not desirable. I think the event object should be protocol agnostic.
Wrt. reference problem: we can resolve by defining a compatible payload as part of the profile.
Tying these into specifics of the the protocol binding is not desirable. I think the event object should be protocol agnostic.
Again, "tying into specifics of the protocol" is the whole point of a protocol binding. Protocol bindings should not be protocol agnostic because their purpose is to be protocol specific. Other event mechanisms in other protocols may also have their own payload formats and may use a non-JSON serialisation or binary data format, so there's not even any guarantee that the same object wrapper could be re-used.
The current event protocol binding provides a very simple and neat mapping from the WoT information model onto the server-sent events event stream format:
event
fielddata
fieldid
fieldExample event affordance in a Thing Description:
"events": {
"overheated": {
"data": {
"type": "number"
},
"forms": [{
"href": "./events/overheated",
"subprotocol": "sse"
}]
}
},
Example event payload:
event: overheated\n
data: 90\n
id: 2021-11-16T16:53:50.817Z\n\n
Why overcomplicate this by adding in an unnecessary data wrapper which must then be added to the data schema of every single event affordance? Other than the non-goal of protocol agnosticism, what value does it provide to justify the added complexity?
https://github.com/w3c/wot-profile/pull/235 needs to be revisited since it was merged with no proper reviews (also the PR was merged when it was 1 day old)
Summary of my points across multiple issues and PRs since this issue is going to be used for discussions:
href
of the TDcontentType
in the TDdata
in the TD. Also, the fact that this is optional, conflicts with :Adding this information in a TD makes for longer TDs (maybe not depending on the my comment below) and bigger payloads.
@egekorkan As the description in #235 clearly states #235 is a rebased version of a previous MR that was available for received various review comments and questions: #198
All questions have been answered in https://github.com/w3c/wot-profile/pull/198.
The content of the MR has not changed, it has been just rebased to resolve merge conflicts, so it is not unreviewed content, but just a rebased version of #198, which was available for almost two months.
On the technical side: We are talking about green field devices, but not about green field cloud systems.
Interop with existing cloud environments is helping adoption of WoT by enabling interop with what is in the world right now.
It is unlikely that the following implementations will change to use an event format that is exclusively defined in a TD: https://developer.adobe.com/events/docs/guides/using/custom_events/ https://docs.microsoft.com/en-us/azure/event-grid/cloudevents-schema
I think my core comment is not addressed anywhere: https://github.com/w3c/wot-profile/pull/198#pullrequestreview-963542459
If we are not aiming for others to change/adapt to our views of WoT, the whole profile specification makes no sense. We want people to do a specific thing when doing a new WoT implementation. If not, we have the entire binding templates documents that are all about explaining how you can use existing technology or standard in a WoT way. Maybe this is just my mistinterpretation.
We are talking about green field devices, but not about green field cloud systems.
We are talking about devices and sometimes about consumers. We do not have a clear statement about the cloud. Also, if we are talking about cloud like this, we are becoming a cloud-specific HTTP profile which means we need a renaming.
@egekorkan :
I find a fundamental problem with using cloud events in a profile that is meant for greenfield applications. It adds too much metadata to payload and does not make sense in a WoT specification.
I believe this is your main comment, please clarify if you mean something else. "too much" and "does not make sense" are opinions, but what "too much"? What means "does not make sense"?
Do you have a counterproposal about a scalable message format that will be easily integrated into changing existing event mechanisms of cloud systems?
I believe this is your main comment, please clarify if you mean something else. "too much" and "does not make sense" are opinions, but what "too much"? What means "does not make sense"?
Everything that is in the TD already or can be put into the TD, should not be in the payload. Copy pasting the relevant part of my comment from above:
Only the bold parts should stay and are the ones that make sense.
Do you have a counterproposal about a scalable message format that will be easily integrated into changing existing event mechanisms of cloud systems?
I do not know where this motivation comes from. Also, how does adding a wrapper around the data improves scalability?
In https://github.com/w3c/wot-profile/issues/100#issuecomment-965650383 I explained why I don't think CloudEvents is a good fit for the HTTP SSE Profile, which already has its own payload format for events. All of the metadata in the CloudEvent format can be provided in a Thing Description and by existing standardised fields in the Server-Sent Events standard.
From my implementation experience for the HTTP SSE Profile I found that the only data actually needed inside an event payload were:
WebHooks is a bit different for a couple of reasons:
As @egekorkan has already said, most of the metadata in CloudEvents is redundant in the context of WoT because it's already provided by the Thing Description. Putting those metadata in the payload of every WebHook event request has no obvious benefit for greenfield implementations, and is therefore wasteful.
From what I can tell, the useful fields from CloudEvents for WoT use cases are:
A minimal solution would be a payload format like the following:
{
"source": "http://192.168.0.124:8080/events/fireAlarm",
"time": "2021-11-10T11:43:25.135Z",
"data": true
}
A more verbose option would be:
{
"source": "http://192.168.0.124:8080",
"subject": "fireAlarm",
"time": "2021-11-10T11:43:25.135Z",
"id": "9c18e98e-083b-11ed-861d-0242ac120002"
"data": true
}
Or if we wanted to be consistent with the HTTP SSE Profile:
{
"source": "http://192.168.0.124:8080/events",
"event": "fireAlarm",
"id": "2021-11-10T11:43:25.135Z",
"data": true
}
I don't see much benefit of including all the metadata from the CloudEvents format for greenfield WoT implementations (for which the Profile specification is designed), but big downsides in terms of inefficiency.
It might make sense to create a CloudEvents protocol binding template, since binding templates are designed for describing brownfield devices.
Since @egekorkan and I disagree with @mlagally on whether to use CloudEvents for the HTTP Webhooks Profile, do any of the other editor's of the specification have an opinion? @mmccool, @mryuichi, @sebastiankb, @k-toumura?
Other than Oracle, is anyone else interested in providing an implementation which uses CloudEvents?
Payload formats for WebHooks are deferred to Profile 1.1. / Profile 2.0.
@mlagally has mentioned the F2F before TPAC of using cloud events in the profile and there are also other mentions of it in various issues. Something that needs to be documented somewhere is that the CloudEvents specification is driven by the Cloud Native Foundation, which is not a standards organization, thus cannot be simply linked to. This implies that having a dependency requires this profile spec to mirror their specification, as TD does with JSON Schema. The group should decide on whether this work is feasible in the current charter before deciding on adopting this specification.