Showing posts with label Open-Source. Show all posts
Showing posts with label Open-Source. Show all posts

How to run Kafka Server with Producer and Consumer in Windows - Six steps Practical guide

In this post, we will learn that how to install and use Kafka server along with producer and consumer clients message exchange. This guide is based on practical only (no theory). For theory you can see other resources. This is the step by step practical guide that how to run Kafka on windows environment.

Step 1: Download and Extract Kafka in your desired directory:

1. Go to the link Apache Kakfa download and download. (I have download binary version 2.13)
2. Extract the .tgz file into any suitable location.




I have extracted my Kafka installation into C drive insdie Apachekafka Folder. 


Step 2: Install Java run-time and Save its path in environment variable.

1. Go to the link and install java runtime
2. After installation, open Environment variable from my computer properties and add JAVA_HOME variable and provide your java runtime installation path.

Java runtime installation path provided in a new environment variable named JAVA_HOME. 
3. In environment variable, select path, click on edit button and add this string  “;%JAVA_HOME%\bin”
4. Go to command line and test "java -version". If you are not getting java installed version then see

How to solve "npm not recognized as internal or external command"


Step 3: Run Apache Zookeeper and Kafka Server

1. Make a batch file next to your Kafka folder. This batch file will run Zookeeper server. Add below line and run the batch file

start kafka_2.13-2.4.1\bin\windows\zookeeper-server-start.bat kafka_2.13-2.4.1\config\zookeeper.properties

Note:In above batch file command, kafka_2.13-2.4.1 is my Kafka installation folder name put your folder name in both location.

2. Make a batch file for running the Kafka Server and Run the batch file

start kafka_2.13-2.4.1\bin\windows\kafka-server-start.bat kafka_2.13-2.4.1\config\server.properties

Note:In above batch file command, kafka_2.13-2.4.1 is my Kafka installation folder name put your folder name in both location.

Two batch files have created in order to run Zookeeper and Kafka Server. Whenever you want to run Kafka server, you first need to start zookeeper server.

Step 4: Create A Topic

In order to send message from Producer to consumer, you first need to create a topic. Later both producer and consumer will subscribe the topic and send and receive messages.

1. Go to Kafka installation directory, then Bin\Windows, and open command prompt form here and type below lines. You can write your desired name instead of YourTopicName
kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic YourTopicName
A topic with name "YourTopicName" has created successfully. 

Step 5: Start Producer

Kafka provides you message producer that will produce message for a specific topic.
1. Go to kafka installation directory, then Bin\Windows, and open command prompt form here and type below lines. 
kafka-console-producer.bat --broker-list localhost:9092 --topic TopicToSubscribe
Note: TopicToSubscribe is the topic name where you want to send messages, in our case it should be YourTopicName
2. Hit enter to start the producer

Step 6: Start Consumer

As name suggest consumer will get the messages from producer. 
1. Go to kafka installation directory, then Bin\Windows, and open command prompt form here and type below lines. 
kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic TopicToSubscribe
Note: TopicToSubscribe is the topic name from where you want to gete messages , in our case it should be YourTopicName
2. Hit enter to run the consumer
3. Now go to Producer command line, and type any message and enter
4. View the Consumer command line you will get the message.


3DWalker - 3D Environment explorer for Unity3d Projects

Unity3d is one of the most popular game-engine use for game development, simulation, training and architecture visualizations. In most 3D projects, specially related to architecture, simulation and training, we require feasible, friendly, effective and robust methods to navigate in the 3D environment. In unity, we use cameras for rendering and exploring 3D world and usually navigate camera in order to show or explore the 3D environment. Conventionally, we develop and use different kind of cameras like Fly camera, Walk camera, Orbit Camera, Point Camera etc. These camera are use to watch and navigate 3D projects.

There are plenty of paid and free solution available that provides easy ways to run your 3d projects with different cameras. But there is a general requirement to develop such a workspace (or working environment)  that help every newbie or expert unity developer to quickly set and play unity project. The workspace should be developed and form over some main principles like effective navigation systems, intuitive UI and run-time 3D object manipulation and multi language support. For this reason, I have just stared an open source project named 3DWalker at GitHub with these aims & objective. Obviously, the aim of 3DWalker is to improve user experience regarding 3D world navigation with bunch of other features like 3D environment manipulation at run-time. All Unity3d developers are allow to participate in this project so together we can provide better 3D experience to over end-users.