-
Notifications
You must be signed in to change notification settings - Fork 119
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
Add Key deserializer for KafkaSource #1326
Add Key deserializer for KafkaSource #1326
Conversation
Signed-off-by: Pierangelo Di Pilato <[email protected]>
Signed-off-by: Pierangelo Di Pilato <[email protected]>
Signed-off-by: Pierangelo Di Pilato <[email protected]>
Signed-off-by: Pierangelo Di Pilato <[email protected]>
The following is the coverage report on the affected files.
|
Codecov Report
@@ Coverage Diff @@
## main #1326 +/- ##
============================================
+ Coverage 75.74% 75.98% +0.23%
- Complexity 523 539 +16
============================================
Files 94 95 +1
Lines 3290 3352 +62
Branches 148 154 +6
============================================
+ Hits 2492 2547 +55
- Misses 616 619 +3
- Partials 182 186 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
.../dispatcher/src/main/java/dev/knative/eventing/kafka/broker/dispatcher/RecordDispatcher.java
Show resolved
Hide resolved
@@ -61,6 +61,8 @@ | |||
|
|||
public static final String TYPE = "dev.knative.kafka.event"; | |||
|
|||
private static final String KEY_EXTENSION = "key"; |
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.
can we - somewhere, get a little comment/description on the relationship between PARTITION_KEY_EXTENSION
and KEY_EXTENSION
?
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.
The only reason to use key
is for backward compatibility with the exiting source in eventing-kafka
.
I'd propose to deprecate that field if possible.
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.
deprecate where? Here? or eventing-kafka
?
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.
Both or here only for the future.
There is a bug report related to this knative-extensions/eventing-kafka#897, so even in eventing-kafka to solve that issue and keep backward compatibility, we would need to set the partitionkey
extension to the same value of the key
extension.
The problem with the key
extension is that is Knative specific while partitionkey
is a CloudEvent spec thing.
So, I'd deprecate key
and the alternative will be partitionkey
.
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.
So, I'd deprecate key and the alternative will be partitionkey.
sounds good, @pierDipi
data-plane/dispatcher/src/main/java/dev/knative/eventing/kafka/broker/dispatcher/main/Main.java
Show resolved
Hide resolved
...est/java/dev/knative/eventing/kafka/broker/dispatcher/impl/consumer/KeyDeserializerTest.java
Show resolved
Hide resolved
Quite a verbose change, due to signature 😅 But overall looks good - added a few comments |
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.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: matzew, pierDipi The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This patch adds a
KeyDeserializer
that uses thekafkasources.sources.knative.dev/key-type
label todeserialize a record key.
Part of #312
Proposed Changes
Release Note
Docs
None