• UML describes structure before implementation • Observer notifies interested objects • Strategy changes behavior without changing a client • Java code should reflect the design Next: How do separate applications communicate? 03
application that publishes and/or subscribes • Topic: named message channel, e.g., example/toRead • Payload: data sent with a publication • Subscribe: express interest in a topic 10 08
Runnable: connects and publishes 10 messages per topic. Subscriber implements Runnable and MqttCallback: subscribes and handles incoming messages. MqttClient: library class supplied by Eclipse Paho. 12 10
• A set of MQTT client libr ries developed by the Eclipse Found tion. • It supports multiple l ngu ges, such s J v , Python, J v Script, etc. J v Dependency (M ven) a a a a a a a a a a a a a 15 a <dependency> <groupId>org.eclipse.paho</groupId> <artifactId>org.eclipse.paho.client.mqttv3</artifactId> <version>1.2.5</version> </dependency>
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. 18
Copyright. These slides may be used only as study material for CSC 5100 within the California State University system. They may not be distributed or used for any other purpose.