https://github.com/wendylau87/warungpintar2021
this microservices for simulate orchestration saga transaction
- MySQL Database
- Postman
- kafkacat
apt-get install kafkacat
- Migrate database from folder masterscv/database/migrations/schema.sql
- Migrate database from folder inventoryscv/database/migrations/schema.sql
- Migrate database from folder transactionscv/database/migrations/schema.sql
- Open file .env at folder mastersvc
DB_DRIVER=mysql
DB_USER=${dbuser}
DB_PASSWORD=${dbpassword}
DB_HOST=${dbhostname}
DB_PORT=3306
DB_DATABASE=wp_master
- Change value for this parameter (for hostname,you can use your IP) :
- ${dbuser}
- ${dbpassword}
- ${dbhostname}
- Open file .env at folder transactionsvc
DB_DRIVER=mysql
DB_USER=${dbuser}
DB_PASSWORD=${dbpassword}
DB_HOST=${dbhostname}
DB_PORT=3306
DB_DATABASE=wp_transaction
KAFKA_HOST=${kafkahostname}
KAFKA_PORT=19092
KAFKA_NETWORK=tcp
KAFKA_TOPIC=inbound
KAFKA_PARTITION=0
- Change value for this parameter (for hostname,you can use your IP) :
- ${dbuser}
- ${dbpassword}
- ${dbhostname}
- ${kafkahostname}
- Open file .env at folder inventorysvc
DB_DRIVER=mysql
DB_USER=${dbuser}
DB_PASSWORD=${dbpassword}
DB_HOST=${dbhostname}
DB_PORT=3306
DB_DATABASE=wp_inventory
KAFKA_HOST=${kafkahostname}
KAFKA_PORT=19092
KAFKA_NETWORK=tcp
KAFKA_TOPIC=inbound
KAFKA_PARTITION=0
- Change value for this parameter (for hostname,you can use your IP) :
- ${dbuser}
- ${dbpassword}
- ${dbhostname}
- ${kafkahostname}
- ensure you have migrate all databases.
- ensure you have change the environment file.
- run command to build docker image
$ docker-compose build
- ensure all images have been build (mastersvc, transactionsvc, inventorysvc, zookeeper, kafka)
- run command to host all containers
$ docker-compose up -d
- ensure all service has been running
$ docker ps
- run this command for checking kafka is available
$ kafkacat -C -b ${kafkahostname}:19092 -t inbound -p 0
- open postman
- import postman file
WarungPintar2021.postman_collection.json
- execute postman
transactionsvc - Add inbound
- if success you can check the message at kafkacat and check the database wp_inventory table inventory the new record should be there.