Class ApicurioConfigurator
- All Implemented Interfaces:
io.smallrye.reactive.messaging.ClientCustomizer<Map<String,,Object>> jakarta.enterprise.inject.spi.Prioritized
This class implements the ClientCustomizer interface to customize
Kafka producer and consumer configurations at runtime. It enforces consistent
Protobuf serialization/deserialization settings across all Kafka channels
and ensures proper integration with the Apicurio Registry.
Purpose
While the
invalid reference
ai.pipestream.kafka.connector.deployment.ProtobufKafkaProcessor
Configuration Applied
This configurator sets the following Kafka properties for all channels:
- Serializers/Deserializers: Forces Protobuf and UUID classes
- Apicurio Registry: URL, auto-registration, and schema lookup
- Return Class: Handled by build-time configuration (not here)
Thread Safety
This class is thread-safe as it only reads from injected configuration and modifies the provided configuration map. No mutable instance state is maintained between invocations.
Logging
Configuration changes are logged at DEBUG level, with sensitive values (passwords, secrets, tokens) automatically redacted in the logs.
- Since:
- 0.2.10
- See Also:
-
Field Summary
Fields inherited from interface io.smallrye.reactive.messaging.ClientCustomizer
CLIENT_CONFIG_CUSTOMIZER_DEFAULT_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.smallrye.reactive.messaging.ClientCustomizer
getPriority
-
Constructor Details
-
ApicurioConfigurator
public ApicurioConfigurator()
-
-
Method Details
-
customize
public Map<String,Object> customize(String channelName, org.eclipse.microprofile.config.Config channelConfig, Map<String, Object> kafkaConfig) Customizes Kafka client configuration for a specific channel.This method is called by SmallRye Reactive Messaging for each Kafka channel (both producers and consumers) to allow customization of the Kafka client properties. It enforces consistent Protobuf serialization and Apicurio Registry settings across all channels.
Configuration Strategy
The method applies a "sledgehammer" approach to ensure Protobuf serialization:
- Force Serializers: Explicitly sets Protobuf and UUID classes
- Apicurio Settings: Configures registry URL and auto-registration
- Return Class: Handled by build-time configuration (not here)
Why This Approach
SmallRye Reactive Messaging may default to Jackson serialization if it cannot determine the correct serializer. This configurator prevents that by explicitly setting the Protobuf serializers, ensuring consistent message processing.
- Specified by:
customizein interfaceio.smallrye.reactive.messaging.ClientCustomizer<Map<String,Object>> - Parameters:
channelName- The name of the messaging channel being configuredchannelConfig- The MicroProfile Config for this specific channelkafkaConfig- The mutable Kafka configuration map to customize- Returns:
- The modified kafkaConfig map (same instance, modified in-place)
- See Also:
-