Skip to content

Schema contexts

A schema context is an independent namespace within a schema registry. Subjects in a named context are addressed by their fully qualified name, for example :.production:orders-value. Subjects outside any named context live in the default context and keep their plain name.

Named contexts are typically populated by Confluent Schema Linking, or by clients configured with a context in their registry URL.

A SchemaRegistryBackup backs up subjects from all schema contexts. No additional configuration is required.

Subjects in a named context are backed up under their fully qualified name. Subjects in the default context keep their plain name.

Schema registries without context support are not affected. The backup then contains all subjects of the registry under their plain names.

See Schema Registry Backups for how the subject directories are encoded in the storage.

A SchemaRegistryRestore restores subjects under the name they were backed up with, so subjects from a named context are restored into that same context on the target registry.

When restoring in import mode, the target registry’s global IMPORT mode covers the default context only:

Terminal window
$ curl -X PUT \
-H "Content-Type: application/json" \
-d '{"mode":"IMPORT"}' \
https://registry.example.com/mode

Every named context being restored must be switched to IMPORT mode separately:

Terminal window
$ curl -X PUT \
-H "Content-Type: application/json" \
-d '{"mode":"IMPORT"}' \
https://registry.example.com/mode/:.production:

The restore validates this before writing anything. If a named context is not in IMPORT mode, the restore fails up front and the target registry is left untouched. The failure message in the restore job’s logs names every context that still needs to be switched.

A registry in IMPORT mode accepts writes that bypass the usual checks, so it should not be left in that state. After the restore completes, switch the registry back to its original mode:

Terminal window
$ curl -X PUT \
-H "Content-Type: application/json" \
-d '{"mode":"READWRITE"}' \
https://registry.example.com/mode

Repeat this for every named context that was switched to IMPORT mode:

Terminal window
$ curl -X PUT \
-H "Content-Type: application/json" \
-d '{"mode":"READWRITE"}' \
https://registry.example.com/mode/:.production: