1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! In-house Confluent Schema Registry decode for Kafka consumers.
//!
//! Decode-only: strips the Confluent wire frame (magic byte +
//! big-endian schema id, and for protobuf the message-index array), validates
//! the message's schema subject against an accepted set, and delegates the
//! inner payload to the topic's [`crate::codec::Codec`]. Schemas are fetched
//! from a Confluent-compatible registry over HTTP and cached so the hot path
//! is a single lock-free map read.
//!
//! Works with the [Confluent Schema Registry](https://docs.confluent.io/platform/current/schema-registry/index.html)
//! and with Redpanda's built-in Schema Registry, which exposes the same
//! Confluent-compatible REST API and wire format.
//!
//! Enable with the `kafka-schema-registry` feature.
//!
//! # Examples
//!
//! Build a registry client and attach it to a Kafka consumer:
//!
//! ```no_run
//! use std::sync::Arc;
//! use std::time::Duration;
//!
//! use shove::schema_registry::{SchemaEnforcement, SchemaRegistry, SchemaRegistryAuth};
//! use shove::consumer::ConsumerOptions;
//! use shove::markers::Kafka;
//!
//! // Build the registry client once and share it across consumers via Arc.
//! let registry = SchemaRegistry::builder("http://schema-registry:8081")
//! .auth(SchemaRegistryAuth::Basic {
//! user: "sr-user".into(),
//! pass: "sr-pass".into(),
//! })
//! .timeout(Duration::from_secs(3))
//! .max_retries(2)
//! .negative_cache_ttl(Duration::from_secs(60))
//! .build();
//!
//! // Attach the registry to per-consumer options.
//! let opts = ConsumerOptions::<Kafka>::new()
//! .with_schema_registry(Arc::clone(®istry))
//! .with_schema_enforcement(SchemaEnforcement::Enforce)
//! .accept_schema_subjects(["orders-value"]);
//! ```
pub
pub use ;
pub use SchemaRegistryError;
pub use SchemaEnforcement;
pub use default_subject;
pub use ;
pub use ;