-
-
Notifications
You must be signed in to change notification settings - Fork 144
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
[feature request] Improvements for Avro messages producing #195
Comments
Hm, this looks a bit like we use the avro library incorrectly. Maybe i can write a reproducer test this evening. |
@eshepelyuk do you have some instructions at hand to setup schema registry? i.e. docker image and curl command to install the schema? |
Let me provide a docker conpose later with kafka, zk and schema registry set up |
don't need kafka/zk - schema registry is enough (and the command to upload a schema). thanks! |
I had a look yesterday at this and here are my findings: Using the official avro cli tools I've got the same error when omitting the
I also got the same behaviour when using the
goavro is a little more lenient if you add a default to the field as in:
For the second issue I found this goavro side. And it looks like it is the same behaviour on avro-tools as well. I had to add the "string" to the union:
I'm not sure what AKHQ is doing, but is seems like they're going an extra step to fill those gaps. |
Hello @birdayz Attaching an archive with script to setup schema-registry and install a schema there. Archive contains examples from my initial post |
Hi all I've been able to advance on the issue using small python program that leverages fastavro python library. So my script is able to create AVRO json ( i.e. weird JSON with types ) from plain JSON. Then resulting AVRO JSON can be sent to kafka using Attaching a new archive containing the script. Plz install fastavro with pip to use it. Script can be used like this ./json2avro.py create-null.json | kaf produce --avro-schema-id 2 create_user_profile_wallet Could you take a look and check if your libraries support the same functionality, so it can be eventually implemented in |
thanks so much for putting this together. i have a lead. since v2, the avro library we use, linkedin/goavro, supports I assume, there's effectively two kinds of avro codec: standard, and JSON. I did a test and with the JSON codec this works:
however, it requires expiresOn to be present. either as null, or with value. i think this is correct. what do you think? i tend towards the flag, and defaulting to JSON actually.. since proto is also json format. |
Well, as I user I consider that AVRO JSON is contra intuitive for daily usage, but still maybe useful for some edge cases. |
@fabiojmendes thank you. i've taken a look. If you want, you can do the changes there. |
Hello this is a follow up to #181
Since basic functionality now working, let me start from the beginning and provide more complicated examples.
Yet again I am comparing with similar functionality in AKHQ UI
Use case with errors
ExpiresOn
= nullkaf
invocation and the outputExpiresOn
!= nullkaf
invocation and the outputSo, the messages are not working with
kaf
but those files are valid Avro JSON messages and can be sent to a topic using some other tools, e.g. AKHQ.Existing solution
To overcome a problem - JSON files must be changed to some unfriendly format.
ExpiresOn
== nullExpiresOn
!= nullImprovement request
As a user I'd like
kaf
to be able to handle plain JSON (as described in the Use case section) for producing Avro encoded message. Without need to convert my plain JSON data to that weird format.Currently this is working for some other tools, e.g. AKHQ UI, but it is missing for CLI based tools.
The text was updated successfully, but these errors were encountered: