Skip to content

Commit d1e3a61

Browse files
committed
Fixed the timeout issue
1 parent 3a7e010 commit d1e3a61

File tree

4 files changed

+218
-227
lines changed

4 files changed

+218
-227
lines changed

README.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ You can either download the zip file from the releases on Github [here](https://
1717
<dependency>
1818
<groupId>ltg</groupId>
1919
<artifactId>simple-java-mqtt-client</artifactId>
20-
<version>1.0.0</version>
20+
<version>1.0.2</version>
2121
</dependency>
2222
</dependencies>
2323
...
@@ -31,29 +31,29 @@ import ltg.commons.SimpleMQTTClient;
3131
public class MQTTClientDemo {
3232

3333
public static void main(String[] args) {
34-
// Create a new client and connect to a broker
35-
SimpleMQTTClient sc = new SimpleMQTTClient("localhost", "test-bot");
34+
// Create a new client and connect to a broker
35+
SimpleMQTTClient sc = new SimpleMQTTClient("localhost");
3636

37-
// Subscribe to a channel and register a callback for it
38-
sc.subscribe("myChannel", new MessageListener() {
39-
@Override
40-
public void processMessage(String message) {
41-
System.out.println(message);
42-
}
43-
});
37+
// Subscribe to a channel and register a callback for it
38+
sc.subscribe("myChannel", new MessageListener() {
39+
@Override
40+
public void processMessage(String message) {
41+
System.out.println(message);
42+
}
43+
});
4444

45-
// Do something...
45+
// Publish to a channel
46+
sc.publish("myOtherChannel", "A message from me");
4647

47-
// Publish to a channel
48-
sc.publish("myOtherChannel", "A message from me");
49-
50-
// Do something else...
51-
52-
// Unsubscribe from a channel
53-
sc.unsubscribe("myChannel");
48+
// Unsubscribe from a channel
49+
sc.unsubscribe("myChannel");
5450

5551
// Disconnect from broker
5652
sc.disconnect();
53+
54+
// Do something else or the client will die...
55+
// while (!Thread.currentThread().isInterrupted()) {
56+
// }
5757
}
5858
}
5959

@@ -62,5 +62,5 @@ public class MQTTClientDemo {
6262
For a complete example see `MQTTClientDemo.java` in `ltg.commons.examples`.
6363

6464
# Important note
65-
This library is based off of a fixed version of the [Eclipse Paho java library](http://www.eclipse.org/paho/clients/java/). Hopefully they will fix their broken Maven repo and release system one day.
65+
This library is based off of the [fusesource mqtt library ](https://github.com/fusesource/mqtt-client).
6666

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<modelVersion>4.0.0</modelVersion>
33
<groupId>ltg</groupId>
44
<artifactId>simple-java-mqtt-client</artifactId>
5-
<version>1.0.1</version>
5+
<version>1.0.2</version>
66
<name>Simple MQTT client for Java</name>
77

88
<properties>

0 commit comments

Comments
 (0)