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

View File

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

View File

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