Skip to main content

Message Type Registry

All message types used within a microservice environment must be documented in a Message Type Registry — one per program/application group (e.g. DaziT). It gives an overview of subscriber/publisher dependencies. It is a Git repository with one type descriptor per type; a validation build keeps it consistent and prevents changing existing schema versions.

Note: The registry is a separate repository, not part of jeap-messaging. jeap-messaging provides the tooling: jeap-messaging-registry-maven-plugin (verify/export) and jeap-messaging-avro-maven-plugin (generate Java bindings).

Structure​

Descriptors live under /descriptor/<system-lowercase>/event/<eventname>/ (and /command/), with a <Type>.json descriptor plus a <type>_<version>.avdl value schema and an optional key schema next to it. /schema holds JSON schemas for descriptors (usable in the IDE). Shared records go under /descriptor/<system>/_common or /descriptor/_common; a record checked into master must never be changed or deleted (create a new record with a new name, e.g. a version suffix).

Changing existing schemas​

The verification build compares every schema file that already exists on master with its new content. The check compares the schema the file defines, not its text: both versions are parsed, and imports are resolved against their own branch. You may change:

  • comments (//, /* */) and documentation comments (/** */)
  • whitespace, indentation, line breaks and line endings
  • the order of imports and of type declarations

Any change to the schema itself is rejected. That covers names, namespaces, fields and their order, types, logical types, defaults, aliases, enum symbols and their order, enum defaults and custom properties. It also covers changes that come in through an imported type. The error names the changed types.

Such changes don't reach artifacts that were already published, because only new versions are compiled. Changed documentation of a _common type ships with the next common library of that system. With autoRegisterSchema=true (the default), this registers a new, compatible schema version in the Kafka Schema Registry on first send. For links to further documentation, prefer the descriptor's documentationUrl: descriptor fields outside versions can be changed at any time.

Descriptor data model​

Top-level descriptor fields:

FieldContentMandatory
nameMessage type name (legacy alias: eventName / commandName)Y
definingSystemSystem that defines the type (legacy alias: publishingSystem)Y
descriptionHuman-readable description of the typeY
scopepublic (crosses system boundaries) or internalY
documentationUrlLink to further documentationN
topicDefault topic for the typeN
topicsList of topics for shared types (alternative to topic)N
versionsList of version entries (see below)Y

Note: name replaces the legacy eventName / commandName, and definingSystem replaces the legacy publishingSystem. The old names are still accepted as deprecated aliases.

Each entry in versions describes one schema version:

FieldContentMandatory
versionSemantic version, e.g. 1.2.0Y
valueSchema.avdl value schema file next to the descriptorY
keySchema.avdl key schema fileN
compatibilityModeBACKWARD / FORWARD / FULL / NONE — compatibility to the previous version (or to compatibleVersion)N
compatibleVersionThe version this schema must be compatible with (default: the previous semver version)N

The example below declares a type with three versions; each new version states the compatibility it keeps to its predecessor (see Message evolution):

{
"name": "JmeDeclarationCreatedEvent",
"definingSystem": "JME",
"description": "Published when a customs declaration is created",
"scope": "public",
"topic": "jme-messaging-declaration-created",
"versions": [
{
"version": "1.0.0",
"valueSchema": "JmeDeclarationCreatedEvent_v1.avdl",
"keySchema": "ch.admin.bit.jme.declaration.BeanReferenceMessageKey.avdl"
},
{
"version": "1.1.0",
"valueSchema": "JmeDeclarationCreatedEvent_v2.avdl",
"keySchema": "ch.admin.bit.jme.declaration.BeanReferenceMessageKey.avdl",
"compatibilityMode": "BACKWARD"
},
{
"version": "2.0.0",
"valueSchema": "JmeDeclarationCreatedEvent_v3.avdl",
"keySchema": "ch.admin.bit.jme.declaration.BeanReferenceMessageKey.avdl",
"compatibilityMode": "NONE"
}
]
}

Maintenance​

For the steps to add a message type or a new version of one, see Updating the message type registry.

Java bindings​

The registry build uploads generated JARs to a Maven repository; consume them with the group id defined in the registry pom and an artifact id composed of application + message name (see Getting started, Defining messages).

Relationship to the Kafka Schema Registry​

The Message Type Registry is the design-time home of schemas and descriptors; the Kafka Schema Registry is the runtime home; jeap-messaging registers runtime schemas automatically.