liveBook · Manning

Record name strategy

As explained in Kafka for Architects

RecordNameStrategy is a Schema Registry subject-naming strategy that identifies subjects by fully qualified record name independently of Kafka topics.

RecordNameStrategy names a Schema Registry subject after an event’s fully qualified record name, such as com.example.ClientEvent, rather than after a Kafka topic. The schema lifecycle therefore remains independent of topic placement. section 6.4.3

This design supports polyglot topics containing multiple event types. ClientCreated, ClientUpdated, and ClientDeleted events can share a topic when their ordering matters, provided the client identifier is used as the partitioning key. section 6.4.3

Compared with topic-based subject naming, it provides:

  • Independent schema evolution: changes to one record subject do not automatically affect subjects associated with other topics or event types. section 6.4.3
  • Domain-oriented grouping: event types can be modeled independently of Kafka topic structure. section 6.4.3
  • Direct registry lookup through a subject such as com.example.ClientEvent-value and a requested version. section 6.4.3
Listing 6.10 An example of the client event in Avro format
{
  "type": "record",
  "name": "ClientEvent",
  "namespace": "com.example",
  "fields": [
    {
      "name": "eventId",
      "type": "string",
      "doc": "Unique identifier for the event"
    },
    {
      "name": "eventType",
      "type": "string",
      "doc": "Type of event (e.g., 'ClientCreated', 'ClientUpdated')"
    },
    {
      "name": "timestamp",
      "type": "long",
      "logicalType": "timestamp-millis",
      "doc": "Event timestamp in milliseconds"
    },
    {
      "name": "clientId",
      "type": "string",
      "doc": "Unique identifier for the client"
    },
    {
      "name": "clientName",
      "type": "string",
      "doc": "Name of the client"
    }
  ]
}

The Avro record defines the fully qualified name and fields used to derive the subject. section 6.4.3

How Kafka for Architects covers it

How deep it goes
Explains naming, independent evolution, polyglot topics, partition ordering, and REST lookup, but stops short of consumer implementation.
Examples
Uses ClientCreated, ClientUpdated, and ClientDeleted events plus a com.example.ClientEvent Avro record.
What you can do after
Apply it via Schema Registry to keep event schemas topic-independent and preserve per-client event ordering.
How it connects
Connects RecordNameStrategy with Schema Registry, Kafka topics, TopicNameStrategy, domain-driven design, and partitioning keys.

Also explained in

Compare how 2 books explain record name strategy →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kafka for Architects. The section links point to the parts of the book it draws on.