Kafka with Java: Build a Secure, Scalable Messaging App

Kafka with Java: Build a Secure, Scalable Messaging App

This tutorial shows you how to develop a Java application with Kafka and secure it with OAuth 2.0 and OIDC.

Alexander Furer

Great article, but Kafka is left unsecured. Securing web endpoints doesn’t prevent unsecured access to Kafka cluster.

Matt Raible

Good point. We’ll try to do better in our next Kafka tutorial.

Fuji Nafiul

But how to implement one to one or group chat ? and how can I reliably send messages with failure handling ?
little high level overview will be helpful <3

Sanmit Deshpande

Hi, my Consumer class in Java is not able to receive the messages. Hence my message list is empty. I have used JSON to post the data and a POJO(KafkaPayload) to store instead of a simple text/string. I’m able to post the data to Kafka topic via REST call.
However running the console_consumer shows the data posted to Kafka.

private final List<kafkapayload> messages = new ArrayList<>();
@KafkaListener(topics = “test_topic”, groupId = “kafka-sandbox”)
public void listener(KafkaPayload data) {
synchronized (messages){
messages.add(data);
}
}

Dnyaneshwar Jadhav

This blog is really helping me to setup spring + Kafka way faster than any other blogs.
How to send one to one private message among 10 users & Group messaging ?
How does kafka library support in scaling up multiple producer & consumers. across various topics & groups ?
thanks in advanced.
I am stuck in approach of One-To-One & One-To-Many messaging.

Matt Raible

Hello Dnyaneshwar,

I asked Tim Berglund for advice. He recommend you join the Confluent Community Slack to get this question answered. You can find a link on the Confluent Community site.

Matt Raible

Here’s an article that shows how to lock down Kafka too. https://developer.okta.com/…

Marcelo Avancini

Great article, Daniel. What a surprise to see you on my searches, but the quality of the material was totally expected.