Read the code.
- Open docker-compose.yml and replace
KAFKA_ADVERTISED_HOST_NAME
with your own local address - Install Docker
- Execute the command below to start kafka stack and the go application:
$ docker-compose up
On windows, if you get an error of An attempt was made to access a socket in a way forbidden by its access permissions
Solution:
- Stop Docker
- Open CMD with Administrator privileges and execute the following commands:
$ dism.exe /Online /Disable-Feature:Microsoft-Hyper-V
$ netsh int ipv4 add excludedportrange protocol=tcp startport=2181 numberofports=1
$ dism.exe /Online /Enable-Feature:Microsoft-Hyper-V /All
$ docker-compose up --build
Install & run Kafka and Zookeper locally and then:
go run main.go