This commit is contained in:
xiaolipro 2025-08-30 16:11:48 +08:00
parent 2a68e5a6f5
commit 9bd4dc8374
3 changed files with 14 additions and 13 deletions

View File

@ -38,8 +38,8 @@
"Default": "server=129.204.22.146;database=track_center;uid=dev;pwd=itd!@#123;charset=utf8mb4;"
},
"FeiShuNotice": {
"Title": "TrackCenter-Dev",
"Webhook": "https://open.feishu.cn/open-apis/bot/v2/hook/255c44ff-5891-4902-9b6a-6d0250e745f7",
"TitlePrefix": "TrackCenter-Dev",
"Webhook": "https://open.feishu.cn/open-apis/bot/v2/hook/e5ced977-a616-42ce-8684-c7628e71b35e",
"Timeout": 20
},
"Redis": {
@ -60,15 +60,14 @@
}
},
"ElasticSearch": {
"NodeUrls": [
"http://129.204.22.146:9200"
],
"NodeUrls": [ "http://129.204.22.146:9200" ],
"LoginName": "elastic",
"Password": "afyTgmVb8jq6",
"Base64PassPassword": "Basic ZWxhc3RpYzphZnlUZ21WYjhqcTY="
"Password": "itd!@#123",
"ShowLogInfo": false,
"IndexPrefix": ""
},
"Kafka": {
"BootstrapServers": "kafka01.test.itfx.local:9092,kafka02.test.itfx.local:9092,kafka03.test.itfx.local:9092",
"BootstrapServers": "81.71.47.150:9192,81.71.47.150:9292,81.71.47.150:9392",
"Consumer": {
// 会话超时时间ms,超时时间未收到客户端心跳,则会移除该客户端同时触发自平衡
"SessionTimeoutMs": 45000,

View File

@ -152,7 +152,7 @@ public class TrackCenterApplicationModule : FakeModule
$",abortConnect=false";
// todo:注册预警计算服务
//context.Services.AddWarningCalcServices(configuration);
context.Services.AddWarningCalcServices(configuration);
// 注册预警任务后台服务
context.Services.AddHostedService<WarningTaskComponentHostedService>();

View File

@ -1,9 +1,12 @@
using System.Collections.Concurrent;
using System.Diagnostics;
using System.Reflection;
using Elasticsearch.Net;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Nest;
using Serilog;
using TrackCenter.Domain.Extensions;
namespace TrackCenter.Repository.ES;
@ -55,7 +58,7 @@ public class ConnectionFactory : ISingletonDependency
_connectionSettings.DefaultIndex(defaultIndex);
//是否输出日志
if (_options.ShowLogInfo)
if (Debugger.IsAttached || _options.ShowLogInfo)
{
_connectionSettings.EnableDebugMode();
client = new ElasticClient(_connectionSettings
@ -63,8 +66,8 @@ public class ConnectionFactory : ISingletonDependency
.DisableDirectStreaming()
.OnRequestCompleted(apiCallDetails =>
{
string infos = GetInfosFromApiCallDetails(apiCallDetails);
Console.WriteLine($"{Environment.NewLine}{infos}{Environment.NewLine}");
var infos = GetInfosFromApiCallDetails(apiCallDetails);
LogHelper.Info($"{Environment.NewLine}{infos}{Environment.NewLine}");
}));
}
else
@ -72,7 +75,6 @@ public class ConnectionFactory : ISingletonDependency
client = new ElasticClient(_connectionSettings);
}
_clientDic.TryAdd(type, client);
return client;