-
Notifications
You must be signed in to change notification settings - Fork 485
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 basic support for converting Avro records to JSON for output #151
Conversation
Requires libavro and libserdes to compile.
This is awesome, I was able to compile with it and is much better than using kafka-avro-console-consumer. The only thing that I missed is the documentation in the command line describing -a,-A and -s options |
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.
It works for me on Mac after a small modification of configure.kafkacat.
Great work!
configure.kafkacat
Outdated
if [[ $WITH_AVRO == y ]] && \ | ||
mkl_lib_check --static=-lserdes "serdes" HAVE_SERDES disable CC "-lserdes -lavro" \ | ||
"#include <stdlib.h> | ||
#include <libserdes/serdes-avro.h> |
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.
It looks like on Mac you need to include
#include <sys/types.h>
as well or the test compile will fail.
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.
Observation: specifying -A or -a without -s "schema-registry-url" crashes kafkacat with segmentation fault. Should be caught and properly dealt with in the argument parsing.
Patiently awaiting this feature... |
My C mojo is very rusty... it took me a while to compile it on MacOS. This is what I had to do:
|
Sorry for the delay, busy finalizing the librdkafka v1.0 release. Will tend to this in a week or two. |
@casidiablo You also have to install avro-c to compile:
|
Looking forward to this feature to get merged 👍 |
@edenhill What's the ETA on getting this merged? |
librdkafka v1.0.0 is going out tonight, should be able to address kafkacat PRs next week and get a new kafkacat release out. |
this would be really great to have, any updates? |
…to llofberg-output_avro_as_json
friendly ping @edenhill |
Any update on this? I use kafkacat quite often and would love this support! |
I understand if you are swamped with work and might also consider accepting other people to maintain this repo. I appreciate all the hard work you've put into this tool and I'm sure we'd love to help continue support your workload for continuing on adding new features |
Please try out this docker image to consume Avro-encoded messages: |
I tried and I receive |
@cecchisandrone That means the message value/payload was not serialized by a schema-registry-aware producer. The schema-registry-aware avro producer prefixes the serialized avro data with a short header that includes a magic value and the schema-id, this is what the consumer uses to look up the schema and deserialize the message. |
@edenhill That command works correcly for me. I also tried with |
Tested with a correct topic. It seems to work. |
* refactoring and fixes of the original PR * added key_error, payload_error optional fields to JSON message envelope to indicate deserialization errors. * prepare for future Avro producer when we (or preferably avro-c) figure out how to convert JSON to Avro. * fix librdkafka version in bootstrap.sh * make Dockerfile rely more on bootstrap.sh * use edenhill fork of yajl to allow embedding the avro-to-json deserialized message key/value directly in the JSON envelope with -J.
2546e5f
to
3ba4ebc
Compare
Added generic deserializers (for various ints, char, string, inpspired by Python's struct.unpack) and changed the command line arguments. Please try out this latest change in with |
7cbaaf4
to
edc5d3e
Compare
edc5d3e
to
490b3c3
Compare
Thanks for your contribution and your patience! |
Is there also a plan to support for AVRO serialization? |
Also, I wanted to test this on latest master build on windows. Should I need to enable something in the build config? I receive this message after building kafkacat on windows: |
We'll add Avro serialization in a later version (incremental delivery, aight?!). Windows support is further down the line since libserdes is not supported on Windows yet. |
This change is