© M. Zulfikar Isnaen, This is Under MIT License.
Open the CMD or Powershell. Check the version of docker-compose and make sure installed
docker-compose --version
Run the docker-compose script
docker-compose -f docker-compose-windows.yml up --build -d
./up.sh
./down.sh
Script must be have an access before executing
chmod 777 scripts/
Open 4 terminal, and run each command below
This command will listen on topic NATS/MQTT/Test/#
mqtt
# ssh to container
./ssh.sh "mosquitto"
# Subscribe message
/scripts/mqtt-sub.sh
# or using this instead mqtt-sub.sh
mosquitto_sub -h nats-server -p 1883 -t "NATS/MQTT/Test/#"
This command will listen on subject NATS.MQTT.Test/>
nats
# ssh to container
./ssh.sh "nats-box"
# Subscribe message
nats -s nats://nats-server sub "NATS.MQTT.Test.>"
You can execute this command several time
# ssh to container
./ssh.sh "nats-box"
# Publish message
nats -s nats://nats-server pub "NATS.MQTT.Test.>" "This is message from nats"
You can execute this script several time
# ssh to container
./ssh.sh "mosquitto"
# Publish message
/scripts/mqtt-pub.sh
#or using this instead mqtt-pub.sh
mosquitto_pub -h nats-server -p 1883 -t "NATS/MQTT/Test/" -m "This is message from mqtt"