rest-proxy: allow reading messages with avro-value and string-key #1031
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It is not uncommon that Kafka users produce messages with String-key and Avro-value. In this case Karapace REST typically fails to read the message since it only supports one format for deserializing both the key and the value. For more convenience, I suggest to fallback to
binary
deserializer for the key (only) when reading it usingavro
fails.For the manual (and integration) test we actually don't care about the value. We just assume that it exists in Avro-format, important is that we produce a message with Base64 encoded String-key:
Now we want to consumer the whole message, knowing that the value is in Avro format, so we create the consumer accordingly, and subscribe to the topic:
Reading records BEFORE the change:
Reading records AFTER the change:
Note that I also tested with a record with a String-key and a non-empty Avro-value that was produced in Java.