Browse Source

Merge pull request #100 from abpframework/add-dist-lock

Re-added the distributed lock library.
pull/101/head
Enis Necipoglu 5 years ago
committed by GitHub
parent
commit
ba75fd98e7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbp.Shared.Hosting.Microservices.csproj
  2. 10
      shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbpSharedHostingMicroservicesModule.cs

3
shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbp.Shared.Hosting.Microservices.csproj

@ -19,6 +19,9 @@
<PackageReference Include="Volo.Abp.EventBus.RabbitMQ" Version="5.1.2" /> <PackageReference Include="Volo.Abp.EventBus.RabbitMQ" Version="5.1.2" />
<PackageReference Include="Volo.Abp.BackgroundJobs.RabbitMQ" Version="5.1.2" /> <PackageReference Include="Volo.Abp.BackgroundJobs.RabbitMQ" Version="5.1.2" />
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" Version="5.1.2" /> <PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" Version="5.1.2" />
<PackageReference Include="Volo.Abp.DistributedLocking" Version="5.1.2" />
<PackageReference Include="DistributedLock.Redis" Version="1.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

10
shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbpSharedHostingMicroservicesModule.cs

@ -1,5 +1,7 @@
using EShopOnAbp.AdministrationService.EntityFrameworkCore; using EShopOnAbp.AdministrationService.EntityFrameworkCore;
using EShopOnAbp.Shared.Hosting.AspNetCore; using EShopOnAbp.Shared.Hosting.AspNetCore;
using Medallion.Threading;
using Medallion.Threading.Redis;
using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.DataProtection;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using StackExchange.Redis; using StackExchange.Redis;
@ -21,7 +23,7 @@ namespace EShopOnAbp.Shared.Hosting.Microservices;
typeof(AbpEventBusRabbitMqModule), typeof(AbpEventBusRabbitMqModule),
typeof(AbpCachingStackExchangeRedisModule), typeof(AbpCachingStackExchangeRedisModule),
typeof(AdministrationServiceEntityFrameworkCoreModule), typeof(AdministrationServiceEntityFrameworkCoreModule),
typeof(AbpDistributedLockingAbstractionsModule) typeof(AbpDistributedLockingModule)
)] )]
public class EShopOnAbpSharedHostingMicroservicesModule : AbpModule public class EShopOnAbpSharedHostingMicroservicesModule : AbpModule
{ {
@ -43,5 +45,11 @@ public class EShopOnAbpSharedHostingMicroservicesModule : AbpModule
context.Services context.Services
.AddDataProtection() .AddDataProtection()
.PersistKeysToStackExchangeRedis(redis, "EShopOnAbp-Protection-Keys"); .PersistKeysToStackExchangeRedis(redis, "EShopOnAbp-Protection-Keys");
context.Services.AddSingleton<IDistributedLockProvider>(sp =>
{
var connection = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]);
return new RedisDistributedSynchronizationProvider(connection.GetDatabase());
});
} }
} }
Loading…
Cancel
Save