This project written using golang with following the module:
git clone https://github.com/prastamaha/golang-kafka-example.git
cd kafka-riset
# Microservice1
cd microservice1
GOOS=linux GOARCH=amd64 go build -o ../bin/microservice1
# Microservice2
cd ../microservice2
GOOS=linux GOARCH=amd64 go build -o ../bin/microservice2
| Args | Default | Description |
|---|---|---|
| --kafka-address | localhost:9092 | [Address]:[Port] kafka listen |
| --kafka-topic | kafka-riset-topic | Topics to be written by producer |
| --listen | 0.0.0.0:9090 | [Address]:[Port] that will be listened to by the webservice |
| Args | Default | Description |
|---|---|---|
| --kafka-address | localhost:9092 | [Address]:[Port] kafka listen |
| --kafka-topic | kafka-riset-topic | Topics to be subcribe by consumer |
| --kafka-group | kafka-riset-group | Consumer group name |
| --mongo-addr | localhost:27017 | [Address]:[Port] Mongodb listen |
| --mongo-db | job | Mongodb target database |
| --mongo-col | ops | [Mongodb target database |
| --mongo-username | - | Mongodb password |
| --mongo-password | - | Mongodb username |
# Terminal 1
./bin/microservice1
# Terminal 2
./bin/microservice1
curl -X POST --data '{"name": "prasta maha","division": "project","position": "staff"}' http://localhost:9090/ops
Open postman with POST request to http://localhost:9090/ops (default addr)
Add body request with raw format and paste text below
{
"name": "prasta maha",
"division": "project",
"position": "staff"
}
