-
Notifications
You must be signed in to change notification settings - Fork 107
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
SAMOA-65 JSON serializer/deserializer dedicated for Kafka components #64
base: master
Are you sure you want to change the base?
Conversation
Initital code for Kafka Consumer
Updates in comments
…om Kafka, blocking until sth received) Major cleanup in tests
…d arrays in InstanceData objects
private static final String ZKHOST = "127.0.0.1"; | ||
private static final String BROKERHOST = "127.0.0.1"; | ||
private static final String BROKERPORT = "9092"; | ||
private static final String TOPIC_AVRO = "samoa_test-avro"; |
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.
Maybe this line is not needed?
private static final String ZKHOST = "127.0.0.1"; | ||
private static final String BROKERHOST = "127.0.0.1"; | ||
private static final String BROKERPORT = "9092"; | ||
private static final String TOPIC_AVRO = "samoa_test-avro"; |
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.
Maybe this line is not needed for the JSON test
kafkaServer = TestUtils.createServer(config, mock); | ||
|
||
// create topics | ||
AdminUtils.createTopic(zkUtils, TOPIC_AVRO, 1, 1, new Properties(), RackAwareMode.Disabled$.MODULE$); |
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.
Similar with previous comments
Thank you @pwawrzyniak for the contributions!
|
Thank you nicolas-kourtellis for your feedback! Regarding your comments, I removed copyright notices from the code, fixed and clened-up the code according to your comments. Regarding AVRO code provided within SAMOA-65, the first difference between avro loader and our kafka avro mapper is that avro loader works with json files containing schema header and payload data (json or binary). In our case avro mapper works with byte stream received from kafka and the schema is defined in separate file. The other difference is that avro loader produces Instance object while Kafka Mapper was designed to work with InstanceContentEvent. Moreover kafka avro mapper serializes whole InstanceContentEvent object while avro loader reads data file, creates avro structure and, based on that, builds Instance object.It should be possible to use the concept from avro loader for processing kafka but I suppose it would require implementation of new generic loader, instead of using the old one. Other thing is that we need to have two way serialization and avro loader is used only for reading data, not writing. And regarding JSON parser, as of now it is prepared to parse messages coming from Apache Kafka in "one-by-one" style, serializing InstanceContentEvent class. It could be potenatially used to parse file (in line-by-line manner for example), but I believe currently, as the mapper accepts byte array as the input, it can be easily used to this task (i.e. as the parser when reading data from text/json file). |
Hi @pwawrzyniak, |
Hi @nicolas-kourtellis, |
@@ -0,0 +1,103 @@ | |||
/* |
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.
Is this class the main difference from #59 ?
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.
I think the same comment also applies for #65
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.
Yes, this is the main difference, as well as the test case where KafkaJsonMapper is being used.
No description provided.