Changeset ad058b3
- Timestamp:
- 09/07/21 20:18:53 (3 years ago)
- Branches:
- dev
- Children:
- 6e1aa47
- Parents:
- f64836d
- Location:
- src/FinkiChattery
- Files:
-
- 13 added
- 9 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
src/FinkiChattery/FinkiChattery.Api/FinkiChattery.Api.csproj
rf64836d rad058b3 8 8 <PackageReference Include="FluentValidation" Version="9.5.4" /> 9 9 <PackageReference Include="FluentValidation.AspNetCore" Version="9.5.4" /> 10 <PackageReference Include="Hangfire.AspNetCore" Version="1.7.25" /> 11 <PackageReference Include="Hangfire.SqlServer" Version="1.7.25" /> 10 12 <PackageReference Include="IdentityServer4.AccessTokenValidation" Version="3.0.1" /> 11 13 <PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="9.0.0" /> … … 23 25 </ItemGroup> 24 26 27 <ItemGroup> 28 <Folder Include="Controllers\" /> 29 </ItemGroup> 30 25 31 26 32 </Project> -
src/FinkiChattery/FinkiChattery.Api/Services/RegisterServices.cs
rf64836d rad058b3 6 6 using FinkiChattery.Persistence.Context; 7 7 using FinkiChattery.Persistence.Models; 8 using Hangfire; 9 using Hangfire.SqlServer; 8 10 using MediatR; 9 11 using Microsoft.AspNetCore.Authentication.JwtBearer; … … 12 14 using Microsoft.Extensions.Configuration; 13 15 using Microsoft.Extensions.DependencyInjection; 16 using System; 14 17 15 18 namespace FinkiChattery.Api.Server … … 25 28 // TODO: REGISTER MEDIATOR HANDLERS WHEN WE CREATE FIRST COMMAND SMENI SO DOMAIN KLASA 26 29 services.AddMediatR(typeof(RegisterServices)); 30 } 31 32 public static void AddHangfireService(this IServiceCollection services, IConfiguration configuration) 33 { 34 services.AddHangfire(x => 35 { 36 x.UseSqlServerStorage(configuration.GetConnectionString("HangfireConnection"), new SqlServerStorageOptions 37 { 38 CommandBatchMaxTimeout = TimeSpan.FromMinutes(5), 39 SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5), 40 QueuePollInterval = TimeSpan.Zero, 41 UseRecommendedIsolationLevel = true, 42 DisableGlobalLocks = true 43 }); 44 x.UseMediatR(); 45 }); 46 services.AddHangfireServer(); 27 47 } 28 48 -
src/FinkiChattery/FinkiChattery.Api/Startup.cs
rf64836d rad058b3 3 3 using FinkiChattery.Api.Services; 4 4 using FinkiChattery.Persistence.Context; 5 using Hangfire; 5 6 using Microsoft.AspNetCore.Builder; 6 7 using Microsoft.AspNetCore.Hosting; … … 34 35 services.AddRepos(); 35 36 services.AddAwsClient(Configuration); 37 services.AddHangfireService(Configuration); 36 38 37 39 services.AddDbContext<ApplicationDbContext>(options => … … 72 74 { 73 75 endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}"); 76 endpoints.MapHangfireDashboard(); 74 77 }); 75 78 } -
src/FinkiChattery/FinkiChattery.Api/appsettings.Development.json
rf64836d rad058b3 31 31 }, 32 32 "ConnectionStrings": { 33 "DefaultConnection": "data source=.;initial catalog=FinkiChattery;integrated security=True;application name=FinkiChattery Base App;Pooling=true;Min Pool Size=5;Max Pool Size=30;" 33 "DefaultConnection": "data source=.;initial catalog=FinkiChattery;integrated security=True;application name=FinkiChattery Base App;Pooling=true;Min Pool Size=5;Max Pool Size=30;", 34 "HangfireConnection": "data source=.;initial catalog=FinkiChatteryHangfire;integrated security=True;application name=FinkiChattery Hangfire App;Pooling=true;Min Pool Size=5;Max Pool Size=30;" 34 35 } 35 36 } -
src/FinkiChattery/FinkiChattery.Common/FinkiChattery.Common.csproj
rf64836d rad058b3 7 7 <ItemGroup> 8 8 <PackageReference Include="FluentValidation" Version="9.5.4" /> 9 <PackageReference Include="Hangfire.Core" Version="1.7.25" /> 9 10 <PackageReference Include="MediatR" Version="9.0.0" /> 10 11 <PackageReference Include="Microsoft.AspNetCore.Mvc.Abstractions" Version="2.2.0" /> -
src/FinkiChattery/FinkiChattery.Common/Mediator/EventService.cs
rf64836d rad058b3 1 using FinkiChattery.Common.Mediator.Interfaces; 1 using FinkiChattery.Common.Mediator.Contracs; 2 using FinkiChattery.Common.Mediator.Interfaces; 3 using Hangfire; 2 4 3 5 namespace FinkiChattery.Common.Mediator … … 5 7 public class EventService : IEventService 6 8 { 9 public EventService(IBackgroundJobClient backgroundJob) 10 { 11 BackgroundJob = backgroundJob; 12 } 13 14 public IBackgroundJobClient BackgroundJob { get; } 15 16 public void Enqueue(string jobName, IEvent request) 17 { 18 BackgroundJob.Enqueue<IMediatorService>(bridge => bridge.PublishAsync(jobName, request)); 19 } 20 21 public void Enqueue(IEvent request) 22 { 23 BackgroundJob.Enqueue<IMediatorService>(bridge => bridge.PublishAsync(request)); 24 } 7 25 } 8 26 } -
src/FinkiChattery/FinkiChattery.Common/Mediator/Interfaces/IEventService.cs
rf64836d rad058b3 1 namespace FinkiChattery.Common.Mediator.Interfaces 1 using FinkiChattery.Common.Mediator.Contracs; 2 3 namespace FinkiChattery.Common.Mediator.Interfaces 2 4 { 3 5 public interface IEventService 4 6 { 7 void Enqueue(string jobName, IEvent request); 8 9 void Enqueue(IEvent request); 5 10 } 6 11 } -
src/FinkiChattery/FinkiChattery.Common/Mediator/Interfaces/IMediatorService.cs
rf64836d rad058b3 10 10 11 11 Task<TResponse> SendAsync<TResponse>(ICommand<TResponse> request); 12 13 Task PublishAsync<TNotification>(TNotification notification) where TNotification : IEvent; 14 15 Task PublishAsync<TNotification>(string jobName, TNotification notification) where TNotification : IEvent; 12 16 } 13 17 } -
src/FinkiChattery/FinkiChattery.Common/Mediator/MediatorService.cs
rf64836d rad058b3 1 using MediatR; 2 using FinkiChattery.Common.Mediator.Contracs; 1 using FinkiChattery.Common.Mediator.Contracs; 3 2 using FinkiChattery.Common.Mediator.Interfaces; 3 using MediatR; 4 using System.ComponentModel; 4 5 using System.Threading; 5 6 using System.Threading.Tasks; … … 25 26 return await mediator.Send(request); 26 27 } 28 29 public async Task PublishAsync<TNotification>(TNotification notification) where TNotification : IEvent 30 { 31 await mediator.Publish(notification, default); 32 } 33 34 [DisplayName("{0}")] 35 public async Task PublishAsync<TNotification>(string jobName, TNotification notification) where TNotification : IEvent 36 { 37 await mediator.Publish(notification, default); 38 } 27 39 } 28 40 } -
src/FinkiChattery/FinkiChattery.HangfireDatabase/FinkiChattery.HangfireDatabase.sqlproj
rf64836d rad058b3 14 14 <RootNamespace>FinkiChattery.HangfireDatabase</RootNamespace> 15 15 <AssemblyName>FinkiChattery.HangfireDatabase</AssemblyName> 16 <ModelCollation>1033, 16 <ModelCollation>1033,CI</ModelCollation> 17 17 <DefaultFileStructure>BySchemaAndSchemaType</DefaultFileStructure> 18 18 <DeployToDatabase>True</DeployToDatabase> … … 23 23 <IncludeCompositeObjects>True</IncludeCompositeObjects> 24 24 <TargetDatabaseSet>True</TargetDatabaseSet> 25 <DefaultCollation>SQL_Latin1_General_CP1_CI_AS</DefaultCollation> 26 <DefaultFilegroup>PRIMARY</DefaultFilegroup> 25 27 </PropertyGroup> 26 28 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> … … 57 59 <ItemGroup> 58 60 <Folder Include="Properties" /> 61 <Folder Include="HangFire\" /> 62 <Folder Include="HangFire\Tables\" /> 63 <Folder Include="Security\" /> 64 </ItemGroup> 65 <ItemGroup> 66 <Build Include="HangFire\Tables\Schema.sql" /> 67 <Build Include="HangFire\Tables\Job.sql" /> 68 <Build Include="HangFire\Tables\State.sql" /> 69 <Build Include="HangFire\Tables\JobParameter.sql" /> 70 <Build Include="HangFire\Tables\JobQueue.sql" /> 71 <Build Include="HangFire\Tables\Server.sql" /> 72 <Build Include="HangFire\Tables\List.sql" /> 73 <Build Include="HangFire\Tables\Set.sql" /> 74 <Build Include="HangFire\Tables\Counter.sql" /> 75 <Build Include="HangFire\Tables\Hash.sql" /> 76 <Build Include="HangFire\Tables\AggregatedCounter.sql" /> 77 <Build Include="Security\HangFire.sql" /> 59 78 </ItemGroup> 60 79 </Project>
Note:
See TracChangeset
for help on using the changeset viewer.