This guide was written originally for dFlow~IQ. Authoritative sources were used to verify technical facts and are credited in the references section. Source wording is not reproduced.
Kafka stores bytes, not application objects
A serializer converts a typed key or value into bytes; a deserializer reverses that operation. Key and value are separate boundaries and may use different formats. Headers are bytes too.
Serialized key bytes influence partition selection. UTF-8 text 42 is not the same key as a four-byte integer 42, so changing key serialization can move related records and disrupt ordering, joins or compaction.
UTF-8 string "42" = 34 32
32-bit integer 42 = 00 00 00 2a
Avro long 42 = 54Use JSON as a text wire format
JSON on Kafka is normally UTF-8 text. It is easy to inspect and interoperable, but the bytes do not identify a schema version unless an additional framing or contract system is used.
Whitespace, member order and numeric spelling can produce different bytes for semantically similar documents. Large integers can also lose precision in runtimes that map every JSON number to floating point.
Choose JSON when syntax must be validated. Choose String when the payload is arbitrary text, even when that text happens to contain braces.
Avro binary requires a writer schema
Avro binary omits most field names and separators because the schema already defines structure. Records are encoded in schema order, integers use variable-length encoding and unions include a branch index.
Raw Avro datum, Registry-framed Avro, Avro Object Container File and Avro single-object encoding are distinct formats. A consumer built for one cannot assume another is compatible.
| Format | How the writer schema is found |
|---|---|
| Raw Avro datum | Supplied externally |
| Registry-framed Avro | Schema ID in an outer frame |
| Object Container File | File header contains schema and block metadata |
| Embedded envelope | Application-defined schema-plus-payload structure |
Recognise Registry framing conceptually
The common Registry frame starts with a format marker, then a four-byte schema ID, then the encoded datum. The full schema is not copied into every record. Consumers use the ID against the expected Registry environment.
A leading zero byte is only a clue. Confirm that the next bytes resolve to a real ID and that its schema can decode the remainder before concluding a payload is Registry framed.
+------------+------------------+-------------------+
| marker | 4-byte schema ID | Avro binary datum |
+------------+------------------+-------------------+Match dFlow~IQ formats to the consumer contract
Base64 and hex are input notations for bytes, not extra wrappers. If a consumer expects the literal characters aGVsbG8=, use String; choosing Base64 sends the decoded bytes for hello.
| dFlow~IQ format | Wire intent |
|---|---|
| String | UTF-8 text |
| Int32 / Int64 | Fixed-width signed integer |
| UInt32 / UInt64 | Unsigned numeric representation expected by the target |
| SchemaRegistry | Registry-framed schema-backed value |
| Avro(Embedded) | Schema and payload supplied together for object-container encoding |
| Base64 / Hex | Input notation decoded to exact raw bytes |
| UUIDBinary | UUID binary representation expected by the target |
Debug from exact bytes outward
- Separate key and value and identify which side failed.
- Capture topic, partition, offset, lengths, headers and null status for one exact record.
- Inspect raw hex or Base64 before trying another structured decoder.
- Verify the producer's actual serializer configuration and release version.
- For Registry data, resolve the frame's ID in the correct Registry environment.
- Use the exact writer schema, not simply the latest subject version.
- Check primitive width and byte order.
- Compare old and new offsets for mixed-format topic history.
A null value is not an empty string or zero-byte payload. On compacted topics, a keyed null value can represent deletion.
Produce safely in dFlow~IQ
- Confirm workspace, cluster and topic before opening the producer.
- Inspect existing records to identify key and value formats.
- Select key and value serializers independently.
- For Registry-backed data, select and review the intended subject and version.
- Validate JSON, Avro types, enum symbols, unions and numeric ranges locally.
- Send one canary and wait for its broker acknowledgement.
- Read the exact partition and offset back with the intended deserializer.
- Observe downstream errors before using Batch Upload.
References
References support factual claims in this original guide. They are not required reading.
- Apache Avro Specification Used to verify Avro encoding, defaults, unions and writer-reader schema resolution.
- Confluent Schema Registry: Schema Evolution Used to verify compatibility modes and their direction.
- RFC 8259: JSON Used to verify JSON syntax, UTF-8 interoperability and numeric limitations.
- RFC 4648: Base-N Encodings Used to verify Base64 and hexadecimal as representations of octets.