pub struct SchemaRegistrationBuilder<'a> { /* private fields */ }Expand description
Builder for schema registration with fluent API
This builder provides a convenient way to register schemas in the Danube Schema Registry. It supports all schema types (Avro, Protobuf, JSON Schema, etc.) and handles version management.
§Example
use danube_client::{DanubeClient, SchemaType};
let client = DanubeClient::builder()
.service_url("http://localhost:6650")
.build()
.await?;
let mut schema_client = client.schema_registry_client();
// Register an Avro schema
let schema_id = schema_client
.register_schema("user-events-value")
.with_type(SchemaType::Avro)
.with_schema_data(avro_schema_bytes)
.execute()
.await?;
println!("Schema registered with ID: {}", schema_id);§Schema Versioning
The registry automatically handles versioning:
- If the schema definition is new, a new version is created
- If the schema definition already exists, the existing schema_id and version are returned
- Compatibility checks are performed based on the subject’s compatibility mode
Implementations§
Source§impl<'a> SchemaRegistrationBuilder<'a>
impl<'a> SchemaRegistrationBuilder<'a>
Sourcepub fn with_type(self, schema_type: SchemaType) -> Self
pub fn with_type(self, schema_type: SchemaType) -> Self
Sourcepub fn with_schema_data(self, data: impl Into<Vec<u8>>) -> Self
pub fn with_schema_data(self, data: impl Into<Vec<u8>>) -> Self
Set the schema data (raw schema content)
Auto Trait Implementations§
impl<'a> Freeze for SchemaRegistrationBuilder<'a>
impl<'a> !RefUnwindSafe for SchemaRegistrationBuilder<'a>
impl<'a> Send for SchemaRegistrationBuilder<'a>
impl<'a> Sync for SchemaRegistrationBuilder<'a>
impl<'a> Unpin for SchemaRegistrationBuilder<'a>
impl<'a> !UnwindSafe for SchemaRegistrationBuilder<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request