Package org.apache.nifi.serialization
Interface RecordSchemaCacheService
- All Superinterfaces:
ConfigurableComponent
,ControllerService
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptioncacheSchema
(RecordSchema schema) Updates the cache to include the given Record Schema and returns an identifier for the Schema.Returns the Schema with the given identifier, if it can be found in the cache.Methods inherited from interface org.apache.nifi.components.ConfigurableComponent
getIdentifier, getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validate
Methods inherited from interface org.apache.nifi.controller.ControllerService
initialize, isStateful, migrateProperties
-
Field Details
-
CACHE_IDENTIFIER_ATTRIBUTE
- See Also:
-
-
Method Details
-
cacheSchema
Updates the cache to include the given Record Schema and returns an identifier for the Schema. If the schema already exists in the cache, the existing identifier is returned. Otherwise, the schema is added to the cache and a new identifier is created and returned. This identifier can then be used to retrieve the Record Schema via thegetSchema(String)
method- Parameters:
schema
- the schema to cache- Returns:
- a unique identifier for the schema
-
getSchema
Returns the Schema with the given identifier, if it can be found in the cache. Note that the cache may choose to evict schemas for any number of reasons and, as such, the service may return an empty Optional even immediately after the Schema is cached via thecacheSchema(RecordSchema)
.- Parameters:
schemaIdentifier
- the identifier of the schema- Returns:
- an Optional holding the Record Schema with the given identifier, if it can be found, or an empty Optional if the schema cannot be found
-