Connectors topology


Control how Lenses identifies your connectors in the Topology view. Catalog your connector types, set their icons, control how Lenses extracts the topics used by your connectors.

Lenses comes preconfigured for some of the popular connectors as well as the Stream Reactor connectors. If you see that Lenses doesn’t automatically identify your connector type then use the lenses.connectors.info setting to register it with Lenses.

Add a new HOCON object {} for every new Connector in your lenses.connectors.info list :

  lenses.connectors.info = [
      {
        class.name = "The connector full classpath"
        name = "The name which will be presented in the UI"
        instance = "Details about the instance. Contains the connector configuration field which holds the information. If  a database is involved it would be  the DB connection details, if it is a file it would be the file path, etc"
        sink = true
        extractor.class = "The full classpath for the implementation knowing how to extract the Kafka topics involved. This is only required for a Source"
        icon = "file.png"
        description = "A description for the connector"
        author = "The connector author"
      }
  ]

This configuration allows the connector to work with the topology graph, and also have the RBAC rules applied to it.

Source example 

To extract the topics information from the connector configuration, source connectors require an extra configuration. The extractor class should be: io.lenses.config.kafka.connect.SimpleTopicsExtractor. Using this extractor requires an extra property configuration. It specifies the field in the connector configuration which determines the topics data is sent to.

Here is an example for the file source:

  lenses.connectors.info = [
    {
      class.name = "org.apache.kafka.connect.file.FileStreamSource"
      name = "File"
      instance = "file"
      sink = false
      property = "topic"
      extractor.class = "io.lenses.config.kafka.connect.SimpleTopicsExtractor"
    }
  ]

Sink example 

And an example of a splunk sink connector and a debezium sql server connector

  lenses.connectors.info = [
    {
      class.name = "com.splunk.kafka.connect.SplunkSinkConnector"
      name = "Splunk Sink",
      instance = "splunk.hec.uri"
      sink = true,
      extractor.class = "io.lenses.config.kafka.connect.SimpleTopicsExtractor"
      icon = "splunk.png",
      description = "Stores Kafka data in Splunk"
      docs = "https://github.com/splunk/kafka-connect-splunk",
      author = "Splunk"
    },
    {
      class.name = "io.debezium.connector.sqlserver.SqlServerConnector"
      name = "CDC MySQL"
      instance = "database.hostname"
      sink = false,
      property = "database.history.kafka.topic"
      extractor.class = "io.lenses.config.kafka.connect.SimpleTopicsExtractor"
      icon = "debezium.png"
      description = "CDC data from RDBMS into Kafka"
      docs = "//debezium.io/docs/connectors/mysql/",
      author = "Debezium"
    }
  ]

Docker compose example 

Follow the configuration below for a Lenses setup via Docker compose. Here is an example for SplunkSinkConnector and debezium sql server connector. The two connectors are already covered, this is used for illustration purpose.

version: '3'
services:
  lenses:
    image: lensesio/lenses:latest
    container_name: lenses
    ...
    environment:
      ...
      LENSES_CONNECTORS_INFO: |
        [
            {
            class.name = "com.splunk.kafka.connect.SplunkSinkConnector"
            name = "Splunk Sink",
            instance = "splunk.hec.uri"
            sink = true,
            extractor.class = "io.lenses.config.kafka.connect.SimpleTopicsExtractor"
            icon = "splunk.png",
            description = "Stores Kafka data in Splunk"
            docs = "https://github.com/splunk/kafka-connect-splunk",
            author = "Splunk"
            },
            {
            class.name = "io.debezium.connector.sqlserver.SqlServerConnector"
            name = "CDC MySQL"
            instance = "database.hostname"
            sink = false,
            property = "database.history.kafka.topic"
            extractor.class = "io.lenses.config.kafka.connect.SimpleTopicsExtractor"
            icon = "debezium.png"
            description = "CDC data from RDBMS into Kafka"
            docs = "//debezium.io/docs/connectors/mysql/",
            author = "Debezium"
            }
        ]        
    ...

Option reference 

KeyDescriptionTypeDefault
class.nameThe connector full class name. i.e. org.apache.kafka.connect.file.FileStreamstring
nameThe name as it will appear in the topology view. For example: Filestring
instanceContains the connector configuration key(-s) the extractor instance will use to get the information. Consider the FTP source the value is set to connect.ftp.monitor.tail,connect.ftp.monitor.update. The extractor will get the result of both those fields and provide a list of involved topicsstring
extractor.classUsed only for Connect sources to extract the target topics from the connector runtime configuration.string
propertyThe connector configuration key which will contain the output topics. Used only for Connect sources.string
iconThe path to an icon file the UI will use to display the connector.string
descriptionA short sentence to say what the connector doesstring
authorWho is providing the connectorstring
--
Last modified: February 26, 2024