Getting Started with Apache Kafka in Node.js - Running the below command starts a broker on port 9092. bin/kafka-server-start.sh config/server.properties. Kafka events are broken up into topics. Kafka is a powerful distributed pub/sub platform that is popular in large organizations.
Apache Kafka is a popular platform for streaming and pub/sub. It is very common at large companies with massive engineering teams, and less common at smaller companies. That is because, unlike many other alternatives in the message queue space, Kafka focuses on being a high performance write log without strictly enforcing message receipt. In other words, Kafka is less of a traditional message queue and more like a distributed event emitter, which is great for cases where you may have dozens of different services looking at a particular message.
Here's how you can get started working with Kafka in Node.js.
First, you need to set up Kafka locally. There are also cloud services for Kafka if you prefer that approach.
Kafka requires you to have Java 8+ installed on your machine. On Ubuntu, you can just run
sudo apt-get install default-jdk. For other operating systems, you can download a JDK from Oracle.
Once you've installed a JDK, you can then download Kafka using curl.
curl -Ol https://downloads.apache.org/kafka/2.7.0/kafka_2.13-2.7.0.tgz
Then, extract Kafka using
tar -zxvf kafka_2.13-2.7.0.tgz && cd kafka_2.13-2.7.0.
Kafka still requires Zookeeper, so you need to run 2 services simultaneously to run Kafka. First, start Zookeeper:
Once Zookeeper is running, you can start the Kafka broker. A broker is the service responsible for storing messages and allowing clients to read messages. Zookeeper is responsible for helping brokers coordinate with other brokers. Running the below command starts a broker on port 9092.
Hire dedicated Node JS developers & programmers in India for custom full-stack NodeJS web development projects on hourly/full-time basis. Strict NDA, 16+ years exp & 2500+ clients|450+ Experts
Get business-centric Node.Js development services from expert Node.JS developers. We have expertise in developing & maintaining Node JS apps as per the business requirements.
SISGAIN is the top rated node js development company providing professional services on node js web and mobile development.
Get Node.js developers & programmers, and dedicated Node coders in India with average 5 years of experience. 15+ Yrs Exp, 500+ Staff, 13800+ Projects, 6800+ Clients.
Looking to hire Node js developers? One of the top Node js development companies in India & USA offers cost-effective Node js web development services.