Skip to content

Commit

Permalink
Merge pull request #115 from infinistor/1.1.1-beta
Browse files Browse the repository at this point in the history
1.1.1 beta
  • Loading branch information
jssinn authored Oct 7, 2022
2 parents 30e04d5 + 2aed426 commit 49efc5f
Show file tree
Hide file tree
Showing 15 changed files with 184 additions and 67 deletions.
4 changes: 2 additions & 2 deletions portal/Data/PortalData/Enums/EnumServiceType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public enum EnumServiceType
ksanLifecycle,
/// <summary>Replication</summary>
ksanReplication,
/// <summary>Logging</summary>
ksanLogExport,
/// <summary>LogManager</summary>
ksanLogManager,
/// <summary>Metering</summary>
ksanMetering
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public enum EnumDbServiceType : int
ksanRecovery,
ksanLifecycle,
ksanReplication,
ksanLogExport,
ksanLogManager,
ksanMetering
}
}
16 changes: 8 additions & 8 deletions portal/Models/PortalModels/PortalModels.PortalModelDiagram.view
Original file line number Diff line number Diff line change
Expand Up @@ -2663,8 +2663,8 @@
</Model>
</Children>
<Location>
<X>3458 px</X>
<Y>255 px</Y>
<X>3104 px</X>
<Y>288 px</Y>
</Location>
<Size>
<Width>150 px</Width>
Expand Down Expand Up @@ -2805,8 +2805,8 @@
</Model>
</Children>
<Location>
<X>3458 px</X>
<Y>39 px</Y>
<X>3104 px</X>
<Y>72 px</Y>
</Location>
<Size>
<Width>150 px</Width>
Expand Down Expand Up @@ -6555,8 +6555,8 @@
</Model>
</Children>
<Location>
<X>3274 px</X>
<Y>39 px</Y>
<X>2920 px</X>
<Y>72 px</Y>
</Location>
<Size>
<Width>150 px</Width>
Expand Down Expand Up @@ -9062,8 +9062,8 @@
<ScaleMode>Free</ScaleMode>
<Scale>0.8</Scale>
<Location>
<X>828.749987650663 px</X>
<Y>1359.99997973442 px</Y>
<X>1096.2499836646 px</X>
<Y>1612.49997597188 px</Y>
</Location>
</ViewPort>
<Oid xsi:type="SchemaModelOID">
Expand Down
9 changes: 5 additions & 4 deletions portal/Models/PortalModels/PortalModels.ServiceEventLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,21 @@
namespace PortalModels
{
/// <summary> 서비스 이벤트 로그 </summary>
public partial class ServiceEventLog {
public partial class ServiceEventLog
{

public ServiceEventLog()
{
OnCreated();
}

/// <summary> 서비스 아이디 </summary>
/// <summary> 서비스 아이디 </summary>
public virtual Guid Id { get; set; }

/// <summary> 등록 시간 </summary>
/// <summary> 등록 시간 </summary>
public virtual DateTime RegDate { get; set; }

/// <summary> 이벤트 종류 </summary>
/// <summary> 이벤트 종류 </summary>
public virtual EnumDbServiceEventType EventType { get; set; }

public virtual string Message { get; set; }
Expand Down
8 changes: 8 additions & 0 deletions portal/Models/PortalModels/PortalModels.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@
<AutoGen>True</AutoGen>
<DependentUpon>PortalModels.efml</DependentUpon>
</Compile>
<Compile Update="PortalModels.EnumDbServiceEventType.cs">
<AutoGen>True</AutoGen>
<DependentUpon>PortalModels.efml</DependentUpon>
</Compile>
<Compile Update="PortalModels.EnumDbServiceGroupMode.cs">
<AutoGen>True</AutoGen>
<DependentUpon>PortalModels.efml</DependentUpon>
Expand Down Expand Up @@ -152,6 +156,10 @@
<AutoGen>True</AutoGen>
<DependentUpon>PortalModels.efml</DependentUpon>
</Compile>
<Compile Update="PortalModels.ServiceEventLog.cs">
<AutoGen>True</AutoGen>
<DependentUpon>PortalModels.efml</DependentUpon>
</Compile>
<Compile Update="PortalModels.ServiceGroup.cs">
<AutoGen>True</AutoGen>
<DependentUpon>PortalModels.efml</DependentUpon>
Expand Down
2 changes: 1 addition & 1 deletion portal/Models/PortalModels/PortalModels.efml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<Member Name="ksanRecovery" p1:Guid="62ea8d32-a690-4ee5-beda-e374c5255c5f" />
<Member Name="ksanLifecycle" p1:Guid="0a81ef6f-297d-4d18-98a4-7acbad48596a" />
<Member Name="ksanReplication" p1:Guid="b40b10be-2bf4-4f72-a174-cf92e44ff10c" />
<Member Name="ksanLogExport" p1:Guid="24dedc15-4d20-4238-94f2-50ea55305521" />
<Member Name="ksanLogManager" p1:Guid="24dedc15-4d20-4238-94f2-50ea55305521" />
<Member Name="ksanMetering" p1:Guid="61aec2a0-f5a1-4b6a-b0c4-1458f71fcd67" />
</EnumType>
<EnumType Name="EnumDbServiceGroupMode" class="EnumDbServiceGroupMode" p1:Guid="1628f072-6bf5-4dac-bae5-cf99e35c93ab">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,17 +341,17 @@ public async Task<ResponseData> UpdateState(string Id, EnumServerState State, st
return new ResponseData(EnumResponseResult.Error, Resource.EC_COMMON__NOT_FOUND, Resource.EM_COMMON__NOT_FOUND);

// 파라미터로 넘어온 수정자 아이디 파싱
Guid guidModId = Guid.Empty;
Guid ModGuid = LoginUserId;
if (!ModId.IsEmpty())
Guid.TryParse(ModId, out guidModId);
Guid.TryParse(ModId, out ModGuid);

using (var Transaction = await m_dbContext.Database.BeginTransactionAsync())
{
try
{
// 정보를 수정한다.
Exist.State = (EnumDbServerState)State;
Exist.ModId = LoginUserId != Guid.Empty ? LoginUserId : guidModId;
Exist.ModId = ModGuid != Guid.Empty ? ModGuid : null;
Exist.ModName = !LoginUserName.IsEmpty() ? LoginUserName : ModName;
Exist.ModDate = DateTime.Now;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ public async Task<ResponseData> UpdateState(string Id, EnumServiceState State, s
return new ResponseData(EnumResponseResult.Error, Resource.EC_COMMON__NOT_FOUND, Resource.EM_COMMON__NOT_FOUND);

// 파라미터로 넘어온 수정자 아이디 파싱
var ModGuid = Guid.Empty;
var ModGuid = LoginUserId;
if (!ModId.IsEmpty())
Guid.TryParse(ModId, out ModGuid);

Expand All @@ -411,7 +411,7 @@ public async Task<ResponseData> UpdateState(string Id, EnumServiceState State, s

// 정보를 수정한다.
Exist.State = (EnumDbServiceState)State;
Exist.ModId = LoginUserId != Guid.Empty ? LoginUserId : ModGuid;
Exist.ModId = ModGuid != Guid.Empty ? ModGuid : null;
Exist.ModName = !LoginUserName.IsEmpty() ? LoginUserName : ModName;
Exist.ModDate = DateTime.Now;
await m_dbContext.SaveChangesWithConcurrencyResolutionAsync();
Expand Down Expand Up @@ -610,17 +610,17 @@ public async Task<ResponseData> UpdateHaAction(string Id, EnumHaAction State, st
return new ResponseData(EnumResponseResult.Error, Resource.EC_COMMON__NOT_FOUND, Resource.EM_COMMON__NOT_FOUND);

// 파라미터로 넘어온 수정자 아이디 파싱
Guid GuidModId = Guid.Empty;
Guid ModGuid = LoginUserId;
if (!ModId.IsEmpty())
Guid.TryParse(ModId, out GuidModId);
Guid.TryParse(ModId, out ModGuid);

using (var Transaction = await m_dbContext.Database.BeginTransactionAsync())
{
try
{
// 정보를 수정한다.
Exist.HaAction = (EnumDbHaAction)State;
Exist.ModId = LoginUserId != Guid.Empty ? LoginUserId : GuidModId;
Exist.ModId = ModGuid != Guid.Empty ? ModGuid : null;
Exist.ModName = !LoginUserName.IsEmpty() ? LoginUserName : ModName;
Exist.ModDate = DateTime.Now;

Expand Down
50 changes: 25 additions & 25 deletions portal/PortalSvr/Controllers/Configs/ConfigsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -418,63 +418,63 @@ public async Task<ActionResult> RemoveConfigForKsanReplication([FromRoute] int V
return Json(await m_dataProvider.RemoveConfig(EnumServiceType.ksanReplication, Version));
}
#endregion
#region KsanLogExport
/// <summary>KsanLogExport 설정 목록을 가져온다.</summary>
#region KsanLogManager
/// <summary>KsanLogManager 설정 목록을 가져온다.</summary>
/// <returns>결과 JSON 문자열</returns>
[SwaggerResponse((int)HttpStatusCode.OK, null, typeof(ResponseList<ResponseServiceConfig>))]
[HttpGet("List/KsanLogExport")]
public async Task<ActionResult> GetConfigListForKsanLogExport()
[HttpGet("List/KsanLogManager")]
public async Task<ActionResult> GetConfigListForKsanLogManager()
{
return Json(await m_dataProvider.GetConfigList(EnumServiceType.ksanLogExport));
return Json(await m_dataProvider.GetConfigList(EnumServiceType.ksanLogManager));
}

/// <summary>KsanLogExport 설정을 가져온다.</summary>
/// <summary>KsanLogManager 설정을 가져온다.</summary>
/// <returns>결과 JSON 문자열</returns>
[SwaggerResponse((int)HttpStatusCode.OK, null, typeof(ResponseData<ResponseServiceConfig>))]
[HttpGet("KsanLogExport")]
public async Task<ActionResult> GetConfigForKsanLogExport()
[HttpGet("KsanLogManager")]
public async Task<ActionResult> GetConfigForKsanLogManager()
{
return Json(await m_dataProvider.GetConfig(EnumServiceType.ksanLogExport));
return Json(await m_dataProvider.GetConfig(EnumServiceType.ksanLogManager));
}

/// <summary>특정 버전의 KsanLogExport 설정을 가져온다.</summary>
/// <summary>특정 버전의 KsanLogManager 설정을 가져온다.</summary>
/// <param name="Version">서비스 버전</param>
/// <returns>결과 JSON 문자열</returns>
[SwaggerResponse((int)HttpStatusCode.OK, null, typeof(ResponseData<ResponseServiceConfig>))]
[HttpGet("KsanLogExport/{Version}")]
public async Task<ActionResult> GetConfigForKsanLogExport([FromRoute] int Version)
[HttpGet("KsanLogManager/{Version}")]
public async Task<ActionResult> GetConfigForKsanLogManager([FromRoute] int Version)
{
return Json(await m_dataProvider.GetConfig(EnumServiceType.ksanLogExport, Version));
return Json(await m_dataProvider.GetConfig(EnumServiceType.ksanLogManager, Version));
}

/// <summary>KsanLogExport 설정을 저장한다.</summary>
/// <summary>KsanLogManager 설정을 저장한다.</summary>
/// <param name="Config">서비스 설정 정보</param>
/// <returns>결과 JSON 문자열</returns>
[SwaggerResponse((int)HttpStatusCode.OK, null, typeof(ResponseData<ResponseUpdateConfig>))]
[HttpPost("KsanLogExport")]
public async Task<ActionResult> SetConfigForKsanLogExport([FromBody] string Config)
[HttpPost("KsanLogManager")]
public async Task<ActionResult> SetConfigForKsanLogManager([FromBody] string Config)
{
return Json(await m_dataProvider.SetConfig(new RequestServiceConfig() { Type = EnumServiceType.ksanLogExport, Config = Config }));
return Json(await m_dataProvider.SetConfig(new RequestServiceConfig() { Type = EnumServiceType.ksanLogManager, Config = Config }));
}

/// <summary>KsanLogExport 설정의 버전을 변경한다.</summary>
/// <summary>KsanLogManager 설정의 버전을 변경한다.</summary>
/// <param name="Version">서비스 버전</param>
/// <returns>결과 JSON 문자열</returns>
[SwaggerResponse((int)HttpStatusCode.OK, null, typeof(ResponseData<ResponseUpdateConfig>))]
[HttpPut("KsanLogExport/{Version}")]
public async Task<ActionResult> SetConfigLastVersionForKsanLogExport([FromRoute] int Version)
[HttpPut("KsanLogManager/{Version}")]
public async Task<ActionResult> SetConfigLastVersionForKsanLogManager([FromRoute] int Version)
{
return Json(await m_dataProvider.SetConfigLastVersion(EnumServiceType.ksanLogExport, Version));
return Json(await m_dataProvider.SetConfigLastVersion(EnumServiceType.ksanLogManager, Version));
}

/// <summary>KsanLogExport 설정의 버전을 삭제한다.</summary>
/// <summary>KsanLogManager 설정의 버전을 삭제한다.</summary>
/// <param name="Version">서비스 버전</param>
/// <returns>결과 JSON 문자열</returns>
[SwaggerResponse((int)HttpStatusCode.OK, null, typeof(ResponseData))]
[HttpDelete("KsanLogExport/{Version}")]
public async Task<ActionResult> RemoveConfigForKsanLogExport([FromRoute] int Version)
[HttpDelete("KsanLogManager/{Version}")]
public async Task<ActionResult> RemoveConfigForKsanLogManager([FromRoute] int Version)
{
return Json(await m_dataProvider.RemoveConfig(EnumServiceType.ksanLogExport, Version));
return Json(await m_dataProvider.RemoveConfig(EnumServiceType.ksanLogManager, Version));
}
#endregion
#region KsanMetering
Expand Down
22 changes: 17 additions & 5 deletions portal/PortalSvr/RabbitMqReceivers/RabbitMqReceiver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace PortalSvr.RabbitMQReceivers
public abstract class RabbitMQReceiver : BackgroundService
{
/// <summary>Rabbit MQ 연결 객체</summary>
private IConnection m_connection;
private IConnection m_connection = null;
/// <summary>Rabbit MQ 채널 객체</summary>
private IModel m_channel;
/// <summary>큐 이름</summary>
Expand Down Expand Up @@ -98,7 +98,18 @@ private void InitializeRabbitMQListener()
};

// 연결 객체 생성
m_connection = Factory.CreateConnection();
while (m_connection == null)
{
try
{
m_connection = Factory.CreateConnection();
}
catch (Exception e)
{
NNException.Log(e);
}
Thread.Sleep(1000);
}
// 연결 해제 이벤트 설정
m_connection.ConnectionShutdown += (_, _) =>
{
Expand All @@ -110,9 +121,10 @@ private void InitializeRabbitMQListener()
var arguments = new Dictionary<string, object>
{
{ "x-queue-type", "quorum" },
{"x-single-active-consumer", true}
};
m_channel.QueueDeclare(queue: m_queueName, durable: true, exclusive: false, autoDelete: false, arguments: arguments);
// Exchange 설절
// Exchange 설정
m_channel.ExchangeDeclare(exchange: m_config.ExchangeName, type: "topic");
// 모든 바인딩 키 처리
if (m_bindingKeys != null)
Expand Down Expand Up @@ -151,7 +163,7 @@ protected override Task ExecuteAsync(CancellationToken StoppingToken)
// 처리된 건인 경우
if (ResponseHandleMessage.IsProcessed)
{
m_logger.LogDebug($"[Process] MQ Message Received on [{{0}}] : {{1}}, Data = {{2}}", m_queueName, ea.RoutingKey, ea.Body.ToArray().GetString());
m_logger.LogDebug($"[Process] MQ Message Received on [{m_queueName}] : {ea.RoutingKey}, Data = {ea.Body.ToArray().GetString()}");

// 응답 연관 아이디가 존재하는 경우
var Properties = ea.BasicProperties;
Expand All @@ -177,7 +189,7 @@ protected override Task ExecuteAsync(CancellationToken StoppingToken)
// 처리되지 않은 건인 경우
else
{
m_logger.LogDebug($"[Reject] MQ Message Received on [{{0}}] : {{1}}, Data = {{2}}", m_queueName, ea.RoutingKey, ea.Body.ToArray().GetString());
m_logger.LogDebug($"[Reject] MQ Message Received on [{m_queueName}] : {ea.RoutingKey}, Data = {ea.Body.ToArray().GetString()}");

// 처리 거부
m_channel.BasicReject(ea.DeliveryTag, false);
Expand Down
6 changes: 3 additions & 3 deletions portal/PortalSvr/RabbitMqReceivers/RabbitMqServerReceiver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ protected override async Task<ResponseMqData> HandleMessage(string RoutingKey, b
return new ResponseMqData(EnumResponseResult.Error, Resource.EC_COMMON__CANNOT_CREATE_INSTANCE, Resource.EM_COMMON__CANNOT_CREATE_INSTANCE);

// 내부 시스템 API 키 정보를 가져온다.
var ResponseApiKey = await ApiKeyProvider.GetMainApiKey();
var ApiKey = await ApiKeyProvider.GetMainApiKey();

// API 키를 가져오는데 실패한 경우
if (ResponseApiKey == null)
if (ApiKey == null)
return new ResponseMqData(EnumResponseResult.Error, Resource.EC_COMMON__NOT_FOUND, Resource.EM_COMMON__NOT_FOUND);

// 서버 상태 관련인 경우
Expand All @@ -103,7 +103,7 @@ protected override async Task<ResponseMqData> HandleMessage(string RoutingKey, b
var Request = JsonConvert.DeserializeObject<RequestServerState>(json);

// 서버 상태 수정
var Response = await DataProvider.UpdateState(Request, ResponseApiKey.UserId, ResponseApiKey.UserName);
var Response = await DataProvider.UpdateState(Request, ApiKey.UserId, ApiKey.UserName);

Result.CopyValueFrom(Response);
Result.IsProcessed = true;
Expand Down
8 changes: 4 additions & 4 deletions portal/PortalSvr/RabbitMqReceivers/RabbitMqServiceReceiver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ protected override async Task<ResponseMqData> HandleMessage(string RoutingKey, b
return new ResponseMqData(EnumResponseResult.Error, Resource.EC_COMMON__CANNOT_CREATE_INSTANCE, Resource.EM_COMMON__CANNOT_CREATE_INSTANCE);

// 내부 시스템 API 키 정보를 가져온다.
var ResponseApiKey = await ApiKeyProvider.GetMainApiKey();
var ApiKey = await ApiKeyProvider.GetMainApiKey();

// API 키를 가져오는데 실패한 경우
if (ResponseApiKey == null)
if (ApiKey == null)
return new ResponseMqData(EnumResponseResult.Error, Resource.EC_COMMON__NOT_FOUND, Resource.EM_COMMON__NOT_FOUND);

// 서비스 상태 관련인 경우
Expand All @@ -104,7 +104,7 @@ protected override async Task<ResponseMqData> HandleMessage(string RoutingKey, b
var Request = JsonConvert.DeserializeObject<RequestServiceState>(json);

// 서버 상태 수정
var Response = await DataProvider.UpdateState(Request, ResponseApiKey.UserId, ResponseApiKey.UserName);
var Response = await DataProvider.UpdateState(Request, ApiKey.UserId, ApiKey.UserName);

Result.CopyValueFrom(Response);
Result.IsProcessed = true;
Expand All @@ -121,7 +121,7 @@ protected override async Task<ResponseMqData> HandleMessage(string RoutingKey, b
var Request = JsonConvert.DeserializeObject<RequestServiceHaAction>(json);

// 서비스 HA 상태 수정
var Response = await DataProvider.UpdateHaAction(Request, ResponseApiKey.UserId, ResponseApiKey.UserName);
var Response = await DataProvider.UpdateHaAction(Request, ApiKey.UserId, ApiKey.UserName);

Result.CopyValueFrom(Response);
Result.IsProcessed = true;
Expand Down
Loading

0 comments on commit 49efc5f

Please sign in to comment.