Commit 4670bb4c authored by huangcb's avatar huangcb

调整生成Topic代码

parent c54b9127
......@@ -14,13 +14,11 @@ import org.springframework.stereotype.Service;
@RefreshScope
public class InstanceTopicServiceImpl extends ServiceImpl<InstanceTopicDao, InstanceTopicEntity> implements InstanceTopicService {
@Value("${mqtt.topic.instance.data-upload}")
private String instanceDataUploadTopic;
private static final String TOPIC_PREFIX = "$esv/iot/";
@Override
public void insertTopic(Long modelId, Long instanceId) {
String topic = instanceDataUploadTopic.replaceFirst("[model_id]", String.valueOf(modelId))
.replaceFirst("[instance_id]", String.valueOf(instanceId));
String topic = TOPIC_PREFIX + modelId + "/" + instanceId + "/data/upload";
InstanceTopicEntity entity = new InstanceTopicEntity();
entity.setModelId(modelId);
entity.setInstanceId(instanceId);
......
......@@ -85,8 +85,4 @@ timescale:
max-lifetime: 0
table-field:
map: string-text,number-numeric,boolean-bit(1)
table-prefix: iot_model_
mqtt:
topic:
instance:
data-upload: $esv/iot/[model_id]/[instance_id]/data/upload
\ No newline at end of file
table-prefix: iot_model_
\ No newline at end of file
......@@ -85,8 +85,4 @@ timescale:
max-lifetime: 0
table-field:
map: string-text,number-numeric,boolean-bit(1)
table-prefix: iot_model_
mqtt:
topic:
instance:
data-upload: $esv/iot/[model_id]/[instance_id]/data/upload
\ No newline at end of file
table-prefix: iot_model_
\ No newline at end of file
......@@ -85,8 +85,4 @@ timescale:
max-lifetime: 0
table-field:
map: string-text,number-numeric,boolean-bit(1)
table-prefix: iot_model_
mqtt:
topic:
instance:
data-upload: $esv/iot/[model_id]/[instance_id]/data/upload
\ No newline at end of file
table-prefix: iot_model_
\ No newline at end of file
......@@ -85,8 +85,4 @@ timescale:
max-lifetime: 0
table-field:
map: string-text,number-numeric,boolean-bit(1)
table-prefix: iot_model_
mqtt:
topic:
instance:
data-upload: $esv/iot/[model_id]/[instance_id]/data/upload
\ No newline at end of file
table-prefix: iot_model_
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment