Conversation
Signed-off-by: Ning Sun <sunng@protonmail.com>
Signed-off-by: Ning Sun <sunng@protonmail.com>
Signed-off-by: Ning Sun <sunng@protonmail.com>
Signed-off-by: Ning Sun <sunng@protonmail.com>
Signed-off-by: Ning Sun <sunng@protonmail.com>
Signed-off-by: Ning Sun <sunng@protonmail.com>
fca0a76 to
0e4cc31
Compare
Signed-off-by: Ning Sun <sunng@protonmail.com>
Signed-off-by: Ning Sun <sunng@protonmail.com>
|
What is the relation of this to the content mode as defined in the Kafka Protocol Binding? Do I read correctly that this PR corresponds to the structured mode, but not to the binary? |
|
I would expect some reference to the schema-registry maintaining the avro schemas. Am I missing something? |
|
This patch is to implement Avro as a cloudevent serialization format. It doesn't cover kafka binding for now. Perhaps we can provide that integration in future. |
| public AvroCloudEventDataWrapper(Map<String, Object> data) { | ||
| avroCloudEventData = new AvroCloudEventData(); | ||
| avroCloudEventData.setValue(data); | ||
| } |
There was a problem hiding this comment.
Can we inject AvroCloudEventData directly?
| public AvroCloudEventDataWrapper(Map<String, Object> data) { | |
| avroCloudEventData = new AvroCloudEventData(); | |
| avroCloudEventData.setValue(data); | |
| } | |
| public AvroCloudEventDataWrapper(AvroCloudEventData avroCloudEventData) { | |
| this.avroCloudEventData = Objects.requireNonNull(avroCloudEventData); | |
| } |
There was a problem hiding this comment.
The reason I'm using a map here is I tried to avoid exposing generated data type in a public api. The AvroCloudEventData contains some Avro serialization logic.
There was a problem hiding this comment.
OK, sounds good!
Can we add only the Objects.requireNonNull check?
| public AvroCloudEventDataWrapper(Map<String, Object> data) { | |
| avroCloudEventData = new AvroCloudEventData(); | |
| avroCloudEventData.setValue(data); | |
| } | |
| public AvroCloudEventDataWrapper(Map<String, Object> data) { | |
| avroCloudEventData = new AvroCloudEventData(); | |
| avroCloudEventData.setValue(Objects.requireNonNull(data)); | |
| } |
formats/avro/src/main/java/io/cloudevents/avro/AvroCloudEventDataWrapper.java
Outdated
Show resolved
Hide resolved
formats/avro/src/main/java/io/cloudevents/avro/AvroSerializer.java
Outdated
Show resolved
Hide resolved
formats/avro/src/main/java/io/cloudevents/avro/AvroCloudEventDataWrapper.java
Outdated
Show resolved
Hide resolved
| Map<String, Object> testData = Map.of("name", "Ning", "age", 22.0); | ||
|
|
||
| @Test | ||
| public void testSerde() { |
There was a problem hiding this comment.
Can we add more test cases?
- Using a CloudEvent v0.3 (
CloudEventBuilder.v03()) - passing null as avroCloudEventData to
AvroCloudEventDataWrapper(we can create a new classAvroCloudEventDataWrapperTestfor this - Testing all data types specified in the union type for
datafield (null included): https://github.com/cloudevents/sdk-java/pull/407/files#diff-09cbc79dec7471fa039c796a1fdfc9f13013cb7e9636e23bc32687378f59cb2aR23-R60
There was a problem hiding this comment.
Ok. I will do it in next few commits.
123bf68 to
4732e2d
Compare
Signed-off-by: Ning Sun <sunng@protonmail.com>
d9fe8c4 to
37c4a56
Compare
Signed-off-by: Ning Sun <sunng@protonmail.com>
37c4a56 to
3af281b
Compare
|
hi @pkgonan I'm no longer working on this. Feel free to fork and continue this work |
This patch is to provide an Avro format implementation for the CloudEvent 1.0.
Fixes #115
TODO items: