-
Notifications
You must be signed in to change notification settings - Fork 69
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
feat: add support for kafka transport #455
Conversation
cf9852e
to
803445f
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.
Few requested changes. Hope the comments are helpful.
Nothing particularly blocking.
I'm not familiar with the goal of the SDKs in terms of supporting all protocols / transports. It be best to keep other transport logic to child helpers since a developer will usually only use the SDK for one protocol at a time.
Thanks for the feedback @grant - I've made some updates. Making the generic type |
Not sure how I feel about this. Other SDKs do support multiple protocols, and all do so within a single repository. Distributing the bits of these implementations is, of course, language specific. So, in Java, for example, you can pull in just the Kafka bindings iiuc, but that's not the case in Rust, for example, where the implementation is all together. In any case, the different transport protocol support is all implemented in a single github repo - which is what we would need to do as well. I think the additional bytes that are added to the package by these two files are really not an issue compared to the complexity of reorganizing this repo to be a mono-repo, supporting multiple npm modules. My 2c. |
Yeah it's fine imo. The main thing is being wary of extra dependencies that may be unnecessary, and ensuring it's still easy to contribute to HTTP features without having to affect other protocols. |
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.
Sorry for breaking into your working process, but it critical bug was my failure, and it can create complex problems for production applications
This change modifies the protocol binding interfaces such as `Binding`, `Serializer` and the like to use the `CloudEventV1` interface instead of the implementation class `CloudEvent`. This should make extending the interfaces simpler as this work has grown out of efforts around the implementation of a second transport interface, Kafka. See: cloudevents#455 This commit also includes the addition of a generic type to the `Message` interface, defaulting to `string`. There is also some minor clean up involving what is exported from the `message/http` modules. Now, instead of exporting the entire implementation, only the `HTTP` binding implementation is exported, and it is then reexported by `message`. Also, a static `CloudEvent.cloneWith()` method has been added which the instance methods now use. Signed-off-by: Lance Ball <lball@redhat.com>
This change modifies the protocol binding interfaces such as `Binding`, `Serializer` and the like to use the `CloudEventV1` interface instead of the implementation class `CloudEvent`. This should make extending the interfaces simpler as this work has grown out of efforts around the implementation of a second transport interface, Kafka. See: cloudevents#455 This commit also includes the addition of a generic type to the `Message` interface, defaulting to `string`. There is also some minor clean up involving what is exported from the `message/http` modules. Now, instead of exporting the entire implementation, only the `HTTP` binding implementation is exported, and it is then reexported by `message`. Also, a static `CloudEvent.cloneWith()` method has been added which the instance methods now use. Signed-off-by: Lance Ball <lball@redhat.com>
@LeoVS09 I've made the appropriate changes, ptal. |
This change modifies the protocol binding interfaces such as `Binding`, `Serializer` and the like to use the `CloudEventV1` interface instead of the implementation class `CloudEvent`. This should make extending the interfaces simpler as this work has grown out of efforts around the implementation of a second transport interface, Kafka. See: cloudevents#455 This commit also includes the addition of a generic type to the `Message` interface, defaulting to `string`. There is also some minor clean up involving what is exported from the `message/http` modules. Now, instead of exporting the entire implementation, only the `HTTP` binding implementation is exported, and it is then reexported by `message`. Also, a static `CloudEvent.cloneWith()` method has been added which the instance methods now use. Signed-off-by: Lance Ball <lball@redhat.com>
86306ed
to
aeda5a3
Compare
This change modifies the protocol binding interfaces such as `Binding`, `Serializer` and the like to use the `CloudEventV1` interface instead of the implementation class `CloudEvent`. This should make extending the interfaces simpler as this work has grown out of efforts around the implementation of a second transport interface, Kafka. See: cloudevents#455 This commit also includes the addition of a generic type to the `Message` interface, defaulting to `string`. There is also some minor clean up involving what is exported from the `message/http` modules. Now, instead of exporting the entire implementation, only the `HTTP` binding implementation is exported, and it is then reexported by `message`. Also, a static `CloudEvent.cloneWith()` method has been added which the instance methods now use. Signed-off-by: Lance Ball <lball@redhat.com>
aeda5a3
to
862b4b2
Compare
Marking as WIP until #457 is resolved as this PR depends on many of those changes, and I think it's better to keep the PRs small and focused vs. cramming all of that in here. |
* chore(refactor): protocol bindings use interfaces This change modifies the protocol binding interfaces such as `Binding`, `Serializer` and the like to use the `CloudEventV1` interface instead of the implementation class `CloudEvent`. This should make extending the interfaces simpler as this work has grown out of efforts around the implementation of a second transport interface, Kafka. See: #455 This commit also includes the addition of a generic type to the `Message` interface, defaulting to `string`. There is also some minor clean up involving what is exported from the `message/http` modules. Now, instead of exporting the entire implementation, only the `HTTP` binding implementation is exported, and it is then reexported by `message`. Also, a static `CloudEvent.cloneWith()` method has been added which the instance methods now use. Signed-off-by: Lance Ball <lball@redhat.com> * fixup: make the `cloneWith()` method is dependent on interfaces Signed-off-by: Lance Ball <lball@redhat.com> * fixup: remove unnecessary cast Signed-off-by: Lance Ball <lball@redhat.com>
This commit extends the `message` package to include Kafka transport. Additionally, some of the type information has changed across the project to more accurately reflect the type of `Message` (by including `T`). Related: cloudevents#390 Signed-off-by: Lance Ball <lball@redhat.com>
862b4b2
to
fb6ee83
Compare
I have rebased with the latest changes from |
This commit extends the
message
package to include Kafka transport. The tests included here were almost entirely copied verbatim frommessage_tests.ts
which tests theHTTP
message binding. The primary change to these tests was the use of theKafka
binding instead of theHTTP
binding. It would be nice, I think, to have generic tests that can test any new transport layer by just taking the binding as a parameter. But that's not what I've done here. :) I've mostly just copied and pasted.There is one test that is pending as it's not passing yet, and I figured it was a bit of an edge case and could be addressed later.
Note that only JSON encoding is supported.
Additionally, some of the type information has changed across the project to more accurately reflect the type of
Message
withMessage<T>
.Related: #390