Click here to Skip to main content
15,878,543 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
By using the MQTT protocol implement in Java the Publisher - Subscriber parts of the
following application:
• Your application simulates a smart office environment, where sensors emit different
structural and air properties about the site.
In particular, you have one client (program) that publishes messages every second about
the room; like the floor/room/temperature (e.g 18 C) and the floor/room/humidity (e.g.
You also have another client (program) that publishes messages about the floor every
half second like; the floor/light/ID (e.g ON) and the floor/window/location (e.g.
Implement these 2 publishers and demonstrate the sending of messages on these topics
and subtopics. In your solution, for each client you can implement a loop that periodically
emits values/readings either randomly or from a list.

• You should also develop and run different subscribers (hint - copy and change the class
name and subscribe method in each case) that listens for messages on the following topics
and subtopics
• strictly messages related to a floor/room/temperature

• any messages that are related to room (including its subtopics)

• messages that are related to the floor for both light and window

• Finally, show and explain how you can facilitate disconnected clients?

Must include the screenshot of the code and output.

What I have tried:

i tried general google search for this problem but i didnt find any result for my problem.
Updated 21-Aug-22 22:08pm
Patrice T 21-Aug-22 14:18pm    
The programming job is not about always finding all cooked solutions on internet, but sometimes it is about creating custom solutions.
Dave Kreskowiak 21-Aug-22 14:25pm    
You're not going to find anything on this by searching for it. The entire point behind the assignment is to apply your ability to think about problems and write the code to solve them. It's NOT about your ability to Google for the code to hand in.

While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

You aren't going to find a complete solution you can hand in as your own work anywhere: this is a problem unique to your class and year.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
Share this answer
I have no idea what you searched for but Google as lots of information: MQTT protocol java - Google Search[^].
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900