-
Notifications
You must be signed in to change notification settings - Fork 72
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
Basic support for Confluent's KafkaAvroSerializer / KafkaAvroDeSerializer #9
Basic support for Confluent's KafkaAvroSerializer / KafkaAvroDeSerializer #9
Conversation
…ts proprietary 5-byte wire format prefix
I'm not familiar with Go - I still have to figure out how to unit test the stuff. |
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.
Hey @fmck3516,
Thanks for the awesome PR. 🙏 I left a few comments and I think it can be merged after the changes.
I tried to create GH Actions for testing the feature, but I couldn't find an action for running Apache Kafka and co. There's an awesome GH Action by @szkiba called xk6bundler that can bundle and distribute k6 with xk6 extensions, but mere bundling without actual testing with Kafka is not what we want though.
test/test.js
Outdated
@@ -0,0 +1,63 @@ | |||
/* |
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 am wondering if you could move all the scripts (test_*.js
) to the scripts
directory and rename this somehow to something like test_avro_with_magic_bytes.js
or something shorter.
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 renamed the file to test_avro_with_schema_registry.js
and yes, I think it would be good to move the tests out of the top level directory.
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.
But the file is still called test/test.js
. Am I missing something? 🤔
…pport-for-confluent-de-serializer
@mostafa: Thanks for the feedback - I will update the PR in the upcoming week. |
…pport-for-confluent-de-serializer
…com/fmck3516/xk6-kafka into support-for-confluent-de-serializer
I incorporated your feedback. I also switched to a JSON-based configuration model to be in sync with the approach for the What do you think about having one big configuration JSON for auth and everything else? |
@fmck3516 I was actually thinking about the same thing, but then thought that it's out of scope of this PR or mine. So maybe the next PR would focus on refactoring, cleanups and better configuration management. I also have the idea to refactor metric collection and error handling. Sorry for too much information! 🤣 |
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! I can rearrange test scripts (files) after merging.
}` | ||
|
||
|
||
var configuration = JSON.stringify({ |
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 love this. 👏
test/test.js
Outdated
@@ -0,0 +1,63 @@ | |||
/* |
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.
But the file is still called test/test.js
. Am I missing something? 🤔
That makes sense - one step at a time.
One thing I would like to add to the wishlist: A suite of regression tests that is executed automatically. |
…izer (#9) * Experimental support for Confluent Cloud * initial work to support Confluents KafkaAvroSerializer/KafkaAvroDeserializer format * added schemaRegistry.go to encapsulate logic that deals with Confluents proprietary 5-byte wire format prefix * added caching for previous schema lookups * reduce diff noise * PULL-9: review follow-ups
Basic support to serialize and deserialize with Confluent's proprietary 5-byte prefix.
The prefix will be added if the key or value serializer is set to
io.confluent.kafka.serializers.KafkaAvroSerializer
.The prefix will be removed if the key or value deserializer is set to
io.confluent.kafka.serializers.KafkaAvroDeserializer
.Configuration example:
The configuration for
schemaRegistry
is required to use a serializer of typeio.confluent.kafka.serializers.KafkaAvroSerializer
.A new
produce
andconsume
function has been added (each accepts the new configuration argument):produceWithConfiguration(producer, messages, configuration, keySchema, valueSchema);
consumeWithConfiguration(consumer, 20, configuration, keySchema, valueSchema);
Note: I ported a sub-set of the existing functionality of the Confluent Java client. This code will be obsolete once Confluent adds Schema Registry support for their Go client. At the time of writing, the Go client does not support Schema Registry: https://docs.confluent.io/platform/current/clients/index.html