diff --git a/src/01/01/Form/Directory.Build.props b/src/01/01/Form/Directory.Build.props index b96ddda2..3b8c419b 100644 --- a/src/01/01/Form/Directory.Build.props +++ b/src/01/01/Form/Directory.Build.props @@ -42,7 +42,7 @@ all - 3.6.146 + 3.7.112 all diff --git a/src/01/02/Host/KSociety.Base.Srv.Host.Shared/KSociety.Base.Srv.Host.Shared.csproj b/src/01/02/Host/KSociety.Base.Srv.Host.Shared/KSociety.Base.Srv.Host.Shared.csproj index 372d54cf..29256ffd 100644 --- a/src/01/02/Host/KSociety.Base.Srv.Host.Shared/KSociety.Base.Srv.Host.Shared.csproj +++ b/src/01/02/Host/KSociety.Base.Srv.Host.Shared/KSociety.Base.Srv.Host.Shared.csproj @@ -10,8 +10,8 @@ - - + + diff --git a/src/01/02/KSociety.Base.Srv.Agent/Connection.cs b/src/01/02/KSociety.Base.Srv.Agent/Connection.cs index 06aa2fe0..3254c8f6 100644 --- a/src/01/02/KSociety.Base.Srv.Agent/Connection.cs +++ b/src/01/02/KSociety.Base.Srv.Agent/Connection.cs @@ -64,7 +64,7 @@ private Connection(IAgentConfiguration agentConfiguration) if (this.DebugFlag) { - this.Logger.LogTrace(@"Grpc Agent Connection for: {0}", this._agentConfiguration.ConnectionUrl); + this.Logger?.LogTrace(@"Grpc Agent Connection for: {0}", this._agentConfiguration.ConnectionUrl); } } diff --git a/src/01/02/KSociety.Base.Srv.Agent/KSociety.Base.Srv.Agent.csproj b/src/01/02/KSociety.Base.Srv.Agent/KSociety.Base.Srv.Agent.csproj index 22dd1585..a3d746a9 100644 --- a/src/01/02/KSociety.Base.Srv.Agent/KSociety.Base.Srv.Agent.csproj +++ b/src/01/02/KSociety.Base.Srv.Agent/KSociety.Base.Srv.Agent.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/01/06/Test/KSociety.Base.Infra.Shared.Test/KSociety.Base.Infra.Shared.Test.csproj b/src/01/06/Test/KSociety.Base.Infra.Shared.Test/KSociety.Base.Infra.Shared.Test.csproj index 55ca0f83..9cfbdfea 100644 --- a/src/01/06/Test/KSociety.Base.Infra.Shared.Test/KSociety.Base.Infra.Shared.Test.csproj +++ b/src/01/06/Test/KSociety.Base.Infra.Shared.Test/KSociety.Base.Infra.Shared.Test.csproj @@ -4,7 +4,7 @@ - net6.0;net7.0 + net8.0 false diff --git a/src/01/KSocietyBaseEventBus/KSociety.Base.EventBus/Abstractions/EventBus/IEventBusBase.cs b/src/01/KSocietyBaseEventBus/KSociety.Base.EventBus/Abstractions/EventBus/IEventBusBase.cs index 2e6fae03..db42d007 100644 --- a/src/01/KSocietyBaseEventBus/KSociety.Base.EventBus/Abstractions/EventBus/IEventBusBase.cs +++ b/src/01/KSocietyBaseEventBus/KSociety.Base.EventBus/Abstractions/EventBus/IEventBusBase.cs @@ -20,5 +20,7 @@ ValueTask Subscribe() void Unsubscribe() where TIntegrationEvent : IIntegrationEvent, new() where TIntegrationEventHandler : IIntegrationEventHandler; + + ValueTask QueuePurge(CancellationToken cancellationToken = default); } } diff --git a/src/01/KSocietyBaseEventBus/KSociety.Base.EventBus/Abstractions/EventBus/IEventBusRpc.cs b/src/01/KSocietyBaseEventBus/KSociety.Base.EventBus/Abstractions/EventBus/IEventBusRpc.cs index d9e32c3e..5bfb49bb 100644 --- a/src/01/KSocietyBaseEventBus/KSociety.Base.EventBus/Abstractions/EventBus/IEventBusRpc.cs +++ b/src/01/KSocietyBaseEventBus/KSociety.Base.EventBus/Abstractions/EventBus/IEventBusRpc.cs @@ -3,6 +3,7 @@ namespace KSociety.Base.EventBus.Abstractions.EventBus { using Handler; + using System.Threading; using System.Threading.Tasks; public interface IEventBusRpc : IEventBus @@ -20,5 +21,7 @@ void UnsubscribeRpc; + + ValueTask QueueReplyPurge(CancellationToken cancellationToken = default); } } diff --git a/src/01/KSocietyBaseEventBus/KSociety.Base.EventBus/Abstractions/EventBus/IEventBusRpcServer.cs b/src/01/KSocietyBaseEventBus/KSociety.Base.EventBus/Abstractions/EventBus/IEventBusRpcServer.cs index 01156f08..fdaeebd9 100644 --- a/src/01/KSocietyBaseEventBus/KSociety.Base.EventBus/Abstractions/EventBus/IEventBusRpcServer.cs +++ b/src/01/KSocietyBaseEventBus/KSociety.Base.EventBus/Abstractions/EventBus/IEventBusRpcServer.cs @@ -25,5 +25,7 @@ void UnsubscribeRpcServer; + + ValueTask QueueReplyPurge(CancellationToken cancellationToken = default); } } diff --git a/src/01/KSocietyBaseEventBus/KSociety.Base.EventBusRabbitMQ/EventBusRabbitMq.cs b/src/01/KSocietyBaseEventBus/KSociety.Base.EventBusRabbitMQ/EventBusRabbitMq.cs index 038e189c..ad181d6c 100644 --- a/src/01/KSocietyBaseEventBus/KSociety.Base.EventBusRabbitMQ/EventBusRabbitMq.cs +++ b/src/01/KSocietyBaseEventBus/KSociety.Base.EventBusRabbitMQ/EventBusRabbitMq.cs @@ -367,6 +367,33 @@ protected override void Dispose(bool disposing) #endregion + public virtual async ValueTask QueuePurge(CancellationToken cancellationToken = default) + { + try + { + if (this.ConsumerChannel is null) + { + this.Logger.LogWarning("ConsumerChannel is null!"); + return 0; + } + + if (this.ConsumerChannel.Value != null && !String.IsNullOrEmpty(this.QueueName)) + { + var result = await (await this.ConsumerChannel).QueuePurgeAsync(this.QueueName, cancellationToken); + + return result; + } + + this.Logger.LogError("QueuePurge can't call on ConsumerChannel is null or queue name is null."); + } + catch (Exception ex) + { + this.Logger.LogError(ex, "QueuePurge: "); + } + + return 0; + } + protected virtual async ValueTask StartBasicConsume() where TIntegrationEvent : IIntegrationEvent, new() { diff --git a/src/01/KSocietyBaseEventBus/KSociety.Base.EventBusRabbitMQ/EventBusRabbitMqRpc.cs b/src/01/KSocietyBaseEventBus/KSociety.Base.EventBusRabbitMQ/EventBusRabbitMqRpc.cs index 301e5121..1b726b62 100644 --- a/src/01/KSocietyBaseEventBus/KSociety.Base.EventBusRabbitMQ/EventBusRabbitMqRpc.cs +++ b/src/01/KSocietyBaseEventBus/KSociety.Base.EventBusRabbitMQ/EventBusRabbitMqRpc.cs @@ -340,6 +340,33 @@ protected override void Dispose(bool disposing) #endregion + public async ValueTask QueueReplyPurge(CancellationToken cancellationToken = default) + { + try + { + if (this._consumerChannelReply is null) + { + this.Logger.LogWarning("ConsumerChannelReply is null!"); + return 0; + } + + if (this._consumerChannelReply.Value != null && !String.IsNullOrEmpty(this._queueNameReply)) + { + var result = await (await this._consumerChannelReply).QueuePurgeAsync(this._queueNameReply, cancellationToken); + + return result; + } + + this.Logger.LogError("QueueReplyPurge can't call on ConsumerChannelReply is null or queue name is null."); + } + catch (Exception ex) + { + this.Logger.LogError(ex, "QueueReplyPurge: "); + } + + return 0; + } + protected async ValueTask StartBasicConsumeServer() where TIntegrationEvent : IIntegrationEvent, new() where TIntegrationEventReply : IIntegrationEventReply, new() diff --git a/src/01/KSocietyBaseEventBus/KSociety.Base.EventBusRabbitMQ/EventBusRabbitMqRpcClient.cs b/src/01/KSocietyBaseEventBus/KSociety.Base.EventBusRabbitMQ/EventBusRabbitMqRpcClient.cs index fcee542a..bf667ccc 100644 --- a/src/01/KSocietyBaseEventBus/KSociety.Base.EventBusRabbitMQ/EventBusRabbitMqRpcClient.cs +++ b/src/01/KSocietyBaseEventBus/KSociety.Base.EventBusRabbitMQ/EventBusRabbitMqRpcClient.cs @@ -494,8 +494,6 @@ protected override void Dispose(bool disposing) #endregion - - //protected async ValueTask StartBasicConsume() //{ // this.Logger.LogTrace("EventBusRabbitMqRpcClient Starting RabbitMQ basic consume"); @@ -534,7 +532,7 @@ protected override void Dispose(bool disposing) // } // this.Logger.LogError("StartBasicConsume can't call on ConsumerChannel is null"); - + // } // catch (Exception ex) // { diff --git a/src/01/KSocietyBaseEventBus/KSociety.Base.EventBusRabbitMQ/EventBusRabbitMqRpcServer.cs b/src/01/KSocietyBaseEventBus/KSociety.Base.EventBusRabbitMQ/EventBusRabbitMqRpcServer.cs index 803275fe..56b8342b 100644 --- a/src/01/KSocietyBaseEventBus/KSociety.Base.EventBusRabbitMQ/EventBusRabbitMqRpcServer.cs +++ b/src/01/KSocietyBaseEventBus/KSociety.Base.EventBusRabbitMQ/EventBusRabbitMqRpcServer.cs @@ -359,6 +359,33 @@ protected override void Dispose(bool disposing) #endregion + public async ValueTask QueueReplyPurge(CancellationToken cancellationToken = default) + { + try + { + if (this._consumerChannelReply is null) + { + this.Logger.LogWarning("ConsumerChannelReply is null!"); + return 0; + } + + if (this._consumerChannelReply.Value != null && !String.IsNullOrEmpty(this._queueNameReply)) + { + var result = await (await this._consumerChannelReply).QueuePurgeAsync(this._queueNameReply, cancellationToken); + + return result; + } + + this.Logger.LogError("QueueReplyPurge can't call on ConsumerChannelReply is null or queue name is null."); + } + catch (Exception ex) + { + this.Logger.LogError(ex, "QueueReplyPurge: "); + } + + return 0; + } + //protected async ValueTask StartBasicConsumeServer() // where TIntegrationEventRpc : IIntegrationEventRpc, new() // where TIntegrationEventReply : IIntegrationEventReply, new() diff --git a/src/01/KSocietyBaseEventBus/Test/KSociety.Base.EventBus.Test/KSociety.Base.EventBus.Test.csproj b/src/01/KSocietyBaseEventBus/Test/KSociety.Base.EventBus.Test/KSociety.Base.EventBus.Test.csproj index e782328e..6ef7dc0f 100644 --- a/src/01/KSocietyBaseEventBus/Test/KSociety.Base.EventBus.Test/KSociety.Base.EventBus.Test.csproj +++ b/src/01/KSocietyBaseEventBus/Test/KSociety.Base.EventBus.Test/KSociety.Base.EventBus.Test.csproj @@ -4,7 +4,7 @@ - net6.0;net7.0;net8.0 + net8.0 false diff --git a/src/01/Test/KSociety.Base.InfraSub.Test/KSociety.Base.InfraSub.Test.csproj b/src/01/Test/KSociety.Base.InfraSub.Test/KSociety.Base.InfraSub.Test.csproj index c6d40430..603336db 100644 --- a/src/01/Test/KSociety.Base.InfraSub.Test/KSociety.Base.InfraSub.Test.csproj +++ b/src/01/Test/KSociety.Base.InfraSub.Test/KSociety.Base.InfraSub.Test.csproj @@ -4,7 +4,7 @@ - net6.0;net7.0 + net8.0 false diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 592476e1..b9839293 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -40,7 +40,7 @@ all - 3.6.146 + 3.7.112 all