Skip to content

Latest commit

 

History

History

custom-kafka-connector-adapter

Custom Kafka Connector Metadata Adapter

This project hosts a sample Gradle project you may use as a starting point to provide your implementation of the Kafka Connector Metadata Adapter class.

To customize, build, and deploy an adapter implementation, follow the steps:

Develop

Edit the CustomKafkaConnectorAdapter.java file by implementing the required hook methods or provide your completely new custom class that must extend com.lightstreamer.kafka.adapters.pub.KafkaConnectorMetadataAdapter.

Important

Add all required dependencies to the build.gradle file in the dependencies section.

Build

Build the project with the command:

$ ./gradlew build

which generates the build/libs/custom-kafka-connector-adapter.jar file.

Configure

Update the LS_HOME/adapters/lightstreamer-kafka-connector-<version>/adapters.xml file by editing the parameter adapter_class as follows:

...
<metadata_provider>
    ...
    <adapter_class>com.lightstreamer.kafka.examples.CustomKafkaConnectorAdapter</adapter_class>
    ...
</metadata_provider>
...

Deploy

Copy the generated jar file - along with all dependencies (if any) - under the LS_HOME/adapters/lightstreamer-kafka-connector-<version>/lib folder.

Start

Start Lighststreamer Server and verify that the console log shows something similar:

12.Mar.24 16:51:36,169 < INFO> Loading Metadata Adapter for Adapter Set KafkaConnector
...
###### Custom KafkaConnector Adapter initialized ######
12.Mar.24 16:51:36,256 < INFO> Finished loading Metadata Adapter for Adapter Set KafkaConnector
...