kafka-rest
kafka-rest copied to clipboard
How to produce message with Avro format ? Records (v3)
Ref. https://docs.confluent.io/platform/current/kafka-rest/api.html#records-v3
From above document show some example:
{ "key": { "subject_name_strategy": "TOPIC_NAME", "schema_id": 1, "data": 1000 }, "value": { "schema_version": 1, "data": { "foo": "bar" } } }
foo is string (primitive) (Java) I try with bytes type by encode to base64 to send but when I try to send decimal types (bytes) by convert BigDecimal -> byte[] -> Base64 -> CAST AS string Value that show in KSQL is not correct.
BigDecimal decimal = new BigDecimal("1234567.98"); // Ref. org.apache.avro.Conversions.DecimalConversion byte[] bigIntegerBytes = decimal.unscaledValue().toByteArray(); byte[] base64EncodedBytes = Base64.getEncoder().encode(bigIntegerBytes); String resultToSend = new String(base64EncodedBytes);
My question is how to send decimal type via Rest proxy. I found some relate issue #290