Reverted constant metadata, refactored update for device session context and metadata creation

This commit is contained in:
imbeacon 2023-08-16 17:21:48 +03:00
parent ababd11a5d
commit 45abd22b72
2 changed files with 6 additions and 3 deletions

View File

@ -137,7 +137,6 @@ public class MqttTransportHandler extends ChannelInboundHandlerAdapter implement
private static final MqttQoS MAX_SUPPORTED_QOS_LVL = AT_LEAST_ONCE;
private final UUID sessionId;
private final TbMsgMetaData msgMetaData = new TbMsgMetaData();
protected final MqttTransportContext context;
private final TransportService transportService;
@ -538,9 +537,12 @@ public class MqttTransportHandler extends ChannelInboundHandlerAdapter implement
private TbMsgMetaData getMetadata(DeviceSessionCtx ctx, String topicName) {
if (ctx.isDeviceProfileMqttTransportType()) {
msgMetaData.putValue(DataConstants.MQTT_TOPIC, topicName);
TbMsgMetaData md = new TbMsgMetaData();
md.putValue(DataConstants.MQTT_TOPIC, topicName);
return md;
} else {
return null;
}
return msgMetaData;
}
private void sendAckOrCloseSession(ChannelHandlerContext ctx, String topicName, int msgId) {

View File

@ -184,6 +184,7 @@ public class DeviceSessionCtx extends MqttDeviceAwareSessionContext {
telemetryTopicFilter = MqttTopicFilterFactory.getDefaultTelemetryFilter();
attributesPublishTopicFilter = MqttTopicFilterFactory.getDefaultAttributesFilter();
payloadType = TransportPayloadType.JSON;
deviceProfileMqttTransportType = false;
sendAckOnValidationException = false;
}
updateAdaptor();