[−][src]Enum schema_registry_converter::schema_registry::SubjectNameStrategy
Strategy similar to the one in the Java client. By default schema's needs to be backwards compatible. Historically the only available strategy was the TopicNameStrategy. This meant in practice that a topic could only have one type, or the restriction on backwards compatibility was to be abandoned. Using either of the two other strategies allows multiple types of schema on on topic, while still being able to keep the restriction on schema's being backwards compatible. Depending on the strategy, either the topic, whether the value is used as key, the fully qualified name (only for RecordNameStrategy), or the schema needs to be provided.
let mut encoder = Encoder::new(server_address().to_string()); let heartbeat_schema = SuppliedSchema::new(r#"{"type":"record","name":"Heartbeat","namespace":"nl.openweb.data","fields":[{"name":"beat","type":"long"}]}"#.into()); let strategy = SubjectNameStrategy::TopicRecordNameStrategyWithSchema("hb".into(), heartbeat_schema); let bytes = encoder.encode(vec![("beat", Value::Long(3))], &strategy); assert_eq!(bytes, Ok(vec![0, 0, 0, 0, 23, 6]))
Variants
RecordNameStrategy(String)
TopicNameStrategy(String, bool)
TopicRecordNameStrategy(String, String)
RecordNameStrategyWithSchema(SuppliedSchema)
TopicNameStrategyWithSchema(String, bool, SuppliedSchema)
TopicRecordNameStrategyWithSchema(String, SuppliedSchema)
Trait Implementations
impl Clone for SubjectNameStrategy
[src]
fn clone(&self) -> SubjectNameStrategy
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for SubjectNameStrategy
[src]
Auto Trait Implementations
impl Send for SubjectNameStrategy
impl Sync for SubjectNameStrategy
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Same for T
type Output = T
Should always be Self