Skip to content

cristianslv/mqtt-basics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MQTT Basics

This project is intended to show the basic usage of Mosquitto, an Eclipse Message Broker, through Docker and Java.

I also created a RMI Client and Server example, due to a college work (distributed systems) which I will have to integrate this two resources.

Installation

These are some of the tools you're going to need in order to run this project:

  maven
  docker
  java 11
  docker-compose (or docker compose)

Usage

This command will run the mqtt-broker + mqtt-sub + mqtt-pub. The terminal will be attached with the docker compose logs, and mqtt-sub will log every message that comes into mqtt-topic.

docker compose up --build

After that, you might want to see everything working. Just run this command in another terminal to publish a message into mqtt-topic defined into docker-compose.yaml.

docker compose run mqtt-pub sh -c "mosquitto_pub -h mqtt-broker -t mqtt-topic -m 'Hello World'"

It basically runs a container with the command inside the commas. You should see the message "Hello World" in the terminal where you ran the first docker compose command.

To publish a message into mqtt-topic from this Java project, you just have to open it inside your IDE, run maven dependencies and then run the project.

Contributions

If you have any contributions to make, feel free to open an issue or PR.

References

License

MIT

About

Basic usage of MQTT with Docker and Java

Resources

License

Stars

1 star

Watchers

2 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages