Skip to main content

SchemaRegistryAware

Trait SchemaRegistryAware 

Source
pub trait SchemaRegistryAware: Send + Sync {
    // Required methods
    fn fetch_schema<'life0, 'life1, 'async_trait>(
        &'life0 self,
        subject: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = SchemaResult<RegisteredSchema>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn fetch_schema_by_id<'life0, 'async_trait>(
        &'life0 self,
        schema_id: i32,
    ) -> Pin<Box<dyn Future<Output = SchemaResult<RegisteredSchema>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn check_compatibility<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        subject: &'life1 str,
        proposed: &'life2 SchemaRef,
    ) -> Pin<Box<dyn Future<Output = SchemaResult<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn register_schema<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        subject: &'life1 str,
        schema: &'life2 SchemaRef,
    ) -> Pin<Box<dyn Future<Output = SchemaResult<RegisteredSchema>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn build_registry_decoder(
        &self,
        schema: &RegisteredSchema,
    ) -> SchemaResult<Box<dyn FormatDecoder>>;
}
Expand description

A connector that integrates with a schema registry.

Supports fetching, registering, and checking compatibility of schemas against an external registry (e.g., Confluent Schema Registry).

Required Methods§

Source

fn fetch_schema<'life0, 'life1, 'async_trait>( &'life0 self, subject: &'life1 str, ) -> Pin<Box<dyn Future<Output = SchemaResult<RegisteredSchema>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetches the latest schema for a subject.

§Errors

Returns SchemaError::RegistryError if the registry is unreachable or the subject is not found.

Source

fn fetch_schema_by_id<'life0, 'async_trait>( &'life0 self, schema_id: i32, ) -> Pin<Box<dyn Future<Output = SchemaResult<RegisteredSchema>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Fetches a schema by its numeric ID.

§Errors

Returns a schema error if the ID is not found.

Source

fn check_compatibility<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, subject: &'life1 str, proposed: &'life2 SchemaRef, ) -> Pin<Box<dyn Future<Output = SchemaResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Checks whether proposed is compatible with the existing schema for subject under the configured compatibility mode.

§Errors

Returns a schema error if the compatibility check itself fails.

Source

fn register_schema<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, subject: &'life1 str, schema: &'life2 SchemaRef, ) -> Pin<Box<dyn Future<Output = SchemaResult<RegisteredSchema>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Registers a new schema version for a subject.

§Errors

Returns a schema error if registration fails.

Source

fn build_registry_decoder( &self, schema: &RegisteredSchema, ) -> SchemaResult<Box<dyn FormatDecoder>>

Builds a FormatDecoder configured for the registry schema.

This is a sync method because the decoder construction itself is not async — the registry lookup should happen beforehand.

§Errors

Returns a schema error if the decoder cannot be constructed (e.g., unsupported schema type).

Implementors§