realize solve problems for issue for with saving last ts

This commit is contained in:
van-vanich 2021-12-30 17:48:51 +02:00
parent 530765487c
commit ff56e0e622
2 changed files with 4 additions and 2 deletions

View File

@ -49,7 +49,7 @@ import java.util.concurrent.TimeUnit;
"Timestamp in milliseconds will be taken from metadata.ts, otherwise 'now' timestamp will be applied. " + "Timestamp in milliseconds will be taken from metadata.ts, otherwise 'now' timestamp will be applied. " +
"Allows stopping updating values for incoming keys in the latest ts_kv table if 'skipLatestPersistence' is set to true.", "Allows stopping updating values for incoming keys in the latest ts_kv table if 'skipLatestPersistence' is set to true.",
uiResources = {"static/rulenode/rulenode-core-config.js"}, uiResources = {"static/rulenode/rulenode-core-config.js"},
configDirective = "tbActionNodeTimeseriesConfig", configDirective = "tbActionNodeTimeseriesConfig!",
icon = "file_upload" icon = "file_upload"
) )
public class TbMsgTimeseriesNode implements TbNode { public class TbMsgTimeseriesNode implements TbNode {
@ -77,7 +77,7 @@ public class TbMsgTimeseriesNode implements TbNode {
ctx.tellFailure(msg, new IllegalArgumentException("Unsupported msg type: " + msg.getType())); ctx.tellFailure(msg, new IllegalArgumentException("Unsupported msg type: " + msg.getType()));
return; return;
} }
long ts = getTs(msg); long ts = config.isSaveWithMsgTs() ? msg.getTs() : getTs(msg);
String src = msg.getData(); String src = msg.getData();
Map<Long, List<KvEntry>> tsKvMap = JsonConverter.convertToTelemetry(new JsonParser().parse(src), ts); Map<Long, List<KvEntry>> tsKvMap = JsonConverter.convertToTelemetry(new JsonParser().parse(src), ts);
if (tsKvMap.isEmpty()) { if (tsKvMap.isEmpty()) {

View File

@ -23,12 +23,14 @@ public class TbMsgTimeseriesNodeConfiguration implements NodeConfiguration<TbMsg
private long defaultTTL; private long defaultTTL;
private boolean skipLatestPersistence; private boolean skipLatestPersistence;
private boolean saveWithMsgTs;
@Override @Override
public TbMsgTimeseriesNodeConfiguration defaultConfiguration() { public TbMsgTimeseriesNodeConfiguration defaultConfiguration() {
TbMsgTimeseriesNodeConfiguration configuration = new TbMsgTimeseriesNodeConfiguration(); TbMsgTimeseriesNodeConfiguration configuration = new TbMsgTimeseriesNodeConfiguration();
configuration.setDefaultTTL(0L); configuration.setDefaultTTL(0L);
configuration.setSkipLatestPersistence(false); configuration.setSkipLatestPersistence(false);
configuration.setSkipLatestPersistence(false);
return configuration; return configuration;
} }
} }