pub struct SchemaRegistryClient { /* private fields */ }
Expand description
A client for interacting with the Schema Registry within Redpanda.
Implementations§
Source§impl SchemaRegistryClient
impl SchemaRegistryClient
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new default Schema Registry client that connects to Redpanda’s Schema Registry when running within the context of a data transform.
Sourcepub fn new_wrapping(delegate: Box<dyn SchemaRegistryClientImpl>) -> Self
pub fn new_wrapping(delegate: Box<dyn SchemaRegistryClientImpl>) -> Self
Create a new custom Schema Registry client wrapping the implementation.
This is useful in testing when you want to inject a mock client.
Sourcepub fn lookup_schema_by_id(&self, id: SchemaId) -> Result<Schema>
pub fn lookup_schema_by_id(&self, id: SchemaId) -> Result<Schema>
Lookup a schema via its global ID.
Sourcepub fn lookup_schema_by_version(
&self,
subject: impl AsRef<str>,
version: SchemaVersion,
) -> Result<SubjectSchema>
pub fn lookup_schema_by_version( &self, subject: impl AsRef<str>, version: SchemaVersion, ) -> Result<SubjectSchema>
Lookup a schema for a given subject at a specific version.
Sourcepub fn lookup_latest_schema(
&self,
subject: impl AsRef<str>,
) -> Result<SubjectSchema>
pub fn lookup_latest_schema( &self, subject: impl AsRef<str>, ) -> Result<SubjectSchema>
Lookup the latest schema for a subject.
Sourcepub fn create_schema(
&mut self,
subject: impl AsRef<str>,
schema: Schema,
) -> Result<SubjectSchema>
pub fn create_schema( &mut self, subject: impl AsRef<str>, schema: Schema, ) -> Result<SubjectSchema>
Create a schema in the Schema Registry under the given subject, returning the version and ID.
If an equivalent schema already exists globally, that schema ID will be reused. If an equivalent schema already exists within that subject, this will be a noop and the existing schema version will be returned.