liveBook · Manning

Specific record

As explained in Kafka Streams in Action, Second Edition

A specific record is a generated, strongly typed data object whose fields and accessors correspond to a known schema.

A specific record is a generated, strongly typed object whose structure follows a known Avro schema. Unlike GenericRecord, it is aware of its fields and exposes direct accessors. section 3.2.9

Use the two record forms differently:

  • Check a GenericRecord with hasField before retrieving schema-named fields through get. section 3.2.9

Generating and consuming an Avro record

Generate Java classes from registered schemas, construct an AvengerAvro object with its builder, and configure KafkaAvroDeserializer with SPECIFIC_AVRO_READER_CONFIG=true. The consumer then returns the generated specific type rather than GenericRecord.

How Kafka Streams in Action, Second Edition covers it

How deep it goes
Explains generated accessors, GenericRecord contrast, field updates, and SpecificRecordBase, but stops short of generation internals.
Examples
Demonstrates AvengerAvro construction, direct field access, GenericRecord lookup, and updating fields on both representations.
What it assumes
Assumes familiarity with schemas and deserialization while distinguishing typed generated objects from generic field containers.
What you can do after
Apply it via KafkaAvroDeserializer to consume schema-based messages as generated Java types with direct field access.
How it connects
Connects specific records with Avro, GenericRecord, schemas, deserialization, Kafka consumers, and Schema Registry.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kafka Streams in Action, Second Edition. The section links point to the parts of the book it draws on.