@guidecx/node-kafka-client v1.0.4
@GuideCX/node-kafka-client
This is a kafka client built for Node.js and is intended to be consumed by GuideCX Node.js micro services.
Pre-Requisites
- Node.js LTS
- Docker (verify install with
docker -v
anddocker-compose -v
) - Git Bash (if Windows)
Getting Started
Run Git Bash as an administrator (if windows)
Start Kafka in docker
docker compose up
Docker will spin up a local Kafka and Zookeeper instance. Zookeeper is needed to communicate with Kafka. In order to get Kafka running correctly.
This will verify that the client is pointed to the correct broker. It also verifies that the broker is reachable via a Kafka UI tool.
Kafka Tool
In order to better visualize the topics, partitions, and data in Kafka, you can use Kafka Tool. In order to connect to your local Kafka instance, use the following steps.
- Run
export HOST_IP=$(ifconfig | grep -E "([0-9]{1,3}\.){3}[0-9]{1,3}" | grep -v 127.0.0.1 | awk '{ print $2 }' | cut -f2 -d: | head -n1)
docker-compose up
- Launch the Kafka Tool application
- You'll be prompted to purchase a work license. This isn't necessary so click
close
. - If not prompted to already create a new connection, click
Add New Collection
. - Name the cluster anything you'd like.
- The Zookeeper Host should be
localhost
- The Zookeeper Port should be the port assigned to Zookeeper in
docker-compose.yml
- Press
connect
This should connect you with Zookeeper which should automatically connect you with your local Kafka instance. In the scenario that your broker (Kafka instance) is not auto connecting/loading, do the following:
- Verify that your cluster's security settings specify that you're using
Plaintext
. - Verify that your broker's host is the HOST_IP you configured above. This can be verified by opening Docker Desktop, inspecting the Kafka service, and checking its ENV variables there.
Run Scripts
# get up and running for development
npm install
npm run test
Release New NPM Module
On master branch
npm version patch
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago