Skip to content
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

Make base64 encoding optional #28

Open
johanvanderkuijl opened this issue Aug 29, 2017 · 4 comments
Open

Make base64 encoding optional #28

johanvanderkuijl opened this issue Aug 29, 2017 · 4 comments

Comments

@johanvanderkuijl
Copy link

We’re using Logstash to write event data to a Kafka queue. The consumer of this queue expects an Avro binary blob (or fragment, the terminology seems to differ sometimes). It seems however, that using the Avro codec provided by Logstash for the Kafka output adapter, results in a base64 encoded version of the binary fragment being produced to Kafka. This is also clear from the source code:

@on_event.call(event, Base64.strict_encode64(buffer.string))

Do you agree that this encoding should be configurable, like 'base64encoding => true/false' ?
What is it's use anyway?
Should I make a PR for this issue?

Thanks in advance,
Johan

@original-brownbear
Copy link
Contributor

@rubyan yea this makes a lot of sense to me. The reason we're doing the base64 encoding on top of Avro here is that there were some decoding issues when handling raw byte[] on the Ruby side of things in the Avro deserialization (when used together with Kafka String encoder that coerced data to UTF8).

If you wish to provide a PR that makes this optional (let's default to true though to not break the round-trip use cases we initially fixed via the base64 round) I'm happy to review + merge this. Otherwise, I can also look into fixing this mid next week.

@guillaume7
Copy link

Hi, we are facing same issue than @rubyan.

Do you have any intention to make base64 encoding optional?

Thank you and best regards,
Guillaume

@lucabelluccini
Copy link
Contributor

The mandatory base64 wrapping prevents to decode only specific fields of the Avro payloads (e.g. decode only the fields specified in the schema, which might be less than the ones present in the writer schema).

karenzone pushed a commit that referenced this issue Aug 21, 2020
Adds a comment/warning regarding partial deserialization of Avro codecs.
This is slightly related to #28
@th0ger
Copy link

th0ger commented Apr 15, 2021

@original-brownbear Is this fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants