Share
Embed
CSC307_L17_mqtt.pdf
Javier Gonzalez-Sanchez PRO
May 22, 2026
Transcript
13 slides
-
Dr. Javier Gonzalez-Sanchez [email protected] www.javiergs.info o ffi ce: 14 -227
CSC 307 Introduction to Software Engineering Lecture 12. Message Queuing -
MQTT Wh a t is MQTT? • MQTT (Mess a
ge Queuing Telemetry Tr a nsport) is a lightweight, publish-subscribe network protocol. • Designed for constr a ined devices a nd low-b a ndwidth, high-l a tency, or unreli a ble networks. Key Fe a tures • Simple a nd e a sy to implement. • Low b a ndwidth consumption. • Reli a ble mess a ge delivery. • Sc a l a ble to millions of devices. 4 -
Eclipse Paho for Java Wh a t is Eclipse P
a ho? • A set of MQTT client libr a ries developed by the Eclipse Found a tion. • It supports multiple l a ngu a ges, such a s J a v a , Python, J a v a Script, etc. J a v a Dependency (M a ven) <dependency> <groupId>org.eclipse.paho</groupId> <artifactId>org.eclipse.paho.client.mqttv3</artifactId> <version>1.2.5</version> </dependency> 5 -
Quality-of-service options • 0 – "at most once": A.K.A. "fire-and-forget."
This option is suitable when message loss is acceptable, as it doesn't require acknowledgment or persistence. • 1 – "at least once": This option should be chosen when message loss is unacceptable, and your subscribers can handle duplicate messages. • 2 – "Exactly once": This option is ideal when message loss is unacceptable, and your subscribers cannot handle duplicate messages. 7 -
Summary • MQTT: Lightweight, e ff i cient protocol for
IoT and other use cases. • Mosquitto: A popular open-source MQTT broker. • Eclipse Paho: A versatile MQTT client library. • Java Example: https://github.com/CSC3100/MQTT 9 -
Challenge 12 * Could you create an MQTT version for
the CLICK AND DRAW A DOT app? (yes, it is basically joining the two source codes) * Could it be possible to have it BI-DIRECTIONAL? -
CSC 307 Introduction to Software Engineering Javier Gonzalez-Sanchez, Ph.D. [email protected]
Summer 2024 Copyright. These slides can only be used as study material for the class CSC307 at Cal Poly. They cannot be distributed or used for another purpose.