Package com.aim2be.platform.schema
Class SchemaRegistryAutoConfiguration
java.lang.Object
com.aim2be.platform.schema.SchemaRegistryAutoConfiguration
@AutoConfiguration
@EnableConfigurationProperties(SchemaRegistryProperties.class)
@ConditionalOnProperty(prefix="im2be.schema-registry",
name="enabled",
havingValue="true")
public class SchemaRegistryAutoConfiguration
extends Object
Spring Boot auto-configuration for the apicurio-client module.
Activated when im2be.schema-registry.enabled=true. The mode
property selects exactly ONE SchemaRegistryClient bean:
mode=apicurio(default) →ApicurioSchemaRegistryClientmode=confluent→ConfluentWireCompatSchemaRegistryClientmode=dual→DualSchemaRegistryClient
The RegistryClient (Apicurio v2 REST client) is constructed
once and shared across whichever client variant is active. Consumers can
override the RegistryClient bean (e.g. to supply an authenticated
variant) — the @ConditionalOnMissingBean guard yields to user
overrides.
Registered via
META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionio.apicurio.registry.rest.client.RegistryClientBuilds the Apicurio v2 REST client targetingSchemaRegistryProperties.getUrl().apicurioSchemaRegistryClient(io.apicurio.registry.rest.client.RegistryClient client, SchemaRegistryProperties props, io.opentelemetry.api.OpenTelemetry openTelemetry) Primary path: Apicurio native 8-byte globalId prefix.confluentWireCompatSchemaRegistryClient(io.apicurio.registry.rest.client.RegistryClient client, SchemaRegistryProperties props, io.opentelemetry.api.OpenTelemetry openTelemetry) Confluent wire-format hedge: Apicurio storage backend + 4-byte schemaId prefix at the wire.dualSchemaRegistryClient(io.apicurio.registry.rest.client.RegistryClient client, SchemaRegistryProperties props, io.opentelemetry.api.OpenTelemetry openTelemetry) Dual coordinator: wire-format coexistence layer (DualSchemaRegistryClient).io.opentelemetry.api.OpenTelemetryFalls back to a no-op OpenTelemetry instance when the consuming app has none on the classpath; lets the client emit spans without forcing every consumer to wire OTel up first.
-
Constructor Details
-
SchemaRegistryAutoConfiguration
public SchemaRegistryAutoConfiguration()
-
-
Method Details
-
apicurioRegistryClient
@Bean @ConditionalOnMissingBean public io.apicurio.registry.rest.client.RegistryClient apicurioRegistryClient(SchemaRegistryProperties props) Builds the Apicurio v2 REST client targetingSchemaRegistryProperties.getUrl().@ConditionalOnMissingBeanlets consumers supply their own authenticatedRegistryClient(e.g. with OIDC bearer tokens).- Parameters:
props- bound properties; never null- Returns:
- the Apicurio REST client
-
schemaRegistryOpenTelemetry
@Bean @ConditionalOnMissingBean public io.opentelemetry.api.OpenTelemetry schemaRegistryOpenTelemetry()Falls back to a no-op OpenTelemetry instance when the consuming app has none on the classpath; lets the client emit spans without forcing every consumer to wire OTel up first.- Returns:
- a no-op
OpenTelemetry
-
apicurioSchemaRegistryClient
@Bean @ConditionalOnProperty(prefix="im2be.schema-registry", name="mode", havingValue="apicurio", matchIfMissing=true) public SchemaRegistryClient apicurioSchemaRegistryClient(io.apicurio.registry.rest.client.RegistryClient client, SchemaRegistryProperties props, io.opentelemetry.api.OpenTelemetry openTelemetry) Primary path: Apicurio native 8-byte globalId prefix. Default mode.- Parameters:
client- the Apicurio REST clientprops- configuration propertiesopenTelemetry- the OTel instance- Returns:
- the Apicurio implementation of
SchemaRegistryClient
-
confluentWireCompatSchemaRegistryClient
@Bean @ConditionalOnProperty(prefix="im2be.schema-registry", name="mode", havingValue="confluent") public SchemaRegistryClient confluentWireCompatSchemaRegistryClient(io.apicurio.registry.rest.client.RegistryClient client, SchemaRegistryProperties props, io.opentelemetry.api.OpenTelemetry openTelemetry) Confluent wire-format hedge: Apicurio storage backend + 4-byte schemaId prefix at the wire.- Parameters:
client- the Apicurio REST clientprops- configuration propertiesopenTelemetry- the OTel instance- Returns:
- the Confluent-wire-compat implementation
-
dualSchemaRegistryClient
@Bean @ConditionalOnProperty(prefix="im2be.schema-registry", name="mode", havingValue="dual") public SchemaRegistryClient dualSchemaRegistryClient(io.apicurio.registry.rest.client.RegistryClient client, SchemaRegistryProperties props, io.opentelemetry.api.OpenTelemetry openTelemetry) Dual coordinator: wire-format coexistence layer (DualSchemaRegistryClient). Both delegates wrap the SAMERegistryClient; the divergence is producer-side wire format (Apicurio 8-byte vs Confluent 4-byte). NOT an HA hedge — outages from the primary propagate (the fallback delegate shares the underlying registry endpoint). SeeDualSchemaRegistryClientclass Javadoc for the design rationale.- Parameters:
client- the Apicurio REST clientprops- configuration propertiesopenTelemetry- the OTel instance- Returns:
- the dual coordinator
-