This Project is composed of 3 services, communicating with Kafka:
A simple API (nodeJS) exposing only one endpoint: POST api/message on port 4242. The message (body of the http request) is sent to kafka on a topic T.
- Stack: nodeJS, express, kafka-node,
Kafka process the message and send it to the consumers (3️⃣ and 4️⃣)
- Stack: Docker/Docker-Compose, kafka, zookeeper
The service consumes messages of topic T from Kafka. Using Slack's API it sends any incoming message to #random on kafkamessagingpe Team.
- Stack: nodeJS, kafka-node, slack-node
The service also consumes messages of topic T from Kafka It sends an email for any incoming message. To avoid spaming with a true address, we use maildev as a local email service to see the previews.
MailDev adress: http://localhost:1080/#/
- Stack: nodeJS, kafka-node, mailDev, nodemailer, bluebird
- docker-compose : install docker-compose https://docs.docker.com/compose/install/
- Slack Channel: https://join.slack.com/t/kafkamessagingpe/shared_invite/enQtMzE2MDE0NTUwMjQwLTcyNTYxYzRmNTAyOWVmNmI2NTcyZTE5ZDI1NTljNTY1YTQzYWZmYWJjNWRiMTE2YTNkZDNkZjQzN2M5YWVmNzM
- curl or Postman: https://www.getpostman.com/
Start the project
docker-compose up -d
Stop the project
docker-compose down
ex: Start with 3 kafka Instances
docker-compose up -d --scale kafka=3
Send a message to the front API
curl -X POST -H "Content-Type: text/plain" --data 'This is a message' 127.0.0.1:4242/api/message
The message will be posted on Slack #random and MailDev http://localhost:1080/#/
To enable/desable logs, remove or specify the DEBUG env variable of docker-compose.yml for each container
#Full logs
environment:
DEBUG=*
#Api logs
environment:
- DEBUG=*Api*
Sat, 17 Feb 2018 16:53:27 GMT Api:modules:router Initialize router
Sat, 17 Feb 2018 16:53:27 GMT Api:modules:router Load router
Sat, 17 Feb 2018 16:53:27 GMT Api:modules:configurer Initialize configurer
Sat, 17 Feb 2018 16:53:27 GMT Api:config:logger Use Morgan to log requests with level: dev
Sat, 17 Feb 2018 16:53:29 GMT Api:config:kafka Loading kafka...
Sat, 17 Feb 2018 16:53:29 GMT Api:modules:router Use configurer
Sat, 17 Feb 2018 16:53:29 GMT Api:config:routes Initialize project with routes
{ 'POST /api/message': { loadFile: 'routes/api/message' } }
Sat, 17 Feb 2018 16:53:29 GMT Api:modules:router Router listen to port 4343
Sat, 17 Feb 2018 16:53:30 GMT Api:config:kafka Kafka producer ready
Local:
docker-compose up
cd front-api
npm install
npm run test
With docker-compose:
docker-compose up -d
docker-compose -f docker-compose.test.yml up tests
- Accept form-data message to send files using Local or BucketStorage.
- Add other platforms, Discord/Telegram
- Log errors in a Monitoring DashBoard
=]