-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat: introduce Message, Serializer, Deserializer and Binding interfaces #324
Conversation
This commit introduces the Message, Serializer and Deserializer, and Binding interfaces used to convert a CloudEvent into a Message that can be sent across a transport protocol. The first protocol implemented for this is HTTP, and some of the functionality formerly in src/transport/http has been simplified, reduced and/or moved to /src/messages/http. Test for V1 events are in place. Conformance tests have been modified to use these new interfaces vs. the HTTP Receiver class. Signed-off-by: Lance Ball <lball@redhat.com>
Signed-off-by: Lance Ball <lball@redhat.com>
Signed-off-by: Lance Ball <lball@redhat.com>
Signed-off-by: Lance Ball <lball@redhat.com>
Signed-off-by: Lance Ball <lball@redhat.com>
Signed-off-by: Lance Ball <lball@redhat.com>
Signed-off-by: Lance Ball <lball@redhat.com>
Signed-off-by: Lance Ball <lball@redhat.com>
@cloudevents/sdk-javascript-maintainers this should be ready now with both v1 and v03 of the spec being tested. PTAL |
Fixes: #295 Signed-off-by: Lance Ball <lball@redhat.com>
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.
Regarding the removed tests, shouldn't we keep them until 4.0.0 to make sure we didn't break anything for the current usage?
Signed-off-by: Lance Ball <lball@redhat.com>
@lholmquist I can revert those tests if you think they are needed. My problem with them is that they were not really integration tests, as they were testing implementation details and not the public facing API. Coverage doesn't actually go down when these are removed! |
Signed-off-by: Lance Ball <lball@redhat.com>
Ok, then it is probably fine to remove them |
Signed-off-by: Lance Ball <lball@redhat.com>
@lholmquist I think this is probably ready to land, but I'm not sure if your comments are an implicit approval or not. |
oh sorry, i think i forgot to press the approve button |
…ces (#324) * lib(messages): Implement a 4.0 Messages and other supporting interfaces This commit introduces the Message, Serializer and Deserializer, and Binding interfaces used to convert a CloudEvent into a Message that can be sent across a transport protocol. The first protocol implemented for this is HTTP, and some of the functionality formerly in src/transport/http has been simplified, reduced and/or moved to /src/messages/http. Test for V1 and V3 events are in place. Conformance tests have been modified to use these new interfaces vs. the HTTP Receiver class. Signed-off-by: Lance Ball <lball@redhat.com>
…ces (#324) * lib(messages): Implement a 4.0 Messages and other supporting interfaces This commit introduces the Message, Serializer and Deserializer, and Binding interfaces used to convert a CloudEvent into a Message that can be sent across a transport protocol. The first protocol implemented for this is HTTP, and some of the functionality formerly in src/transport/http has been simplified, reduced and/or moved to /src/messages/http. Test for V1 and V3 events are in place. Conformance tests have been modified to use these new interfaces vs. the HTTP Receiver class. Signed-off-by: Lance Ball <lball@redhat.com>
Proposed Changes
This PR introduces the
Message
,Serializer
andDeserializer
, andBinding
interfaces used to convert aCloudEvent
into aMessage
that can be sent across a transport protocol. The first protocol implemented for this is HTTP, and some of the functionality formerly insrc/transport/http
has been simplified, reduced and/or moved to/src/messages/http
.Test for V1 events are in place. Conformance tests have been modified to use these new interfaces vs. the HTTP
Receiver
class.Example usage
In an express.js application, simply create a
Message
using the incoming request headers and body. Then callHTTP.toEvent(message)
.Of course, this can be inlined as:
HTTP.toEvent({ headers: req.headers, body: req.body });
.Sending a
Message
should also be straightforward. Convert aCloudEvent
to a message, and send it using Axios or any other HTTP transport library that allows setting headers and body.