Class KafkaConnectorServiceImpl
java.lang.Object
fr.codinbox.connector.commons.kafka.KafkaConnectorServiceImpl
- All Implemented Interfaces:
KafkaConnectorService
Default implementation of
KafkaConnectorService that discovers and manages
Kafka connections from environment variables.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionKafkaConnectorServiceImpl(@NotNull Logger logger) Creates a new Kafka connector service. -
Method Summary
-
Constructor Details
-
KafkaConnectorServiceImpl
Creates a new Kafka connector service.- Parameters:
logger- the logger for diagnostic messages
-
-
Method Details
-
init
Description copied from interface:KafkaConnectorServiceInitializes all Kafka connections discovered from environment variables.- Specified by:
initin interfaceKafkaConnectorService- Throws:
ConnectionInitException- if a connection with exit-on-failure enabled fails to initialize
-
shutdown
public void shutdown()Description copied from interface:KafkaConnectorServiceShuts down all managed Kafka connections, gracefully closing all tracked clients.- Specified by:
shutdownin interfaceKafkaConnectorService
-
getConnection
Description copied from interface:KafkaConnectorServiceRetrieves a Kafka connection by its identifier.- Specified by:
getConnectionin interfaceKafkaConnectorService- Parameters:
id- the connection identifier (case-sensitive, as extracted from environment variables)- Returns:
- an
Optionalcontaining the connection, or empty if no connection exists with that id
-