|
@@ -37,7 +37,6 @@ namespace HealthMonitor.Service.Sub |
|
|
//private int cnt = 0; |
|
|
//private int cnt = 0; |
|
|
|
|
|
|
|
|
public TDengineDataSubcribe( |
|
|
public TDengineDataSubcribe( |
|
|
|
|
|
|
|
|
TDengineService serviceTDengine, |
|
|
TDengineService serviceTDengine, |
|
|
PersonCacheManager personCacheMgr, |
|
|
PersonCacheManager personCacheMgr, |
|
|
BloodPressReferenceValueCacheManager bpRefValCacheManager, |
|
|
BloodPressReferenceValueCacheManager bpRefValCacheManager, |
|
@@ -109,14 +108,7 @@ namespace HealthMonitor.Service.Sub |
|
|
|
|
|
|
|
|
public void DoReceive(IntPtr Connection) |
|
|
public void DoReceive(IntPtr Connection) |
|
|
{ |
|
|
{ |
|
|
var cfg = new ConsumerConfig |
|
|
|
|
|
{ |
|
|
|
|
|
GourpId = "group_1", |
|
|
|
|
|
TDConnectUser = _configTDengineService.UserName, |
|
|
|
|
|
TDConnectPasswd = _configTDengineService.Password, |
|
|
|
|
|
MsgWithTableName = "true", |
|
|
|
|
|
TDConnectIp = _configTDengineService.Host, |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// string topic = "topic_hm_bp_stats"; |
|
|
// string topic = "topic_hm_bp_stats"; |
|
|
string topic = nameof(TopicHmBloodPress).ToLower(); |
|
|
string topic = nameof(TopicHmBloodPress).ToLower(); |
|
|
TopicHmBloodPress fields = new(); |
|
|
TopicHmBloodPress fields = new(); |
|
@@ -142,7 +134,14 @@ namespace HealthMonitor.Service.Sub |
|
|
_logger.LogError($"create topic failed, reason:{TDengine.Error(res)}"); |
|
|
_logger.LogError($"create topic failed, reason:{TDengine.Error(res)}"); |
|
|
throw new Exception($"create topic failed, reason:{TDengine.Error(res)}"); |
|
|
throw new Exception($"create topic failed, reason:{TDengine.Error(res)}"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var cfg = new ConsumerConfig |
|
|
|
|
|
{ |
|
|
|
|
|
GourpId = "group_1", |
|
|
|
|
|
TDConnectUser = _configTDengineService.UserName, |
|
|
|
|
|
TDConnectPasswd = _configTDengineService.Password, |
|
|
|
|
|
MsgWithTableName = "true", |
|
|
|
|
|
TDConnectIp = _configTDengineService.Host, |
|
|
|
|
|
}; |
|
|
// create consumer |
|
|
// create consumer |
|
|
var consumer = new ConsumerBuilder(cfg) |
|
|
var consumer = new ConsumerBuilder(cfg) |
|
|
.Build(); |
|
|
.Build(); |
|
@@ -155,7 +154,6 @@ namespace HealthMonitor.Service.Sub |
|
|
var consumeRes = consumer.Consume(300); |
|
|
var consumeRes = consumer.Consume(300); |
|
|
foreach (KeyValuePair<TopicPartition, TaosResult> kv in consumeRes.Message) |
|
|
foreach (KeyValuePair<TopicPartition, TaosResult> kv in consumeRes.Message) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
for (int i = 0; i < kv.Value.Datas.Count; i++) |
|
|
for (int i = 0; i < kv.Value.Datas.Count; i++) |
|
|
{ |
|
|
{ |
|
|
if (((i + 1) % kv.Value.Metas.Count == 0)) |
|
|
if (((i + 1) % kv.Value.Metas.Count == 0)) |
|
@@ -186,8 +184,7 @@ namespace HealthMonitor.Service.Sub |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
consumer.Commit(consumeRes); |
|
|
consumer.Commit(consumeRes); |
|
|
//_logger.LogInformation("监听中...."); |
|
|
//_logger.LogInformation("监听中...."); |
|
|