Important Notice: CloudKarafka is shutting down. Read all about it in our End of Life Announcement

Java

To get started with Apache Kafka add the kafka-client dependency to your project.

<dependency>
  <groupId>org.apache.kafka</groupId>
  <artifactId>kafka-clients</artifactId>
  <version>1.0.0</version>
</dependency>

You can get all the connection variables you need from the provider you used to create the CloudKarafka instance.

Consumer example in Java

KafkaConsumer consumer = new KafkaConsumer<>(props);
consumer.subscribe(Arrays.asList(topic));
while (true) {
    ConsumerRecords records = consumer.poll(100);
    for (ConsumerRecord record : records)
        System.out.printf("msg = %s\n", record.value());
    }
}

The code example can be found here: https://github.com/CloudKarafka/java-kafka-example