Skip to content

Commit e14223a

Browse files
committed
Release of version 1.0.1
1 parent 683ad63 commit e14223a

File tree

7 files changed

+55
-31
lines changed

7 files changed

+55
-31
lines changed

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ of your Maven project.
7676
<dependency>
7777
<groupId>com.amazonaws</groupId>
7878
<artifactId>aws-iot-device-sdk-java</artifactId>
79-
<version>1.0.0</version>
79+
<version>1.0.1</version>
8080
</dependency>
8181
</dependencies>
8282
```
@@ -88,7 +88,7 @@ The sample applications included with the SDK can also be installed using the fo
8888
<dependency>
8989
<groupId>com.amazonaws</groupId>
9090
<artifactId>aws-iot-device-sdk-java-samples</artifactId>
91-
<version>1.0.0</version>
91+
<version>1.0.1</version>
9292
</dependency>
9393
</dependencies>
9494
```
@@ -101,9 +101,7 @@ include them to your library build path.
101101
You will also need to add two libraries the SDK depends on:
102102

103103
* Jackson 2.x, including Jackson-core and Jackson-databind. [download instructions][jackson-download]
104-
* Paho MQTT client for Java 1.0.x. [download instructions][paho-mqtt-java-download]
105-
(Note: If you plan to use MQTT over WebSocket connections, use its development branch or snapshot builds here
106-
https://repo.eclipse.org/content/repositories/paho-snapshots/.)
104+
* Paho MQTT client for Java 1.1.x. [download instructions][paho-mqtt-java-download]
107105

108106
### Build the SDK from the GitHub Source
109107
You can build both the SDK and its sample applications from the source

aws-iot-device-sdk-java-samples/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
<parent>
44
<groupId>com.amazonaws</groupId>
55
<artifactId>aws-iot-device-sdk-java-pom</artifactId>
6-
<version>1.0.0</version>
6+
<version>1.0.1</version>
77
</parent>
88
<artifactId>aws-iot-device-sdk-java-samples</artifactId>
99
<dependencies>
1010
<dependency>
1111
<groupId>com.amazonaws</groupId>
1212
<artifactId>aws-iot-device-sdk-java</artifactId>
13-
<version>1.0.0</version>
13+
<version>1.0.1</version>
1414
</dependency>
1515
</dependencies>
1616
<build>

aws-iot-device-sdk-java-samples/samples-pom.xml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<modelVersion>4.0.0</modelVersion>
33
<groupId>com.amazonaws</groupId>
44
<artifactId>aws-iot-device-sdk-java-samples</artifactId>
5-
<version>1.0.0</version>
5+
<version>1.0.1</version>
66
<dependencies>
77
<dependency>
88
<groupId>org.apache.maven.plugins</groupId>
@@ -12,7 +12,7 @@
1212
<dependency>
1313
<groupId>com.amazonaws</groupId>
1414
<artifactId>aws-iot-device-sdk-java</artifactId>
15-
<version>1.0.0</version>
15+
<version>1.0.1</version>
1616
</dependency>
1717
<dependency>
1818
<groupId>com.fasterxml.jackson.core</groupId>
@@ -24,11 +24,6 @@
2424
<artifactId>jackson-databind</artifactId>
2525
<version>2.7.4</version>
2626
</dependency>
27-
<dependency>
28-
<groupId>org.eclipse.paho</groupId>
29-
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
30-
<version>[1.0.2,)</version>
31-
</dependency>
3227
</dependencies>
3328
<build>
3429
<plugins>

aws-iot-device-sdk-java/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<groupId>com.amazonaws</groupId>
55
<artifactId>aws-iot-device-sdk-java-pom</artifactId>
6-
<version>1.0.0</version>
6+
<version>1.0.1</version>
77
</parent>
88
<artifactId>aws-iot-device-sdk-java</artifactId>
99
<dependencies>
@@ -38,7 +38,7 @@
3838
<dependency>
3939
<groupId>org.eclipse.paho</groupId>
4040
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
41-
<version>[1.0.2,)</version>
41+
<version>[1.1.0,)</version>
4242
</dependency>
4343
</dependencies>
4444
<build>

aws-iot-device-sdk-java/src/main/java/com/amazonaws/services/iot/client/core/AbstractAwsIotClient.java

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -279,12 +279,49 @@ public void unsubscribe(AWSIotTopic topic, long timeout) throws AWSIotException
279279
}
280280
}
281281

282-
public void dispatch(AWSIotMessage message) {
283-
AWSIotTopic topic = subscriptions.get(message.getTopic());
284-
if (topic != null) {
285-
topic.onMessage(message);
286-
} else {
287-
LOGGER.warning("Unexpected message received from topic " + message.getTopic());
282+
public boolean topicFilterMatch(String topicFilter, String topic) {
283+
if (topicFilter == null || topic == null) {
284+
return false;
285+
}
286+
287+
String[] filterTokens = topicFilter.split("/");
288+
String[] topicTokens = topic.split("/");
289+
if (filterTokens.length > topicTokens.length) {
290+
return false;
291+
}
292+
293+
for (int i = 0; i < filterTokens.length; i++) {
294+
if (filterTokens[i].equals("#")) {
295+
// '#' must be the last character
296+
return ((i + 1) == filterTokens.length);
297+
}
298+
299+
if (!(filterTokens[i].equals(topicTokens[i]) || filterTokens[i].equals("+"))) {
300+
return false;
301+
}
302+
}
303+
304+
return (filterTokens.length == topicTokens.length);
305+
}
306+
307+
public void dispatch(final AWSIotMessage message) {
308+
boolean matches = false;
309+
310+
for (String topicFilter : subscriptions.keySet()) {
311+
if (topicFilterMatch(topicFilter, message.getTopic())) {
312+
final AWSIotTopic topic = subscriptions.get(topicFilter);
313+
scheduleTask(new Runnable() {
314+
@Override
315+
public void run() {
316+
topic.onMessage(message);
317+
}
318+
});
319+
matches = true;
320+
}
321+
}
322+
323+
if (!matches) {
324+
LOGGER.warning("Unexpected message received from topic " + message.getTopic());
288325
}
289326
}
290327

aws-iot-device-sdk-java/src/main/java/com/amazonaws/services/iot/client/mqtt/AwsIotMqttClientListener.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,8 @@ public void deliveryComplete(IMqttDeliveryToken arg0) {
5252

5353
@Override
5454
public void messageArrived(String topic, MqttMessage arg1) throws Exception {
55-
final AWSIotMessage message = new AWSIotMessage(topic, AWSIotQos.valueOf(arg1.getQos()), arg1.getPayload());
56-
57-
client.scheduleTask(new Runnable() {
58-
@Override
59-
public void run() {
60-
client.dispatch(message);
61-
}
62-
});
55+
AWSIotMessage message = new AWSIotMessage(topic, AWSIotQos.valueOf(arg1.getQos()), arg1.getPayload());
56+
client.dispatch(message);
6357
}
6458

6559
}

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>com.amazonaws</groupId>
44
<artifactId>aws-iot-device-sdk-java-pom</artifactId>
5-
<version>1.0.0</version>
5+
<version>1.0.1</version>
66
<packaging>pom</packaging>
77
<name>AWS IoT Device SDK for Java</name>
88
<description>The AWS IoT Device SDK for Java provides Java APIs for devices to connect to AWS IoT service using the MQTT protocol. The SDK also provides support for AWS IoT specific features, such as Thing Shadow and Thing Shadow abstraction.</description>

0 commit comments

Comments
 (0)