Interface SchemaRegistry
- All Superinterfaces:
org.apache.nifi.components.ConfigurableComponent,org.apache.nifi.controller.ControllerService
public interface SchemaRegistry
extends org.apache.nifi.controller.ControllerService
Represents
ControllerService strategy to expose internal and/or
integrate with external Schema Registry-
Method Summary
Modifier and TypeMethodDescriptionSet<org.apache.nifi.schema.access.SchemaField> default booleanIndicates whether this schema registry implementation supports raw schema definition access.org.apache.nifi.serialization.record.RecordSchemaretrieveSchema(org.apache.nifi.serialization.record.SchemaIdentifier schemaIdentifier) Retrieves the schema based on the provided descriptor.default SchemaDefinitionretrieveSchemaDefinition(org.apache.nifi.serialization.record.SchemaIdentifier schemaIdentifier) Retrieves the raw schema definition including its textual representation and references.Methods inherited from interface org.apache.nifi.components.ConfigurableComponent
getIdentifier, getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validateMethods inherited from interface org.apache.nifi.controller.ControllerService
initialize, isStateful, migrateProperties
-
Method Details
-
retrieveSchema
org.apache.nifi.serialization.record.RecordSchema retrieveSchema(org.apache.nifi.serialization.record.SchemaIdentifier schemaIdentifier) throws IOException, org.apache.nifi.schema.access.SchemaNotFoundException Retrieves the schema based on the provided descriptor. The descriptor must contain and schemaIdentifier or name, but not both, along with a version, and an optional branch name. For implementations that do not support branching, the branch name will be ignored.- Parameters:
schemaIdentifier- a schema schemaIdentifier- Returns:
- the schema for the given descriptor
- Throws:
IOException- if unable to communicate with the backing storeorg.apache.nifi.schema.access.SchemaNotFoundException- if unable to find the schema based on the given descriptor
-
getSuppliedSchemaFields
Set<org.apache.nifi.schema.access.SchemaField> getSuppliedSchemaFields()- Returns:
- the set of all Schema Fields that are supplied by the RecordSchema that is returned from
retrieveSchema(SchemaIdentifier)
-
isSchemaDefinitionAccessSupported
default boolean isSchemaDefinitionAccessSupported()Indicates whether this schema registry implementation supports raw schema definition access.This method allows clients to determine if the
retrieveSchemaDefinition(SchemaIdentifier)method is supported before attempting to call it, avoiding UnsupportedOperationException.- Returns:
- true if raw schema definition access is supported, false otherwise
-
retrieveSchemaDefinition
default SchemaDefinition retrieveSchemaDefinition(org.apache.nifi.serialization.record.SchemaIdentifier schemaIdentifier) throws IOException, org.apache.nifi.schema.access.SchemaNotFoundException Retrieves the raw schema definition including its textual representation and references.This method is used to retrieve the complete schema definition structure, including the raw schema text and any schema references. Unlike
retrieveSchema(SchemaIdentifier), which returns a parsedRecordSchemaready for immediate use, this method returns aSchemaDefinitioncontaining the raw schema content that can be used for custom schema processing, compilation, or when schema references need to be resolved.This method is particularly useful for:
- Processing schemas that reference other schemas (e.g., Protocol Buffers with imports)
- Custom schema compilation workflows where the raw schema text is needed
- Accessing schema metadata and references for advanced schema processing
- Parameters:
schemaIdentifier- the schema identifier containing id, name, version, and optionally branch information- Returns:
- a
SchemaDefinitioncontaining the raw schema text, type, identifier, and references - Throws:
IOException- if unable to communicate with the backing storeorg.apache.nifi.schema.access.SchemaNotFoundException- if unable to find the schema based on the given identifierUnsupportedOperationException- if the schema registry implementation does not support raw schema retrieval
-