Skip to content

Commit

Permalink
fix(设备消息): 修复设备消息订阅报错 (#431)
Browse files Browse the repository at this point in the history
PropertyMessage类型没有默认的解码实现,已改为订阅ThingMessage
  • Loading branch information
kyouji authored Oct 26, 2023
1 parent 7746a59 commit 807f162
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.jetlinks.community.things.ThingConstants;
import org.jetlinks.core.event.EventBus;
import org.jetlinks.core.event.Subscription;
import org.jetlinks.core.message.ThingMessage;
import org.jetlinks.core.message.property.PropertyMessage;
import org.jetlinks.core.things.ThingId;
import org.jetlinks.core.things.ThingProperty;
Expand Down Expand Up @@ -173,14 +174,17 @@ public Updater(String thingType, String thingId) {
.broker()
.priority(Integer.MIN_VALUE)
.build(),
PropertyMessage.class
ThingMessage.class
)
.doOnNext(this::doUpdate)
.subscribe();
}

private void doUpdate(PropertyMessage message) {

private void doUpdate(ThingMessage thingMessage) {
if (!(thingMessage instanceof PropertyMessage)) {
return;
}
PropertyMessage message = (PropertyMessage) thingMessage;
try {
Map<String, Object> properties = message.getProperties();
if (properties == null) {
Expand Down

0 comments on commit 807f162

Please sign in to comment.