diff --git a/Pole.sln b/Pole.sln index 01ffaa1..74fbcd6 100644 --- a/Pole.sln +++ b/Pole.sln @@ -43,7 +43,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SagasTest.Api", "samples\ap EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pole.Sagas.Server", "src\Pole.Sagas.Server\Pole.Sagas.Server.csproj", "{34ECE24E-0D78-4764-BC54-0CEE61BDB96A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pole.Sagas.Client", "src\Pole.Sagas.Client\Pole.Sagas.Client.csproj", "{EED4FEA7-4E20-41B2-9741-55FCA709373E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pole.Sagas.Client", "src\Pole.Sagas.Client\Pole.Sagas.Client.csproj", "{EED4FEA7-4E20-41B2-9741-55FCA709373E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SagasServer", "samples\apis\SagasServer\SagasServer.csproj", "{9717D0D7-9288-4B2F-9830-A06E13B1C8C4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pole.EventBus", "src\Pole.EventBus\Pole.EventBus.csproj", "{A92E194A-518F-4A93-B346-0FEA50CCD614}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -115,6 +119,14 @@ Global {EED4FEA7-4E20-41B2-9741-55FCA709373E}.Debug|Any CPU.Build.0 = Debug|Any CPU {EED4FEA7-4E20-41B2-9741-55FCA709373E}.Release|Any CPU.ActiveCfg = Release|Any CPU {EED4FEA7-4E20-41B2-9741-55FCA709373E}.Release|Any CPU.Build.0 = Release|Any CPU + {9717D0D7-9288-4B2F-9830-A06E13B1C8C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9717D0D7-9288-4B2F-9830-A06E13B1C8C4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9717D0D7-9288-4B2F-9830-A06E13B1C8C4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9717D0D7-9288-4B2F-9830-A06E13B1C8C4}.Release|Any CPU.Build.0 = Release|Any CPU + {A92E194A-518F-4A93-B346-0FEA50CCD614}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A92E194A-518F-4A93-B346-0FEA50CCD614}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A92E194A-518F-4A93-B346-0FEA50CCD614}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A92E194A-518F-4A93-B346-0FEA50CCD614}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -138,6 +150,8 @@ Global {6138197E-6202-4E1B-9458-3CBEE60A36F9} = {475116FC-DEEC-4255-94E4-AE7B8C85038D} {34ECE24E-0D78-4764-BC54-0CEE61BDB96A} = {9932C965-8B38-4F70-9E43-86DC56860E2B} {EED4FEA7-4E20-41B2-9741-55FCA709373E} = {9932C965-8B38-4F70-9E43-86DC56860E2B} + {9717D0D7-9288-4B2F-9830-A06E13B1C8C4} = {475116FC-DEEC-4255-94E4-AE7B8C85038D} + {A92E194A-518F-4A93-B346-0FEA50CCD614} = {9932C965-8B38-4F70-9E43-86DC56860E2B} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {DB0775A3-F293-4043-ADB7-72BAC081E87E} diff --git a/samples/apis/Backet.Api/Backet.Api.csproj b/samples/apis/Backet.Api/Backet.Api.csproj index 4e5d3f8..4a69537 100644 --- a/samples/apis/Backet.Api/Backet.Api.csproj +++ b/samples/apis/Backet.Api/Backet.Api.csproj @@ -49,6 +49,7 @@ + diff --git a/samples/apis/Backet.Api/Controllers/BacketController.cs b/samples/apis/Backet.Api/Controllers/BacketController.cs index 0bc65ea..2540106 100644 --- a/samples/apis/Backet.Api/Controllers/BacketController.cs +++ b/samples/apis/Backet.Api/Controllers/BacketController.cs @@ -17,13 +17,10 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Npgsql; using Orleans; -using Pole.Core.EventBus; -using Pole.Core.EventBus.Event; -using Pole.Core.EventBus.EventHandler; -using Pole.Core.EventBus.EventStorage; using Pole.Core.Serialization; using Pole.Core.UnitOfWork; using Pole.Core.Utils.Abstraction; +using Pole.EventBus; namespace Backet.Api.Controllers { diff --git a/samples/apis/Backet.Api/Domain/Events/BacketCreatedEvent.cs b/samples/apis/Backet.Api/Domain/Events/BacketCreatedEvent.cs index c667e3b..1e8a517 100644 --- a/samples/apis/Backet.Api/Domain/Events/BacketCreatedEvent.cs +++ b/samples/apis/Backet.Api/Domain/Events/BacketCreatedEvent.cs @@ -1,4 +1,4 @@ -using Pole.Core.EventBus.Event; +using Pole.Core.Domain; using System; using System.Collections.Generic; using System.Linq; @@ -7,7 +7,7 @@ using System.Threading.Tasks; namespace Backet.Api.Domain.Event { - [EventInfo(EventName = "Backet")] + [Pole.EventBus.Event.EventInfo(EventName = "Backet")] public class BacketCreatedEvent : IEvent { public string BacketId { get; set; } diff --git a/samples/apis/Backet.Api/EventHandlers/Abstraction/IToNoticeBacketCreatedEventHandler.cs b/samples/apis/Backet.Api/EventHandlers/Abstraction/IToNoticeBacketCreatedEventHandler.cs index 23f75ec..e06612d 100644 --- a/samples/apis/Backet.Api/EventHandlers/Abstraction/IToNoticeBacketCreatedEventHandler.cs +++ b/samples/apis/Backet.Api/EventHandlers/Abstraction/IToNoticeBacketCreatedEventHandler.cs @@ -1,5 +1,5 @@ using Backet.Api.Domain.Event; -using Pole.Core.EventBus.EventHandler; +using Pole.EventBus.EventHandler; using System; using System.Collections.Generic; using System.Linq; diff --git a/samples/apis/Backet.Api/EventHandlers/ToNoticeBacketCreatedEventHandler.cs b/samples/apis/Backet.Api/EventHandlers/ToNoticeBacketCreatedEventHandler.cs index dbfd1e4..ef4ac63 100644 --- a/samples/apis/Backet.Api/EventHandlers/ToNoticeBacketCreatedEventHandler.cs +++ b/samples/apis/Backet.Api/EventHandlers/ToNoticeBacketCreatedEventHandler.cs @@ -1,6 +1,6 @@ using Backet.Api.Domain.Event; using Backet.Api.EventHandlers.Abstraction; -using Pole.Core.EventBus.EventHandler; +using Pole.EventBus.EventHandler; using System; using System.Collections.Generic; using System.Linq; diff --git a/samples/apis/Backet.Api/Grains/AddBacketGrain.cs b/samples/apis/Backet.Api/Grains/AddBacketGrain.cs index ff82a9f..9f69018 100644 --- a/samples/apis/Backet.Api/Grains/AddBacketGrain.cs +++ b/samples/apis/Backet.Api/Grains/AddBacketGrain.cs @@ -8,8 +8,8 @@ using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Backet.Api.Domain.Event; using Pole.Core.UnitOfWork; -using Pole.Core.EventBus.Transaction; -using Pole.Core.EventBus; +using Pole.EventBus.UnitOfWork; +using Pole.EventBus; namespace Backet.Api.Grains { diff --git a/samples/apis/SagasServer/Program.cs b/samples/apis/SagasServer/Program.cs new file mode 100644 index 0000000..61c1b67 --- /dev/null +++ b/samples/apis/SagasServer/Program.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; + +namespace SagasServer +{ + public class Program + { + public static void Main(string[] args) + { + CreateWebHostBuilder(args).Build().Run(); + } + + public static IWebHostBuilder CreateWebHostBuilder(string[] args) => + WebHost.CreateDefaultBuilder(args) + .UseStartup(); + } +} diff --git a/samples/apis/SagasServer/Properties/launchSettings.json b/samples/apis/SagasServer/Properties/launchSettings.json new file mode 100644 index 0000000..68ff505 --- /dev/null +++ b/samples/apis/SagasServer/Properties/launchSettings.json @@ -0,0 +1,27 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:53309", + "sslPort": 44342 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "SagasServer": { + "commandName": "Project", + "launchBrowser": true, + "applicationUrl": "https://localhost:5001;http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} \ No newline at end of file diff --git a/samples/apis/SagasServer/SagasServer.csproj b/samples/apis/SagasServer/SagasServer.csproj new file mode 100644 index 0000000..d0095d1 --- /dev/null +++ b/samples/apis/SagasServer/SagasServer.csproj @@ -0,0 +1,15 @@ + + + + netcoreapp3.1 + InProcess + + + + + + + + + + diff --git a/samples/apis/SagasServer/Startup.cs b/samples/apis/SagasServer/Startup.cs new file mode 100644 index 0000000..f42a2e6 --- /dev/null +++ b/samples/apis/SagasServer/Startup.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; + +namespace SagasServer +{ + public class Startup + { + // This method gets called by the runtime. Use this method to add services to the container. + // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 + public void ConfigureServices(IServiceCollection services) + { + services.AddPoleSagasServer(); + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) + { + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + } + + app.Run(async (context) => + { + await context.Response.WriteAsync("Hello World!"); + }); + } + } +} diff --git a/samples/apis/SagasServer/appsettings.Development.json b/samples/apis/SagasServer/appsettings.Development.json new file mode 100644 index 0000000..e203e94 --- /dev/null +++ b/samples/apis/SagasServer/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Debug", + "System": "Information", + "Microsoft": "Information" + } + } +} diff --git a/samples/apis/SagasServer/appsettings.json b/samples/apis/SagasServer/appsettings.json new file mode 100644 index 0000000..def9159 --- /dev/null +++ b/samples/apis/SagasServer/appsettings.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/samples/apis/SagasTest.Api/Startup.cs b/samples/apis/SagasTest.Api/Startup.cs index c51f30a..088635c 100644 --- a/samples/apis/SagasTest.Api/Startup.cs +++ b/samples/apis/SagasTest.Api/Startup.cs @@ -33,13 +33,13 @@ namespace SagasTest.Api services.AddControllers(); services.AddPole(config => { - config.AddRabbitMQ(option => - { - option.Hosts = new string[1] { Configuration["RabbitmqConfig:HostAddress"] }; - option.Password = Configuration["RabbitmqConfig:HostPassword"]; - option.UserName = Configuration["RabbitmqConfig:HostUserName"]; - }); - config.AddEntityFrameworkEventStorage(); + //config.AddRabbitMQ(option => + //{ + // option.Hosts = new string[1] { Configuration["RabbitmqConfig:HostAddress"] }; + // option.Password = Configuration["RabbitmqConfig:HostPassword"]; + // option.UserName = Configuration["RabbitmqConfig:HostUserName"]; + //}); + //config.AddEntityFrameworkEventStorage(); config.AddSagas(option=> { option.ServiceName = "SagasTest"; }); diff --git a/src/Pole.Core/Domain/Entity.cs b/src/Pole.Core/Domain/Entity.cs index 2a7e1fd..9baed89 100644 --- a/src/Pole.Core/Domain/Entity.cs +++ b/src/Pole.Core/Domain/Entity.cs @@ -1,5 +1,4 @@ -using Pole.Core.EventBus.Event; -using System; +using System; using System.Collections.Generic; using System.Text; diff --git a/src/Pole.Core/EventBus/Event/IEvent.cs b/src/Pole.Core/Domain/IEvent.cs similarity index 88% rename from src/Pole.Core/EventBus/Event/IEvent.cs rename to src/Pole.Core/Domain/IEvent.cs index 1b80f3d..11a0ae5 100644 --- a/src/Pole.Core/EventBus/Event/IEvent.cs +++ b/src/Pole.Core/Domain/IEvent.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text; -namespace Pole.Core.EventBus.Event +namespace Pole.Core.Domain { public interface IEvent { diff --git a/src/Pole.Core/Extensions/PoleServiceCollectionExtensions.cs b/src/Pole.Core/Extensions/PoleServiceCollectionExtensions.cs index 299dfdf..49dade1 100644 --- a/src/Pole.Core/Extensions/PoleServiceCollectionExtensions.cs +++ b/src/Pole.Core/Extensions/PoleServiceCollectionExtensions.cs @@ -1,12 +1,9 @@ using Microsoft.Extensions.DependencyInjection; using Pole.Core; using Pole.Core.Channels; -using Pole.Core.EventBus; using Pole.Core.Processor; -using Pole.Core.Processor.Server; using Pole.Core.Query; using Pole.Core.Serialization; -using Pole.Core.UnitOfWork; using Pole.Core.Utils; using Pole.Core.Utils.Abstraction; using System; @@ -24,14 +21,9 @@ namespace Microsoft.Extensions.DependencyInjection { services.Configure(option => { }); } - services.AddSingleton(); - services.AddSingleton(); services.AddTransient(typeof(IMpscChannel<>), typeof(MpscChannel<>)); - services.AddScoped(); - services.AddScoped(); services.AddSingleton(); services.AddSingleton(); - services.AddSingleton(); services.AddSingleton(); using (var serviceProvider = services.BuildServiceProvider()) { @@ -41,11 +33,6 @@ namespace Microsoft.Extensions.DependencyInjection var queryRegister = serviceProvider.GetService(); queryRegister.Register(services, ServiceLifetime.Scoped); } - - services.AddSingleton(); - services.AddSingleton(); - services.AddHostedService(); - config(startupOption); return services; } diff --git a/src/Pole.Core/Grains/PoleGrain.cs b/src/Pole.Core/Grains/PoleGrain.cs index 1dadcbe..f8a3030 100644 --- a/src/Pole.Core/Grains/PoleGrain.cs +++ b/src/Pole.Core/Grains/PoleGrain.cs @@ -1,6 +1,5 @@ using Orleans; using Pole.Core.Domain; -using Pole.Core.EventBus.Event; using System; using System.Collections.Generic; using System.Text; diff --git a/src/Pole.EventBus.Rabbitmq/Consumer/RabbitConsumer.cs b/src/Pole.EventBus.Rabbitmq/Consumer/RabbitConsumer.cs index be3e6a4..c0996f5 100644 --- a/src/Pole.EventBus.Rabbitmq/Consumer/RabbitConsumer.cs +++ b/src/Pole.EventBus.Rabbitmq/Consumer/RabbitConsumer.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; -using Pole.Core.EventBus; namespace Pole.EventBus.RabbitMQ { diff --git a/src/Pole.EventBus.Rabbitmq/Core/EventBusContainer.cs b/src/Pole.EventBus.Rabbitmq/Core/EventBusContainer.cs index 989d0af..d052272 100644 --- a/src/Pole.EventBus.Rabbitmq/Core/EventBusContainer.cs +++ b/src/Pole.EventBus.Rabbitmq/Core/EventBusContainer.cs @@ -2,17 +2,17 @@ using Microsoft.Extensions.Logging; using Orleans; using RabbitMQ.Client; -using Pole.Core.EventBus; using Pole.Core.Exceptions; using Pole.Core.Utils; using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Threading.Tasks; -using Pole.Core.EventBus.Event; -using Pole.Core.EventBus.EventHandler; using Microsoft.Extensions.Options; using System.Linq; +using Pole.EventBus.Event; +using Pole.Core.Domain; +using Pole.EventBus.EventHandler; namespace Pole.EventBus.RabbitMQ { diff --git a/src/Pole.EventBus.Rabbitmq/Core/IRabbitEventBusContainer.cs b/src/Pole.EventBus.Rabbitmq/Core/IRabbitEventBusContainer.cs index 879630d..c06fd5b 100644 --- a/src/Pole.EventBus.Rabbitmq/Core/IRabbitEventBusContainer.cs +++ b/src/Pole.EventBus.Rabbitmq/Core/IRabbitEventBusContainer.cs @@ -1,5 +1,4 @@ using System.Threading.Tasks; -using Pole.Core.EventBus; namespace Pole.EventBus.RabbitMQ { diff --git a/src/Pole.EventBus.Rabbitmq/Core/RabbitEventBus.cs b/src/Pole.EventBus.Rabbitmq/Core/RabbitEventBus.cs index 0e3a9e8..4f3d3ea 100644 --- a/src/Pole.EventBus.Rabbitmq/Core/RabbitEventBus.cs +++ b/src/Pole.EventBus.Rabbitmq/Core/RabbitEventBus.cs @@ -1,6 +1,4 @@ -using Pole.Core.EventBus; -using Pole.Core.EventBus.EventHandler; -using Pole.Core.Exceptions; +using Pole.Core.Exceptions; using Pole.Core.Utils; using System; using System.Collections.Generic; diff --git a/src/Pole.EventBus.Rabbitmq/Pole.EventBus.Rabbitmq.csproj b/src/Pole.EventBus.Rabbitmq/Pole.EventBus.Rabbitmq.csproj index dde5642..a5f8283 100644 --- a/src/Pole.EventBus.Rabbitmq/Pole.EventBus.Rabbitmq.csproj +++ b/src/Pole.EventBus.Rabbitmq/Pole.EventBus.Rabbitmq.csproj @@ -15,6 +15,7 @@ + diff --git a/src/Pole.EventBus.Rabbitmq/PoleRabbitmqStartupConfigExtensions.cs b/src/Pole.EventBus.Rabbitmq/PoleRabbitmqStartupConfigExtensions.cs index ae40c95..7ad5bf0 100644 --- a/src/Pole.EventBus.Rabbitmq/PoleRabbitmqStartupConfigExtensions.cs +++ b/src/Pole.EventBus.Rabbitmq/PoleRabbitmqStartupConfigExtensions.cs @@ -5,7 +5,7 @@ using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Pole.Core; -using Pole.Core.EventBus; +using Pole.EventBus; using Pole.EventBus.RabbitMQ; namespace Microsoft.Extensions.DependencyInjection diff --git a/src/Pole.EventBus.Rabbitmq/Producer/RabbitProducer.cs b/src/Pole.EventBus.Rabbitmq/Producer/RabbitProducer.cs index 368e6fc..14dff8d 100644 --- a/src/Pole.EventBus.Rabbitmq/Producer/RabbitProducer.cs +++ b/src/Pole.EventBus.Rabbitmq/Producer/RabbitProducer.cs @@ -1,6 +1,5 @@ using Microsoft.Extensions.Options; using Pole.Core; -using Pole.Core.EventBus; using System; using System.Collections.Generic; using System.Linq; diff --git a/src/Pole.Core/EventBus/Bus.cs b/src/Pole.EventBus/Bus.cs similarity index 93% rename from src/Pole.Core/EventBus/Bus.cs rename to src/Pole.EventBus/Bus.cs index 0651532..866e280 100644 --- a/src/Pole.Core/EventBus/Bus.cs +++ b/src/Pole.EventBus/Bus.cs @@ -1,7 +1,7 @@  -using Pole.Core.EventBus.Event; -using Pole.Core.EventBus.EventStorage; -using Pole.Core.EventBus.Transaction; +using Pole.EventBus.Event; +using Pole.EventBus.EventStorage; +using Pole.EventBus.Transaction; using Pole.Core.Serialization; using Pole.Core.Utils.Abstraction; using System; @@ -11,7 +11,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -namespace Pole.Core.EventBus +namespace Pole.EventBus { class Bus : IBus { diff --git a/src/Pole.Core/EventBus/Consumer.cs b/src/Pole.EventBus/Consumer.cs similarity index 96% rename from src/Pole.Core/EventBus/Consumer.cs rename to src/Pole.EventBus/Consumer.cs index 15d2857..4698727 100644 --- a/src/Pole.Core/EventBus/Consumer.cs +++ b/src/Pole.EventBus/Consumer.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -namespace Pole.Core.EventBus +namespace Pole.EventBus { public abstract class Consumer : IConsumer { diff --git a/src/Pole.Core/EventBus/Event/EventBytesTransport.cs b/src/Pole.EventBus/Event/EventBytesTransport.cs similarity index 98% rename from src/Pole.Core/EventBus/Event/EventBytesTransport.cs rename to src/Pole.EventBus/Event/EventBytesTransport.cs index 48cd12b..d558138 100644 --- a/src/Pole.Core/EventBus/Event/EventBytesTransport.cs +++ b/src/Pole.EventBus/Event/EventBytesTransport.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; using System.Text; -namespace Pole.Core.EventBus.Event +namespace Pole.EventBus.Event { public readonly struct EventBytesTransport { diff --git a/src/Pole.Core/EventBus/Event/EventInfoAttribute.cs b/src/Pole.EventBus/Event/EventInfoAttribute.cs similarity index 90% rename from src/Pole.Core/EventBus/Event/EventInfoAttribute.cs rename to src/Pole.EventBus/Event/EventInfoAttribute.cs index b5e08a3..bd9f276 100644 --- a/src/Pole.Core/EventBus/Event/EventInfoAttribute.cs +++ b/src/Pole.EventBus/Event/EventInfoAttribute.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text; -namespace Pole.Core.EventBus.Event +namespace Pole.EventBus.Event { [AttributeUsage(AttributeTargets.Class)] public class EventInfoAttribute: Attribute diff --git a/src/Pole.Core/EventBus/EventBuffer.cs b/src/Pole.EventBus/EventBuffer.cs similarity index 93% rename from src/Pole.Core/EventBus/EventBuffer.cs rename to src/Pole.EventBus/EventBuffer.cs index 9a2e8d6..0c3ae74 100644 --- a/src/Pole.Core/EventBus/EventBuffer.cs +++ b/src/Pole.EventBus/EventBuffer.cs @@ -1,7 +1,8 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -using Pole.Core.EventBus.Event; -using Pole.Core.EventBus.EventStorage; +using Pole.Core; +using Pole.EventBus.Event; +using Pole.EventBus.EventStorage; using System; using System.Collections.Generic; using System.Linq; @@ -10,7 +11,7 @@ using System.Threading; using System.Threading.Tasks; using System.Threading.Tasks.Dataflow; -namespace Pole.Core.EventBus +namespace Pole.EventBus { class EventBuffer : IEventBuffer { diff --git a/src/Pole.Core/EventBus/EventHandler/IPoleEventHandler.cs b/src/Pole.EventBus/EventHandler/IPoleEventHandler.cs similarity index 90% rename from src/Pole.Core/EventBus/EventHandler/IPoleEventHandler.cs rename to src/Pole.EventBus/EventHandler/IPoleEventHandler.cs index 38b77f4..ca204f8 100644 --- a/src/Pole.Core/EventBus/EventHandler/IPoleEventHandler.cs +++ b/src/Pole.EventBus/EventHandler/IPoleEventHandler.cs @@ -1,11 +1,11 @@ using Orleans; -using Pole.Core.EventBus.Event; +using Pole.EventBus.Event; using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; -namespace Pole.Core.EventBus.EventHandler +namespace Pole.EventBus.EventHandler { public interface IPoleEventHandler : IPoleEventHandler { diff --git a/src/Pole.Core/EventBus/EventHandler/PoleEventHandler.cs b/src/Pole.EventBus/EventHandler/PoleEventHandler.cs similarity index 98% rename from src/Pole.Core/EventBus/EventHandler/PoleEventHandler.cs rename to src/Pole.EventBus/EventHandler/PoleEventHandler.cs index 73f2f35..a2bb825 100644 --- a/src/Pole.Core/EventBus/EventHandler/PoleEventHandler.cs +++ b/src/Pole.EventBus/EventHandler/PoleEventHandler.cs @@ -1,6 +1,6 @@ using Microsoft.Extensions.Logging; using Orleans.Concurrency; -using Pole.Core.EventBus.Event; +using Pole.EventBus.Event; using Pole.Core.Serialization; using System; using System.Collections.Generic; @@ -14,7 +14,7 @@ using Pole.Core.Exceptions; using Orleans; using Pole.Core.Utils.Abstraction; -namespace Pole.Core.EventBus.EventHandler +namespace Pole.EventBus.EventHandler { /// /// diff --git a/src/Pole.Core/EventBus/EventStorage/EventEntity.cs b/src/Pole.EventBus/EventStorage/EventEntity.cs similarity index 93% rename from src/Pole.Core/EventBus/EventStorage/EventEntity.cs rename to src/Pole.EventBus/EventStorage/EventEntity.cs index 02284ff..684ee9e 100644 --- a/src/Pole.Core/EventBus/EventStorage/EventEntity.cs +++ b/src/Pole.EventBus/EventStorage/EventEntity.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text; -namespace Pole.Core.EventBus.EventStorage +namespace Pole.EventBus.EventStorage { public class EventEntity { diff --git a/src/Pole.Core/EventBus/EventStorage/EventStatus.cs b/src/Pole.EventBus/EventStorage/EventStatus.cs similarity index 91% rename from src/Pole.Core/EventBus/EventStorage/EventStatus.cs rename to src/Pole.EventBus/EventStorage/EventStatus.cs index 4aec229..a081eab 100644 --- a/src/Pole.Core/EventBus/EventStorage/EventStatus.cs +++ b/src/Pole.EventBus/EventStorage/EventStatus.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text; -namespace Pole.Core.EventBus.EventStorage +namespace Pole.EventBus.EventStorage { public enum EventStatus { diff --git a/src/Pole.Core/EventBus/EventStorage/IEventStorage.cs b/src/Pole.EventBus/EventStorage/IEventStorage.cs similarity index 94% rename from src/Pole.Core/EventBus/EventStorage/IEventStorage.cs rename to src/Pole.EventBus/EventStorage/IEventStorage.cs index 5f45b0f..2877d83 100644 --- a/src/Pole.Core/EventBus/EventStorage/IEventStorage.cs +++ b/src/Pole.EventBus/EventStorage/IEventStorage.cs @@ -4,7 +4,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -namespace Pole.Core.EventBus.EventStorage +namespace Pole.EventBus.EventStorage { public interface IEventStorage { diff --git a/src/Pole.Core/EventBus/EventStorage/IEventStorageInitializer.cs b/src/Pole.EventBus/EventStorage/IEventStorageInitializer.cs similarity index 92% rename from src/Pole.Core/EventBus/EventStorage/IEventStorageInitializer.cs rename to src/Pole.EventBus/EventStorage/IEventStorageInitializer.cs index a0d3a4e..800f811 100644 --- a/src/Pole.Core/EventBus/EventStorage/IEventStorageInitializer.cs +++ b/src/Pole.EventBus/EventStorage/IEventStorageInitializer.cs @@ -4,7 +4,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -namespace Pole.Core.EventBus.EventStorage +namespace Pole.EventBus.EventStorage { public interface IEventStorageInitializer { diff --git a/src/Pole.Core/Serialization/EventTypeFinder.cs b/src/Pole.EventBus/EventTypeFinder.cs similarity index 96% rename from src/Pole.Core/Serialization/EventTypeFinder.cs rename to src/Pole.EventBus/EventTypeFinder.cs index 4871cc2..7561321 100644 --- a/src/Pole.Core/Serialization/EventTypeFinder.cs +++ b/src/Pole.EventBus/EventTypeFinder.cs @@ -1,15 +1,16 @@ using Microsoft.Extensions.Logging; -using Pole.Core.EventBus.Event; +using Pole.Core.Domain; using Pole.Core.Exceptions; using Pole.Core.Utils; using Pole.Core.Utils.Abstraction; +using Pole.EventBus.Event; using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Text; -namespace Pole.Core.Serialization +namespace Pole.EventBus { public class EventTypeFinder : IEventTypeFinder { diff --git a/src/Pole.Core/EventBus/IBus.cs b/src/Pole.EventBus/IBus.cs similarity index 84% rename from src/Pole.Core/EventBus/IBus.cs rename to src/Pole.EventBus/IBus.cs index 6906448..303154b 100644 --- a/src/Pole.Core/EventBus/IBus.cs +++ b/src/Pole.EventBus/IBus.cs @@ -1,5 +1,5 @@ -using Pole.Core.EventBus.EventStorage; -using Pole.Core.EventBus.Transaction; +using Pole.EventBus.EventStorage; +using Pole.EventBus.Transaction; using System; using System.Collections.Concurrent; using System.Collections.Generic; @@ -7,7 +7,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -namespace Pole.Core.EventBus +namespace Pole.EventBus { public interface IBus { diff --git a/src/Pole.Core/EventBus/IConsumer.cs b/src/Pole.EventBus/IConsumer.cs similarity index 90% rename from src/Pole.Core/EventBus/IConsumer.cs rename to src/Pole.EventBus/IConsumer.cs index d46a039..f39d389 100644 --- a/src/Pole.Core/EventBus/IConsumer.cs +++ b/src/Pole.EventBus/IConsumer.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Threading.Tasks; -namespace Pole.Core.EventBus +namespace Pole.EventBus { public interface IConsumer { diff --git a/src/Pole.Core/EventBus/IConsumerContainer.cs b/src/Pole.EventBus/IConsumerContainer.cs similarity index 87% rename from src/Pole.Core/EventBus/IConsumerContainer.cs rename to src/Pole.EventBus/IConsumerContainer.cs index 954552e..5b74cf4 100644 --- a/src/Pole.Core/EventBus/IConsumerContainer.cs +++ b/src/Pole.EventBus/IConsumerContainer.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace Pole.Core.EventBus +namespace Pole.EventBus { public interface IConsumerContainer { diff --git a/src/Pole.Core/EventBus/IEventBuffer.cs b/src/Pole.EventBus/IEventBuffer.cs similarity index 83% rename from src/Pole.Core/EventBus/IEventBuffer.cs rename to src/Pole.EventBus/IEventBuffer.cs index b278016..2edc5db 100644 --- a/src/Pole.Core/EventBus/IEventBuffer.cs +++ b/src/Pole.EventBus/IEventBuffer.cs @@ -1,10 +1,10 @@ -using Pole.Core.EventBus.EventStorage; +using Pole.EventBus.EventStorage; using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; -namespace Pole.Core.EventBus +namespace Pole.EventBus { public interface IEventBuffer { diff --git a/src/Pole.Core/Utils/Abstraction/IEventTypeFinder.cs b/src/Pole.EventBus/IEventTypeFinder.cs similarity index 90% rename from src/Pole.Core/Utils/Abstraction/IEventTypeFinder.cs rename to src/Pole.EventBus/IEventTypeFinder.cs index 9f370fa..2b3826f 100644 --- a/src/Pole.Core/Utils/Abstraction/IEventTypeFinder.cs +++ b/src/Pole.EventBus/IEventTypeFinder.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text; -namespace Pole.Core.Utils.Abstraction +namespace Pole.EventBus { public interface IEventTypeFinder { diff --git a/src/Pole.Core/EventBus/IGrainID.cs b/src/Pole.EventBus/IGrainID.cs similarity index 87% rename from src/Pole.Core/EventBus/IGrainID.cs rename to src/Pole.EventBus/IGrainID.cs index ea6edf7..4b5ca17 100644 --- a/src/Pole.Core/EventBus/IGrainID.cs +++ b/src/Pole.EventBus/IGrainID.cs @@ -1,6 +1,6 @@ using System; -namespace Pole.Core.EventBus +namespace Pole.EventBus { public interface IGrainID { diff --git a/src/Pole.Core/EventBus/IObserverUnit.cs b/src/Pole.EventBus/IObserverUnit.cs similarity index 90% rename from src/Pole.Core/EventBus/IObserverUnit.cs rename to src/Pole.EventBus/IObserverUnit.cs index d041f3a..1a3ea57 100644 --- a/src/Pole.Core/EventBus/IObserverUnit.cs +++ b/src/Pole.EventBus/IObserverUnit.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Threading.Tasks; -namespace Pole.Core.EventBus +namespace Pole.EventBus { public interface IObserverUnit : IGrainID { diff --git a/src/Pole.Core/EventBus/IObserverUnitContainer.cs b/src/Pole.EventBus/IObserverUnitContainer.cs similarity index 90% rename from src/Pole.Core/EventBus/IObserverUnitContainer.cs rename to src/Pole.EventBus/IObserverUnitContainer.cs index 2f0cc91..806c311 100644 --- a/src/Pole.Core/EventBus/IObserverUnitContainer.cs +++ b/src/Pole.EventBus/IObserverUnitContainer.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -namespace Pole.Core.EventBus +namespace Pole.EventBus { public interface IObserverUnitContainer { diff --git a/src/Pole.Core/EventBus/IProducer.cs b/src/Pole.EventBus/IProducer.cs similarity index 90% rename from src/Pole.Core/EventBus/IProducer.cs rename to src/Pole.EventBus/IProducer.cs index e215757..e778913 100644 --- a/src/Pole.Core/EventBus/IProducer.cs +++ b/src/Pole.EventBus/IProducer.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Threading.Tasks; -namespace Pole.Core.EventBus +namespace Pole.EventBus { public interface IProducer { diff --git a/src/Pole.Core/EventBus/IProducerInfoContainer.cs b/src/Pole.EventBus/IProducerInfoContainer.cs similarity index 88% rename from src/Pole.Core/EventBus/IProducerInfoContainer.cs rename to src/Pole.EventBus/IProducerInfoContainer.cs index 7838ca3..1b55ad8 100644 --- a/src/Pole.Core/EventBus/IProducerInfoContainer.cs +++ b/src/Pole.EventBus/IProducerInfoContainer.cs @@ -1,7 +1,7 @@ using System; using System.Threading.Tasks; -namespace Pole.Core.EventBus +namespace Pole.EventBus { public interface IProducerInfoContainer { diff --git a/src/Pole.Core/EventBus/ObserverUnit.cs b/src/Pole.EventBus/ObserverUnit.cs similarity index 97% rename from src/Pole.Core/EventBus/ObserverUnit.cs rename to src/Pole.EventBus/ObserverUnit.cs index 05d3978..19aa0f4 100644 --- a/src/Pole.Core/EventBus/ObserverUnit.cs +++ b/src/Pole.EventBus/ObserverUnit.cs @@ -7,14 +7,14 @@ using System.Text; using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using System.Linq; -using Pole.Core.EventBus.Event; +using Pole.EventBus.Event; using Orleans.Concurrency; using System.Collections.Concurrent; using System.Linq.Expressions; -using Pole.Core.EventBus.EventHandler; +using Pole.EventBus.EventHandler; using Pole.Core.Utils.Abstraction; -namespace Pole.Core.EventBus +namespace Pole.EventBus { public class ObserverUnit : IObserverUnit { diff --git a/src/Pole.Core/EventBus/ObserverUnitContainer.cs b/src/Pole.EventBus/ObserverUnitContainer.cs similarity index 96% rename from src/Pole.Core/EventBus/ObserverUnitContainer.cs rename to src/Pole.EventBus/ObserverUnitContainer.cs index 2af2997..023d163 100644 --- a/src/Pole.Core/EventBus/ObserverUnitContainer.cs +++ b/src/Pole.EventBus/ObserverUnitContainer.cs @@ -5,12 +5,12 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.Text; using Microsoft.Extensions.DependencyInjection; -using Pole.Core.EventBus.EventHandler; +using Pole.EventBus.EventHandler; using System.Linq; using Pole.Core.Exceptions; -using Pole.Core.EventBus.Event; +using Pole.EventBus.Event; -namespace Pole.Core.EventBus +namespace Pole.EventBus { public class ObserverUnitContainer : IObserverUnitContainer { diff --git a/src/Pole.EventBus/Pole.EventBus.csproj b/src/Pole.EventBus/Pole.EventBus.csproj new file mode 100644 index 0000000..0a79d01 --- /dev/null +++ b/src/Pole.EventBus/Pole.EventBus.csproj @@ -0,0 +1,11 @@ + + + + netstandard2.1 + + + + + + + diff --git a/src/Pole.EventBus/PoleEventBusStartupConfigExtensions.cs b/src/Pole.EventBus/PoleEventBusStartupConfigExtensions.cs new file mode 100644 index 0000000..cec3faa --- /dev/null +++ b/src/Pole.EventBus/PoleEventBusStartupConfigExtensions.cs @@ -0,0 +1,33 @@ +using Microsoft.Extensions.DependencyInjection; +using Pole.Core; +using Pole.Core.Processor; +using Pole.EventBus.Processor; +using Pole.EventBus.Processor.Server; +using Pole.EventBus.UnitOfWork; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Pole.EventBus +{ + public static class PoleEventBusStartupConfigExtensions + { + public static void AddEventBus( + this StartupConfig startupOption) + { + startupOption.Services.AddSingleton(); + startupOption.Services.AddScoped(); + startupOption.Services.AddSingleton(); + startupOption.Services.AddSingleton(); + startupOption.Services.AddSingleton(); + startupOption.Services.AddHostedService(); + startupOption.Services.AddScoped(); + startupOption.Services.AddSingleton(); + + Startup.Register(async serviceProvider => + { + + }); + } + } +} diff --git a/src/Pole.Core/Processor/ExpiredEventsCollectorProcessor.cs b/src/Pole.EventBus/Processor/ExpiredEventsCollectorProcessor.cs similarity index 95% rename from src/Pole.Core/Processor/ExpiredEventsCollectorProcessor.cs rename to src/Pole.EventBus/Processor/ExpiredEventsCollectorProcessor.cs index 08f19a7..0b44215 100644 --- a/src/Pole.Core/Processor/ExpiredEventsCollectorProcessor.cs +++ b/src/Pole.EventBus/Processor/ExpiredEventsCollectorProcessor.cs @@ -1,12 +1,14 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -using Pole.Core.EventBus.EventStorage; +using Pole.Core; +using Pole.Core.Processor; +using Pole.EventBus.EventStorage; using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; -namespace Pole.Core.Processor +namespace Pole.EventBus.Processor { class ExpiredEventsCollectorProcessor : IProcessor { diff --git a/src/Pole.Core/Processor/PendingMessageRetryProcessor.cs b/src/Pole.EventBus/Processor/PendingMessageRetryProcessor.cs similarity index 94% rename from src/Pole.Core/Processor/PendingMessageRetryProcessor.cs rename to src/Pole.EventBus/Processor/PendingMessageRetryProcessor.cs index 6e928b2..6b76726 100644 --- a/src/Pole.Core/Processor/PendingMessageRetryProcessor.cs +++ b/src/Pole.EventBus/Processor/PendingMessageRetryProcessor.cs @@ -1,16 +1,18 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -using Pole.Core.EventBus; -using Pole.Core.EventBus.Event; -using Pole.Core.EventBus.EventStorage; +using Pole.EventBus; +using Pole.EventBus.Event; +using Pole.EventBus.EventStorage; using Pole.Core.Serialization; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Pole.Core.Processor; +using Pole.Core; -namespace Pole.Core.Processor +namespace Pole.EventBus.Processor { class PendingMessageRetryProcessor : ProcessorBase { diff --git a/src/Pole.Core/Processor/Server/BackgroundServiceBasedProcessorServer.cs b/src/Pole.EventBus/Processor/Server/BackgroundServiceBasedProcessorServer.cs similarity index 94% rename from src/Pole.Core/Processor/Server/BackgroundServiceBasedProcessorServer.cs rename to src/Pole.EventBus/Processor/Server/BackgroundServiceBasedProcessorServer.cs index fcba568..5f7bad7 100644 --- a/src/Pole.Core/Processor/Server/BackgroundServiceBasedProcessorServer.cs +++ b/src/Pole.EventBus/Processor/Server/BackgroundServiceBasedProcessorServer.cs @@ -1,7 +1,8 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; -using Pole.Core.EventBus.EventStorage; +using Pole.Core.Processor; +using Pole.EventBus.EventStorage; using System; using System.Collections.Generic; using System.Linq; @@ -9,7 +10,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -namespace Pole.Core.Processor.Server +namespace Pole.EventBus.Processor.Server { public class BackgroundServiceBasedProcessorServer : BackgroundService, IProcessorServer { diff --git a/src/Pole.Core/EventBus/Transaction/IDbTransactionAdapter.cs b/src/Pole.EventBus/Transaction/IDbTransactionAdapter.cs similarity index 87% rename from src/Pole.Core/EventBus/Transaction/IDbTransactionAdapter.cs rename to src/Pole.EventBus/Transaction/IDbTransactionAdapter.cs index 86a5ede..7a0672b 100644 --- a/src/Pole.Core/EventBus/Transaction/IDbTransactionAdapter.cs +++ b/src/Pole.EventBus/Transaction/IDbTransactionAdapter.cs @@ -1,4 +1,4 @@ -using Pole.Core.EventBus.EventStorage; +using Pole.EventBus.EventStorage; using System; using System.Collections.Concurrent; using System.Collections.Generic; @@ -6,7 +6,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -namespace Pole.Core.EventBus.Transaction +namespace Pole.EventBus.Transaction { public interface IDbTransactionAdapter : IDisposable { diff --git a/src/Pole.Core/UnitOfWork/IUnitOfWork.cs b/src/Pole.EventBus/UnitOfWork/IUnitOfWork.cs similarity index 81% rename from src/Pole.Core/UnitOfWork/IUnitOfWork.cs rename to src/Pole.EventBus/UnitOfWork/IUnitOfWork.cs index 27910ab..82e03d3 100644 --- a/src/Pole.Core/UnitOfWork/IUnitOfWork.cs +++ b/src/Pole.EventBus/UnitOfWork/IUnitOfWork.cs @@ -1,14 +1,13 @@ -using Pole.Core.EventBus; -using Pole.Core.EventBus.Transaction; -using System; +using System; using System.Collections.Generic; using System.Data; using System.Text; using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; +using Pole.EventBus.Transaction; -namespace Pole.Core.UnitOfWork +namespace Pole.EventBus.UnitOfWork { public interface IUnitOfWork : IDisposable { diff --git a/src/Pole.Core/UnitOfWork/UnitOfWork.cs b/src/Pole.EventBus/UnitOfWork/UnitOfWork.cs similarity index 92% rename from src/Pole.Core/UnitOfWork/UnitOfWork.cs rename to src/Pole.EventBus/UnitOfWork/UnitOfWork.cs index 035441a..14971b9 100644 --- a/src/Pole.Core/UnitOfWork/UnitOfWork.cs +++ b/src/Pole.EventBus/UnitOfWork/UnitOfWork.cs @@ -1,6 +1,4 @@ -using Pole.Core.EventBus; -using Pole.Core.EventBus.Transaction; -using System; +using System; using System.Collections.Generic; using System.Data; using System.Linq; @@ -9,13 +7,13 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Pole.Core.Serialization; -using Pole.Core.EventBus.Event; -using Pole.Core.EventBus.EventStorage; using Microsoft.Extensions.Options; using Pole.Core.Utils.Abstraction; using Pole.Core.Exceptions; +using Pole.EventBus.Event; +using Pole.EventBus.Transaction; -namespace Pole.Core.UnitOfWork +namespace Pole.EventBus.UnitOfWork { class UnitOfWork : IUnitOfWork { diff --git a/src/Pole.EventStorage.PostgreSql/IUnitOfWorkExtensions.cs b/src/Pole.EventStorage.PostgreSql/IUnitOfWorkExtensions.cs index a7dba92..0d72d77 100644 --- a/src/Pole.EventStorage.PostgreSql/IUnitOfWorkExtensions.cs +++ b/src/Pole.EventStorage.PostgreSql/IUnitOfWorkExtensions.cs @@ -1,8 +1,9 @@ using Microsoft.EntityFrameworkCore.Storage; using Microsoft.Extensions.DependencyInjection; -using Pole.Core.EventBus; -using Pole.Core.EventBus.Transaction; using Pole.Core.UnitOfWork; +using Pole.EventBus; +using Pole.EventBus.Transaction; +using Pole.EventBus.UnitOfWork; using System; using System.Collections.Generic; using System.Data; diff --git a/src/Pole.EventStorage.PostgreSql/Pole.EventStorage.PostgreSql.csproj b/src/Pole.EventStorage.PostgreSql/Pole.EventStorage.PostgreSql.csproj index 567e317..5107250 100644 --- a/src/Pole.EventStorage.PostgreSql/Pole.EventStorage.PostgreSql.csproj +++ b/src/Pole.EventStorage.PostgreSql/Pole.EventStorage.PostgreSql.csproj @@ -11,6 +11,7 @@ + diff --git a/src/Pole.EventStorage.PostgreSql/PoleNpgsqlBulkUploader.cs b/src/Pole.EventStorage.PostgreSql/PoleNpgsqlBulkUploader.cs index 5f3c8cf..9fbd875 100644 --- a/src/Pole.EventStorage.PostgreSql/PoleNpgsqlBulkUploader.cs +++ b/src/Pole.EventStorage.PostgreSql/PoleNpgsqlBulkUploader.cs @@ -1,6 +1,5 @@ using Npgsql; using NpgsqlTypes; -using Pole.Core.EventBus.EventStorage; using System; using System.Collections.Concurrent; using System.Collections.Generic; @@ -8,6 +7,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using Dapper; +using Pole.EventBus.EventStorage; namespace Pole.EventStorage.PostgreSql { diff --git a/src/Pole.EventStorage.PostgreSql/PolePostgreSqlStartupConfigExtensions.cs b/src/Pole.EventStorage.PostgreSql/PolePostgreSqlStartupConfigExtensions.cs index 0b2e8ba..6384524 100644 --- a/src/Pole.EventStorage.PostgreSql/PolePostgreSqlStartupConfigExtensions.cs +++ b/src/Pole.EventStorage.PostgreSql/PolePostgreSqlStartupConfigExtensions.cs @@ -1,7 +1,7 @@ using Microsoft.EntityFrameworkCore; using Pole.Core; -using Pole.Core.EventBus.EventStorage; -using Pole.Core.EventBus.Transaction; +using Pole.EventBus.EventStorage; +using Pole.EventBus.Transaction; using Pole.EventStorage.PostgreSql; using System; using System.Collections.Generic; diff --git a/src/Pole.EventStorage.PostgreSql/PostgreSqlDbTransactionAdapter.cs b/src/Pole.EventStorage.PostgreSql/PostgreSqlDbTransactionAdapter.cs index c0c6c84..7f19b3a 100644 --- a/src/Pole.EventStorage.PostgreSql/PostgreSqlDbTransactionAdapter.cs +++ b/src/Pole.EventStorage.PostgreSql/PostgreSqlDbTransactionAdapter.cs @@ -1,9 +1,6 @@ using Microsoft.EntityFrameworkCore.Storage; -using Pole.Core.EventBus; -using Pole.Core.EventBus.Event; -using Pole.Core.EventBus.EventStorage; -using Pole.Core.EventBus.Transaction; using Pole.Core.Serialization; +using Pole.EventBus.Transaction; using System; using System.Collections.Concurrent; using System.Collections.Generic; diff --git a/src/Pole.EventStorage.PostgreSql/PostgreSqlEventStorage.cs b/src/Pole.EventStorage.PostgreSql/PostgreSqlEventStorage.cs index 5759e2e..9c1ee85 100644 --- a/src/Pole.EventStorage.PostgreSql/PostgreSqlEventStorage.cs +++ b/src/Pole.EventStorage.PostgreSql/PostgreSqlEventStorage.cs @@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore.Storage; using Microsoft.Extensions.Options; using Npgsql; using Pole.Core; -using Pole.Core.EventBus.EventStorage; +using Pole.EventBus.EventStorage; using System; using System.Collections.Generic; using System.Data; diff --git a/src/Pole.EventStorage.PostgreSql/PostgreSqlEventStorageInitializer.cs b/src/Pole.EventStorage.PostgreSql/PostgreSqlEventStorageInitializer.cs index 0d6f797..7f2fa14 100644 --- a/src/Pole.EventStorage.PostgreSql/PostgreSqlEventStorageInitializer.cs +++ b/src/Pole.EventStorage.PostgreSql/PostgreSqlEventStorageInitializer.cs @@ -2,7 +2,7 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Npgsql; -using Pole.Core.EventBus.EventStorage; +using Pole.EventBus.EventStorage; using System; using System.Collections.Generic; using System.Text; diff --git a/src/Pole.Orleans.Provider.EntityframeworkCore/GrainStorage.cs b/src/Pole.Orleans.Provider.EntityframeworkCore/GrainStorage.cs index b752649..df5eb82 100644 --- a/src/Pole.Orleans.Provider.EntityframeworkCore/GrainStorage.cs +++ b/src/Pole.Orleans.Provider.EntityframeworkCore/GrainStorage.cs @@ -8,10 +8,9 @@ using Orleans; using Orleans.Runtime; using Orleans.Storage; using Pole.Core.Domain; -using Pole.Core.EventBus; -using Pole.Core.EventBus.Event; -using Pole.Core.EventBus.Transaction; -using Pole.Core.UnitOfWork; +using Pole.EventBus; +using Pole.EventBus.Transaction; +using Pole.EventBus.UnitOfWork; using System; using System.Collections.Generic; using System.Linq; diff --git a/src/Pole.Orleans.Provider.EntityframeworkCore/Pole.Orleans.Provider.EntityframeworkCore.csproj b/src/Pole.Orleans.Provider.EntityframeworkCore/Pole.Orleans.Provider.EntityframeworkCore.csproj index 3467f5f..4cf517f 100644 --- a/src/Pole.Orleans.Provider.EntityframeworkCore/Pole.Orleans.Provider.EntityframeworkCore.csproj +++ b/src/Pole.Orleans.Provider.EntityframeworkCore/Pole.Orleans.Provider.EntityframeworkCore.csproj @@ -10,6 +10,7 @@ + diff --git a/src/Pole.Sagas.Server/PoleSagasServerOption.cs b/src/Pole.Sagas.Server/PoleSagasServerOption.cs index cb80b5b..6c1efe6 100644 --- a/src/Pole.Sagas.Server/PoleSagasServerOption.cs +++ b/src/Pole.Sagas.Server/PoleSagasServerOption.cs @@ -6,10 +6,25 @@ namespace Pole.Sagas.Server { public class PoleSagasServerOption { + /// + /// 从数据库获取未结束的 sagas 的 时间间隔 单位秒 + /// public int NotEndedSagasFetchIntervalSeconds { get; set; } = 30; + /// + /// 每个Grpc 获取Sagas 的请求 ,服务端流式返回,每一次返回的间隔时间 单位秒 + /// public int GetSagasGrpcStreamingResponseDelaySeconds { get; set; } = 20; + /// + /// 过期数据 批量删除触发的时间间隔,单位秒 + /// public int ExpiredDataBulkDeleteIntervalSeconds { get; set; } = 10*60; + /// + /// 过期数据 批量是每一次删除的数量 + /// public int ExpiredDataDeleteBatchCount { get; set; } = 1000; + /// + /// 批量删除时 实际过期的数量比预定数量要大时,会分多次删除,此值为其中每次分批删除的时间间隔 + /// public int ExpiredDataPreBulkDeleteDelaySeconds { get; set; } = 3; } } diff --git a/src/Pole.Sagas.Server/PoleSagasServerServiceCollectionExtensions.cs b/src/Pole.Sagas.Server/PoleSagasServerServiceCollectionExtensions.cs index c31dc47..2bd53a0 100644 --- a/src/Pole.Sagas.Server/PoleSagasServerServiceCollectionExtensions.cs +++ b/src/Pole.Sagas.Server/PoleSagasServerServiceCollectionExtensions.cs @@ -1,17 +1,21 @@ using Microsoft.Extensions.DependencyInjection; using Pole.Core.Processor; +using Pole.Sagas.Server; using Pole.Sagas.Server.Processor; using System; using System.Collections.Generic; using System.Text; -namespace Pole.Sagas.Server +namespace Microsoft.Extensions.DependencyInjection { public static class PoleSagasServerServiceCollectionExtensions { - public static IServiceCollection AddPoleSagasServer(IServiceCollection services) - { + public static IServiceCollection AddPoleSagasServer(this IServiceCollection services, Action config = null) + { + Action defaultConfig = option => { }; + var finalConfig = config ?? defaultConfig; services.AddGrpc(); + services.Configure(config); services.AddSingleton(); services.AddSingleton(); diff --git a/src/Pole.Sagas.Storage.PostgreSql/PoleSagasStoragePostgreSqlOption.cs b/src/Pole.Sagas.Storage.PostgreSql/PoleSagasStoragePostgreSqlOption.cs index eb0aa2a..89f6453 100644 --- a/src/Pole.Sagas.Storage.PostgreSql/PoleSagasStoragePostgreSqlOption.cs +++ b/src/Pole.Sagas.Storage.PostgreSql/PoleSagasStoragePostgreSqlOption.cs @@ -9,8 +9,6 @@ namespace Pole.Sagas.Storage.PostgreSql public string SagaTableName { get; set; } = "Sagas"; public string SchemaName { get; set; } = "pole-sagas"; public string ActivityTableName { get; set; } = "Activities"; - public string OvertimeCompensationGuaranteeTableName { get; set; } = "OCG-Activities"; - public int SagasRecoveryIntervalSecond { get; set; } public string ConnectionString { get; set; } } } diff --git a/src/Pole.Sagas.Storage.PostgreSql/PostgreSqlSagaStorageInitializer.cs b/src/Pole.Sagas.Storage.PostgreSql/PostgreSqlSagaStorageInitializer.cs index d9e6f55..7ac014f 100644 --- a/src/Pole.Sagas.Storage.PostgreSql/PostgreSqlSagaStorageInitializer.cs +++ b/src/Pole.Sagas.Storage.PostgreSql/PostgreSqlSagaStorageInitializer.cs @@ -2,7 +2,6 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Npgsql; -using Pole.Core.EventBus.EventStorage; using Pole.Sagas.Core; using Pole.Sagas.Core.Abstraction; using System; diff --git a/test/Pole.Samples.Backet.Api/Program.cs b/test/Pole.Samples.Backet.Api/Program.cs index 24eaa1d..2f727db 100644 --- a/test/Pole.Samples.Backet.Api/Program.cs +++ b/test/Pole.Samples.Backet.Api/Program.cs @@ -1,7 +1,6 @@ using BenchmarkDotNet.Reports; using BenchmarkDotNet.Running; using Npgsql; -using Pole.Core.EventBus.EventStorage; using Pole.Samples.Backet.Api.Benchmarks; using System; using System.Collections.Generic;