Skip to content

Latest commit

 

History

History
72 lines (60 loc) · 3.02 KB

File metadata and controls

72 lines (60 loc) · 3.02 KB

Quick Start with Confluent Cloud

This folder contains a variant of the Quick Start SSL app configured to use Confluent Cloud as the target Kafka cluster.

The docker-compose.yml file has been revised to realize the integration with Confluent Cloud as follows:

  • removal of the broker service, because replaced by the remote Kafka cluster

  • kafka-connector:

    • definition of new environment variables to configure remote endpoint, credentials, and topic name in the adapters.xml through the variable-expansion feature of Lightstreamer:
      ...
      environment:
        - bootstrap_server=${bootstrap_server}
        - api_key=${api_key}
        - secret=${secret}
          # adapters.xml uses env variable "topic_mapping", built from env variable "topic"
        - topic_mapping=map.${topic}.to
      ...
    • adaption of adapters.xml to include:
      • new Kafka cluster address retrieved from the environment variable bootstrap_server:

        <param name="bootstrap.servers">$env.bootstrap_server</param>
      • encryption settings:

        <param name="encryption.enable">true</param>
        <param name="encryption.protocol">TLSv1.2</param>
        <param name="encryption.hostname.verification.enable">true</param>
      • authentication settings, with the credentials retrieved from environment variables api_key and secret:

        <param name="authentication.enable">true</param>
        <param name="authentication.mechanism">PLAIN</param>
        <param name="authentication.username">$env.api_key</param>
        <param name="authentication.password">$env.secret</param>
      • parameter map.<topic>.to built from env variable topic_mapping, composed from env variable topic

        <param name="$env.topic_mapping">item-template.stock</param>
  • producer:

    • parameter --boostrap-servers retrieved from the environment variable bootstrap_server
    • parameter --topic retrieved from the environment variable topic
    • provisioning of the producer.properties configuration file to enable SASL/PLAN over TLS, with username and password retrieved from the environment variables api_key and secret:
    # Configure SASL/PLAIN mechanism
    sasl.mechanism=PLAIN
    # Enable SSL encryption
    security.protocol=SASL_SSL
    # JAAS configuration
    sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="${api_key}" password="${secret}";

Run

From this directory, run follow the command:

$ bootstrap_server=<bootstrap_server> api_key=<API.key> secret=<secret> topic=<topic> ./start.sh 

where:

  • bootstrap_server is the Kafla cluster address
  • API.key and secret are the credentials generated on the Confluent CLI or from the Confluent Cloud Console
  • topic is the name of the topic

Then, point your browser to http://localhost:8080/QuickStart.