-
Notifications
You must be signed in to change notification settings - Fork 230
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
[#889]: Implement cloud events HTTP endpoint #895
Conversation
3d97219
to
4624957
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for a great contribution 👍
I had a first look, found some things and mentioned them inline.
Other stuff which I could not add as inline-comments:
- Please adjust the documentation
documentation/src/main/resources/_data/sidebars/ditto_sidebar.yaml
and add the new page about the cloud events binding- I suggest below the "title: WebSocket protocol binding"
- please adjust the "Copyright holders" in
legal/NOTICE.md
- a unit test would be great, but I suggest to add this in a follow-up PR to not reach the 1.000 LoC ;)
- please adjust the OpenAPI documentation with the new added endpoint: https://github.com/eclipse/ditto/tree/master/documentation/src/main/resources/openapi (cloud also be done in a follow-up PR)
A few "open" questions to me:
- Does the Eclipse Foundation release process allow to use "milestone" dependencies when releasing a non-milestone release? Did not find anything about that in the handbook
- according to ClearlyDefined the cloudevents depencencies have a good enough score, so CQs are not required
- Regarding the "cloud events" fields:
- Do we need to specify which values
ce-type
andce-data-schema
can take?
- Do we need to specify which values
documentation/src/main/resources/pages/ditto/architecture-services-gateway.md
Outdated
Show resolved
Hide resolved
documentation/src/main/resources/pages/ditto/basic-connections.md
Outdated
Show resolved
Hide resolved
documentation/src/main/resources/pages/ditto/connectivity-overview.md
Outdated
Show resolved
Hide resolved
documentation/src/main/resources/pages/ditto/connectivity-protocol-bindings-cloudevents.md
Outdated
Show resolved
Hide resolved
documentation/src/main/resources/pages/ditto/connectivity-protocol-bindings-cloudevents.md
Outdated
Show resolved
Hide resolved
...ipse/ditto/services/gateway/endpoints/routes/cloudevents/UnsupportedDataSchemaException.java
Outdated
Show resolved
Hide resolved
...ipse/ditto/services/gateway/endpoints/routes/cloudevents/UnsupportedDataSchemaException.java
Outdated
Show resolved
Hide resolved
...n/java/org/eclipse/ditto/services/gateway/endpoints/routes/cloudevents/CloudEventsRoute.java
Outdated
Show resolved
Hide resolved
...n/java/org/eclipse/ditto/services/gateway/endpoints/routes/cloudevents/CloudEventsRoute.java
Outdated
Show resolved
Hide resolved
...n/java/org/eclipse/ditto/services/gateway/endpoints/routes/cloudevents/CloudEventsRoute.java
Outdated
Show resolved
Hide resolved
4624957
to
1c694a2
Compare
It is a released version on Maven central. So that is stable enough. I am not aware of any limitations from the Eclipse Foundation side. Their focus is on availability and license compatibility.
Correct.
Hm good question. The |
I amended the PR with changes to your feedback. I will now take a look at the documentation part of that. |
4a18934
to
5759318
Compare
I re-iterated over the documentation. Maybe have a second look. |
The file |
...n/java/org/eclipse/ditto/model/base/exceptions/CloudEventUnsupportedDataSchemaException.java
Outdated
Show resolved
Hide resolved
model/base/src/main/java/org/eclipse/ditto/model/base/exceptions/MissingPayloadException.java
Outdated
Show resolved
Hide resolved
documentation/src/main/resources/pages/ditto/httpapi-protocol-bindings-cloudevents.md
Outdated
Show resolved
Hide resolved
documentation/src/main/resources/pages/ditto/httpapi-protocol-bindings-cloudevents.md
Outdated
Show resolved
Hide resolved
Like mentioned inline:
|
7e572a6
to
b57f200
Compare
I thought I had done that. Then I had some merge issues. Will re-check. |
b57f200
to
bfe879e
Compare
My idea was to do some kind of validation to ensure that the data is actually suitable for Ditto. The field is optional, but still Ditto could require it. But I don't have a strong opinion here. If you think it is better to remove this, then I will do that. |
bfe879e
to
a9e1f82
Compare
...n/java/org/eclipse/ditto/services/gateway/endpoints/routes/cloudevents/CloudEventsRoute.java
Show resolved
Hide resolved
Ok, I would suggest to at least make it optional (so that it may be null), but if it is provided, it must start with |
documentation/src/main/resources/pages/ditto/httpapi-protocol-bindings-cloudevents.md
Outdated
Show resolved
Hide resolved
a9e1f82
to
bdf04a7
Compare
Cloudevents Java SDK 2.0.0.RC1 was just released: https://github.com/cloudevents/sdk-java/releases/tag/2.0.0.RC1 |
Cool, let me trigger the clearlydefine harvester. |
...n/java/org/eclipse/ditto/services/gateway/endpoints/routes/cloudevents/CloudEventsRoute.java
Outdated
Show resolved
Hide resolved
I just manually invoked the I ask me whether this is an expected outcome. |
Thought about this as well. Content negotiation would be awesome for this endpoint. |
The spec for HTTP says on that:
So for HTTP responses there are some open issues:
|
I would propose to handle responses in a new PR. There is no requirement to respond with a cloud event, Ditto can be seen as a "sink", only accepting messages without a full reply. "Full", in the sense of Cloud event response, it still would respond with an HTTP response that it accepted or rejected the HTTP request. |
I am not sure what you have in mind with "content negotiation". From the HTTP binding spec's perspective there are two (or three) modes available. Which get selected through the I think it is ok for Ditto to enforce the "data content type", but that would not be done through the HTTP Content-Type header, but through the parsed Cloud Event "data content type" field. The current implementation already support both binary and structured mode. Only "batch" is not supported, but that should require some extra understanding of both communication parties anyway:
|
What I had in mind was to define the content-type returned in the response by setting the Based on this, ditto could either return the But as already mentioned: I think its not required to be part of this pull request. I however think that the default content-type should be |
bdf04a7
to
b3f4f16
Compare
I am not sure what the response would be? But maybe we discuss this in a new issue, which could focus in the response, or there is one. Right now, it simply accepts incoming cloud events. And the response is, that it accepted/rejected the event. I am not sure how the |
...se/src/main/java/org/eclipse/ditto/model/base/exceptions/CloudEventNotParsableException.java
Outdated
Show resolved
Hide resolved
model/base/src/main/java/org/eclipse/ditto/model/base/exceptions/MissingPayloadException.java
Outdated
Show resolved
Hide resolved
model/base/src/main/java/org/eclipse/ditto/model/base/exceptions/MissingPayloadException.java
Outdated
Show resolved
Hide resolved
documentation/src/main/resources/pages/ditto/httpapi-protocol-bindings-cloudevents.md
Outdated
Show resolved
Hide resolved
documentation/src/main/resources/pages/ditto/httpapi-protocol-bindings-cloudevents.md
Outdated
Show resolved
Hide resolved
I added some (hopefully last) comments to the latest adjustments.
What I think would be useful until the response-handling is clarified:
|
This change adds support for receiving cloud events through the HTTP binding. The event's payload must be in the Ditto Protocol JSON. Co-authored-by: Thomas Jaeckle <[email protected]> Signed-off-by: Jens Reimann <[email protected]>
b3f4f16
to
bba19d5
Compare
I amended the PR based on your feedback. Please double check the addition of the header, I am not 100% this is what you had in mind. |
* set response-required=false and requested-acks=twin-persisted via DittoHeadersBuilder (accept cloudevent requests with a 202 once persisted) * undid initializing DittoProtocolAdapter in a special way as this is not required * fixed that AbstractShardedPersistenceActor did not send back errors when response-required=false and requested-acks=twin-persisted was set in combination * applied codeformatter / organized imports * adjusted log statements to contain "CloudEvent" * adjusted some javadocs Signed-off-by: Thomas Jaeckle <[email protected]>
I pushed one commit to your branch and hope you don't mind. I changed the header-thing I mentioned (response-required=false and requested-acks=twin-persisted) and ensure that it works that way - your variant was the right direction, however the invoked I also had to fix a bug in |
…alculated headers e.g. containing authentication information Signed-off-by: Thomas Jaeckle <[email protected]>
Not at all! 👍 |
Added mandatory follow-ups in #903 |
This change adds support for receiving cloud events through the HTTP
binding.
The event's payload must be in the Ditto Protocol JSON.
Signed-off-by: Jens Reimann [email protected]