Interface SubjectNameStrategy

All Known Implementing Classes:
TopicNameStrategy
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface SubjectNameStrategy
Maps a topic and record role to a schema registry subject.

The default strategy is TopicNameStrategy. Provide a custom implementation to serdes or to SchemaCache when subjects follow a different convention, such as one subject per record type shared across topics.

Example

SubjectNameStrategy recordName = (topic, role) -> "com.example.Order";
var serde = AvroSerde.forValue(Order.class, cache, recordName);
  • Method Summary

    Modifier and Type
    Method
    Description
    subject(String topic, Role role)
    Returns the registry subject for a topic and role.
  • Method Details

    • subject

      String subject(String topic, Role role)
      Returns the registry subject for a topic and role.
      Parameters:
      topic - the Kafka topic name
      role - whether the schema describes the record key or value
      Returns:
      the registry subject name