Skip to content

Commit

Permalink
fix(topic-data): add basic deserialization of avro primitive (#715)
Browse files Browse the repository at this point in the history
close #700
  • Loading branch information
raphaelauv authored Jun 7, 2021
1 parent 0d3856d commit 386a257
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/main/java/org/akhq/models/Record.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,14 @@ private String convertToString(byte[] payload, Integer schemaId, boolean isKey)
return null;
} else if (schemaId != null) {
try {
GenericRecord record = (GenericRecord) kafkaAvroDeserializer.deserialize(topic, payload);
Object toType = kafkaAvroDeserializer.deserialize(topic, payload);

//for primitive avro type
if (!(toType instanceof GenericRecord)){
return String.valueOf(toType);
}

GenericRecord record = (GenericRecord) toType;
return AvroToJsonSerializer.toJson(record);
} catch (Exception exception) {
this.exceptions.add(exception.getMessage());
Expand Down

0 comments on commit 386a257

Please sign in to comment.