How to use Kafka in NodeJs

Create a folder KafkaNodeJs Run npm init command from inside the folder and answer the few question like author, license, etc… once done, package.json file will be created in our folder. create a new file index.js we will use kafkajs library. open command prompt and run npm install kafkajs open index.js file and type below program const { Kafka, PartitionAssigners: { roundRobin } } = require("kafkajs"); const kafka = new Kafka({ clientId: 'my-app', brokers: ["localhost:9092"] }); const consumer = kafka....

December 24, 2019 · 1 min · 127 words · M.Kumaran

How to use Kafka as a load balancer for a topic

This is continuation of my Kafka series. Please read my previous article. Running multiple Kafka consumer with one producer in C# To consume a topic from multiple consumer we need to create that much partition for a topic. for example: If we need 3 consumers to consume a topic as a load balancer then we have to create minimum 3 partition for that topic. Create Admin project to create partition Create a new Admin project, add a button then include below program....

December 23, 2019 · 4 min · 775 words · M.Kumaran

How to use Apache kafka in C#

In this article I will explain how to use kafka in C#. Ensure that you already installed kafka for windows else check my previous article Install Apache Kafka in Windows 10 We are going to use Confluent Kafka library. Setting up Projects in visual studio Create an empty project in .NET Delete empty project and keep only the solution Add new project Create new Kafka producer project Add NuGet packages Right click project –> Manage NuGet packages...

December 22, 2019 · 4 min · 713 words · M.Kumaran

Install Apache Kafka in Windows 10

Required software to download Download below software Java runtime environment. We need oracle account to download. Zookeeper Extract the content into folder C:\kafka\apache-zookeeper-3.5.6-bin. (There are tow files in download location, download the bin file.) Kafka Extract into C:\kafka\kafka_2.12-2.3.1 Install - Java SE Runtime Environment 8 click install to start installing Set Java home variable Control panel –> System settings Advanced system settings Environment variables Add new Give variable name as JAVA_HOME and vale as the JRE installed location path....

December 21, 2019 · 2 min · 337 words · M.Kumaran