File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
src/main/java/info/unterrainer/commons/mqttclient Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 15
15
16
16
<modelVersion >4.0.0</modelVersion >
17
17
<artifactId >mqtt-client</artifactId >
18
- <version >0.1.10 </version >
18
+ <version >0.1.11 </version >
19
19
<name >MqttClient</name >
20
20
<packaging >jar</packaging >
21
21
Original file line number Diff line number Diff line change @@ -19,8 +19,19 @@ public void updateDifferentialSubscriptionsOnClient() {
19
19
Map <U , T > oldMap = getOldMap ();
20
20
Map <U , T > newMap = getCurrentMap ();
21
21
SetIntersection <U > intersection = SetIntersection .of (oldMap .keySet (), newMap .keySet ());
22
+ // Deleted subscriptions.
22
23
for (U id : intersection .getDelete ())
23
24
client .unsubscribe (oldMap .get (id ).getTopic ());
25
+ // Changes in existing subscriptions.
26
+ for (U id : intersection .getLeave ()) {
27
+ T oldSub = oldMap .get (id );
28
+ T newSub = newMap .get (id );
29
+ if (!oldSub .getTopic ().equals (newSub .getTopic ()) || oldSub .getType () != newSub .getType ()) {
30
+ client .unsubscribe (oldSub .getTopic ());
31
+ client .subscribe (newSub .getTopic (), newSub .getType (), newSub .getSetter ());
32
+ }
33
+ }
34
+ // New subscriptions.
24
35
for (U id : intersection .getCreate ()) {
25
36
T subscription = newMap .get (id );
26
37
client .subscribe (subscription .getTopic (), subscription .getType (), subscription .getSetter ());
You can’t perform that action at this time.
0 commit comments