Browse Source

Add `framework/src/Volo.Abp.AspNetCore.Dapr.EventBus` package.

pull/13573/head
maliming 4 years ago
parent
commit
4d6987a99f
No known key found for this signature in database GPG Key ID: 96224957E51C89E
  1. 7
      framework/Volo.Abp.sln
  2. 3
      framework/src/Volo.Abp.AspNetCore.Dapr.EventBus/FodyWeavers.xml
  3. 30
      framework/src/Volo.Abp.AspNetCore.Dapr.EventBus/FodyWeavers.xsd
  4. 17
      framework/src/Volo.Abp.AspNetCore.Dapr.EventBus/Volo.Abp.AspNetCore.Dapr.EventBus.csproj
  5. 31
      framework/src/Volo.Abp.AspNetCore.Dapr.EventBus/Volo/Abp/AspNetCore/Dapr/EventBus/AbpAspNetCoreDaprEventBusModule.cs
  6. 11
      framework/src/Volo.Abp.AspNetCore.Dapr.EventBus/Volo/Abp/AspNetCore/Dapr/EventBus/AbpAspNetCoreDaprEventBusOptions.cs
  7. 2
      framework/src/Volo.Abp.AspNetCore.Dapr.EventBus/Volo/Abp/AspNetCore/Dapr/EventBus/AbpAspNetCoreDaprPubSubConsts.cs
  8. 32
      framework/src/Volo.Abp.AspNetCore.Dapr.EventBus/Volo/Abp/AspNetCore/Dapr/EventBus/AbpAspNetCoreDaprPubSubProvider.cs
  9. 16
      framework/src/Volo.Abp.AspNetCore.Dapr.EventBus/Volo/Abp/AspNetCore/Dapr/EventBus/AbpAspNetCoreDaprPubSubProviderContributorContext.cs
  10. 19
      framework/src/Volo.Abp.AspNetCore.Dapr.EventBus/Volo/Abp/AspNetCore/Dapr/EventBus/Controllers/AbpAspNetCoreDaprPubSubController.cs
  11. 6
      framework/src/Volo.Abp.AspNetCore.Dapr.EventBus/Volo/Abp/AspNetCore/Dapr/EventBus/IAbpAspNetCoreDaprPubSubProviderContributor.cs
  12. 2
      framework/src/Volo.Abp.AspNetCore.Dapr.EventBus/Volo/Abp/AspNetCore/Dapr/EventBus/Models/AbpAspNetCoreDaprSubscriptionDefinition.cs
  13. 2
      framework/src/Volo.Abp.AspNetCore.Dapr.EventBus/Volo/Abp/AspNetCore/Dapr/EventBus/Models/AbpAspNetCoreDaprSubscriptionRequest.cs
  14. 2
      framework/src/Volo.Abp.AspNetCore.Dapr.EventBus/Volo/Abp/AspNetCore/Dapr/EventBus/SystemTextJson/AbpAspNetCoreDaprPubSubJsonNamingPolicy.cs
  15. 8
      framework/src/Volo.Abp.AspNetCore.Dapr.EventBus/Volo/Abp/AspNetCore/Dapr/EventBus/SystemTextJson/AbpAspNetCoreDaprSubscriptionDefinitionConverter.cs
  16. 7
      framework/src/Volo.Abp.AspNetCore.Dapr/Volo.Abp.AspNetCore.Dapr.csproj
  17. 25
      framework/src/Volo.Abp.AspNetCore.Dapr/Volo/Abp/AspNetCore/Dapr/AbpAspNetCoreDaprModule.cs
  18. 11
      framework/src/Volo.Abp.AspNetCore.Dapr/Volo/Abp/AspNetCore/Dapr/AbpAspNetCoreDaprOptions.cs
  19. 16
      framework/src/Volo.Abp.AspNetCore.Dapr/Volo/Abp/AspNetCore/Dapr/AbpDaprPubSubProviderContributorContext.cs
  20. 6
      framework/src/Volo.Abp.AspNetCore.Dapr/Volo/Abp/AspNetCore/Dapr/IAbpDaprPubSubProviderContributor.cs
  21. 1
      nupkg/common.ps1

7
framework/Volo.Abp.sln

@ -417,6 +417,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Http.Client.Dapr",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.AspNetCore.Dapr", "src\Volo.Abp.AspNetCore.Dapr\Volo.Abp.AspNetCore.Dapr.csproj", "{5EED625D-8D86-492A-BCB8-F6C8CD8D4AA1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.AspNetCore.Dapr.EventBus", "src\Volo.Abp.AspNetCore.Dapr.EventBus\Volo.Abp.AspNetCore.Dapr.EventBus.csproj", "{B02EF042-C39E-45C4-A92D-BF7554E1889D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -1243,6 +1245,10 @@ Global
{5EED625D-8D86-492A-BCB8-F6C8CD8D4AA1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5EED625D-8D86-492A-BCB8-F6C8CD8D4AA1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5EED625D-8D86-492A-BCB8-F6C8CD8D4AA1}.Release|Any CPU.Build.0 = Release|Any CPU
{B02EF042-C39E-45C4-A92D-BF7554E1889D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B02EF042-C39E-45C4-A92D-BF7554E1889D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B02EF042-C39E-45C4-A92D-BF7554E1889D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B02EF042-C39E-45C4-A92D-BF7554E1889D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -1453,6 +1459,7 @@ Global
{DCC41E99-EBC7-4F19-BA0D-A6F770D8E431} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
{18B796D2-D45D-41AE-9A42-75C9B14B20DF} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
{5EED625D-8D86-492A-BCB8-F6C8CD8D4AA1} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
{B02EF042-C39E-45C4-A92D-BF7554E1889D} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BB97ECF4-9A84-433F-A80B-2A3285BDD1D5}

3
framework/src/Volo.Abp.AspNetCore.Dapr.EventBus/FodyWeavers.xml

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>

30
framework/src/Volo.Abp.AspNetCore.Dapr.EventBus/FodyWeavers.xsd

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

17
framework/src/Volo.Abp.AspNetCore.Dapr.EventBus/Volo.Abp.AspNetCore.Dapr.EventBus.csproj

@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.AspNetCore.Dapr\Volo.Abp.AspNetCore.Dapr.csproj" />
<ProjectReference Include="..\Volo.Abp.EventBus.Dapr\Volo.Abp.EventBus.Dapr.csproj" />
</ItemGroup>
</Project>

31
framework/src/Volo.Abp.AspNetCore.Dapr.EventBus/Volo/Abp/AspNetCore/Dapr/EventBus/AbpAspNetCoreDaprEventBusModule.cs

@ -0,0 +1,31 @@
using Microsoft.AspNetCore.Http.Json;
using Volo.Abp.AspNetCore.Dapr.SystemTextJson;
using Volo.Abp.EventBus.Dapr;
using Volo.Abp.Json;
using Volo.Abp.Json.SystemTextJson;
using Volo.Abp.Modularity;
namespace Volo.Abp.AspNetCore.Dapr;
[DependsOn(
typeof(AbpAspNetCoreDaprModule),
typeof(AbpEventBusDaprModule),
typeof(AbpJsonModule)
)]
public class AbpAspNetCoreDaprEventBusModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
// TODO: Add NewtonsoftJson json converter.
Configure<JsonOptions>(options =>
{
options.SerializerOptions.Converters.Add(new AbpAspNetCoreDaprSubscriptionDefinitionConverter());
});
Configure<AbpSystemTextJsonSerializerOptions>(options =>
{
options.JsonSerializerOptions.Converters.Add(new AbpAspNetCoreDaprSubscriptionDefinitionConverter());
});
}
}

11
framework/src/Volo.Abp.AspNetCore.Dapr.EventBus/Volo/Abp/AspNetCore/Dapr/EventBus/AbpAspNetCoreDaprEventBusOptions.cs

@ -0,0 +1,11 @@
namespace Volo.Abp.AspNetCore.Dapr;
public class AbpAspNetCoreDaprEventBusOptions
{
public List<IAbpAspNetCoreDaprPubSubProviderContributor> Contributors { get; }
public AbpAspNetCoreDaprEventBusOptions()
{
Contributors = new List<IAbpAspNetCoreDaprPubSubProviderContributor>();
}
}

2
framework/src/Volo.Abp.AspNetCore.Dapr/Volo/Abp/AspNetCore/Dapr/AbpAspNetCoreDaprConsts.cs → framework/src/Volo.Abp.AspNetCore.Dapr.EventBus/Volo/Abp/AspNetCore/Dapr/EventBus/AbpAspNetCoreDaprPubSubConsts.cs

@ -1,6 +1,6 @@
namespace Volo.Abp.AspNetCore.Dapr;
public class AbpAspNetCoreDaprConsts
public class AbpAspNetCoreDaprPubSubConsts
{
public const string DaprSubscribeUrl = "dapr/subscribe";

32
framework/src/Volo.Abp.AspNetCore.Dapr/Volo/Abp/AspNetCore/Dapr/AbpDaprPubSubProvider.cs → framework/src/Volo.Abp.AspNetCore.Dapr.EventBus/Volo/Abp/AspNetCore/Dapr/EventBus/AbpAspNetCoreDaprPubSubProvider.cs

@ -8,28 +8,28 @@ using Volo.Abp.EventBus.Distributed;
namespace Volo.Abp.AspNetCore.Dapr;
public class AbpDaprPubSubProvider : ITransientDependency
public class AbpAspNetCoreDaprPubSubProvider : ITransientDependency
{
protected IServiceProvider ServiceProvider { get; }
protected AbpAspNetCoreDaprOptions Options { get; }
protected AbpDaprEventBusOptions EventBusOptions { get; }
protected AbpAspNetCoreDaprEventBusOptions AspNetCoreDaprEventBusOptions { get; }
protected AbpDaprEventBusOptions DaprEventBusOptions { get; }
protected AbpDistributedEventBusOptions DistributedEventBusOptions { get; }
public AbpDaprPubSubProvider(
public AbpAspNetCoreDaprPubSubProvider(
IServiceProvider serviceProvider,
IOptions<AbpAspNetCoreDaprOptions> options,
IOptions<AbpDaprEventBusOptions> eventBusOptions,
IOptions<AbpAspNetCoreDaprEventBusOptions> aspNetCoreDaprEventBusOptions,
IOptions<AbpDaprEventBusOptions> daprEventBusOptions,
IOptions<AbpDistributedEventBusOptions> distributedEventBusOptions)
{
ServiceProvider = serviceProvider;
EventBusOptions = eventBusOptions.Value;
Options = options.Value;
AspNetCoreDaprEventBusOptions = aspNetCoreDaprEventBusOptions.Value;
DaprEventBusOptions = daprEventBusOptions.Value;
DistributedEventBusOptions = distributedEventBusOptions.Value;
}
public virtual async Task<List<DaprSubscriptionDefinition>> GetSubscriptionsAsync()
public virtual async Task<List<AbpAspNetCoreDaprSubscriptionDefinition>> GetSubscriptionsAsync()
{
var subscriptions = new List<DaprSubscriptionDefinition>();
var subscriptions = new List<AbpAspNetCoreDaprSubscriptionDefinition>();
foreach (var handler in DistributedEventBusOptions.Handlers)
{
foreach (var @interface in handler.GetInterfaces().Where(x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof(IDistributedEventHandler<>)))
@ -37,21 +37,21 @@ public class AbpDaprPubSubProvider : ITransientDependency
var eventType = @interface.GetGenericArguments()[0];
var eventName = EventNameAttribute.GetNameOrDefault(eventType);
subscriptions.Add(new DaprSubscriptionDefinition()
subscriptions.Add(new AbpAspNetCoreDaprSubscriptionDefinition()
{
PubSubName = EventBusOptions.PubSubName,
PubSubName = DaprEventBusOptions.PubSubName,
Topic = eventName,
Route = AbpAspNetCoreDaprConsts.DaprEventCallbackUrl
Route = AbpAspNetCoreDaprPubSubConsts.DaprEventCallbackUrl
});
}
}
if (Options.Contributors.Any())
if (AspNetCoreDaprEventBusOptions.Contributors.Any())
{
using (var scope = ServiceProvider.CreateScope())
{
var context = new AbpDaprPubSubProviderContributorContext(scope.ServiceProvider, subscriptions);
foreach (var contributor in Options.Contributors)
var context = new AbpAspNetCoreDaprPubSubProviderContributorContext(scope.ServiceProvider, subscriptions);
foreach (var contributor in AspNetCoreDaprEventBusOptions.Contributors)
{
await contributor.ContributeAsync(context);
}

16
framework/src/Volo.Abp.AspNetCore.Dapr.EventBus/Volo/Abp/AspNetCore/Dapr/EventBus/AbpAspNetCoreDaprPubSubProviderContributorContext.cs

@ -0,0 +1,16 @@
using Volo.Abp.AspNetCore.Dapr.Models;
namespace Volo.Abp.AspNetCore.Dapr;
public class AbpAspNetCoreDaprPubSubProviderContributorContext
{
public IServiceProvider ServiceProvider { get; }
public List<AbpAspNetCoreDaprSubscriptionDefinition> Subscriptions { get; }
public AbpAspNetCoreDaprPubSubProviderContributorContext(IServiceProvider serviceProvider, List<AbpAspNetCoreDaprSubscriptionDefinition> daprSubscriptionModels)
{
ServiceProvider = serviceProvider;
Subscriptions = daprSubscriptionModels;
}
}

19
framework/src/Volo.Abp.AspNetCore.Dapr/Volo/Abp/AspNetCore/Dapr/Controllers/DaprController.cs → framework/src/Volo.Abp.AspNetCore.Dapr.EventBus/Volo/Abp/AspNetCore/Dapr/EventBus/Controllers/AbpAspNetCoreDaprPubSubController.cs

@ -11,26 +11,19 @@ namespace Volo.Abp.AspNetCore.Dapr.Controllers;
[Area("abp")]
[RemoteService(Name = "abp")]
public class DaprController : AbpController
public class AbpAspNetCoreDaprPubSubController : AbpController
{
protected AbpDaprPubSubProvider DaprPubSubProvider { get; }
public DaprController(AbpDaprPubSubProvider daprPubSubProvider)
{
DaprPubSubProvider = daprPubSubProvider;
}
[HttpGet(AbpAspNetCoreDaprConsts.DaprSubscribeUrl)]
public virtual async Task<List<DaprSubscriptionDefinition>> SubscribeAsync()
[HttpGet(AbpAspNetCoreDaprPubSubConsts.DaprSubscribeUrl)]
public virtual async Task<List<AbpAspNetCoreDaprSubscriptionDefinition>> SubscribeAsync()
{
return await DaprPubSubProvider.GetSubscriptionsAsync();
return await HttpContext.RequestServices.GetRequiredService<AbpAspNetCoreDaprPubSubProvider>().GetSubscriptionsAsync();
}
[HttpPost(AbpAspNetCoreDaprConsts.DaprEventCallbackUrl)]
[HttpPost(AbpAspNetCoreDaprPubSubConsts.DaprEventCallbackUrl)]
public virtual async Task<IActionResult> EventsAsync()
{
var bodyJsonDocument = await JsonDocument.ParseAsync(HttpContext.Request.Body);
var request = JsonSerializer.Deserialize<DaprSubscriptionRequest>(bodyJsonDocument.RootElement.GetRawText(),
var request = JsonSerializer.Deserialize<AbpAspNetCoreDaprSubscriptionRequest>(bodyJsonDocument.RootElement.GetRawText(),
HttpContext.RequestServices.GetRequiredService<IOptions<JsonOptions>>().Value.JsonSerializerOptions);
var distributedEventBus = HttpContext.RequestServices.GetRequiredService<DaprDistributedEventBus>();

6
framework/src/Volo.Abp.AspNetCore.Dapr.EventBus/Volo/Abp/AspNetCore/Dapr/EventBus/IAbpAspNetCoreDaprPubSubProviderContributor.cs

@ -0,0 +1,6 @@
namespace Volo.Abp.AspNetCore.Dapr;
public interface IAbpAspNetCoreDaprPubSubProviderContributor
{
Task ContributeAsync(AbpAspNetCoreDaprPubSubProviderContributorContext context);
}

2
framework/src/Volo.Abp.AspNetCore.Dapr/Volo/Abp/AspNetCore/Dapr/Models/DaprSubscriptionDefinition.cs → framework/src/Volo.Abp.AspNetCore.Dapr.EventBus/Volo/Abp/AspNetCore/Dapr/EventBus/Models/AbpAspNetCoreDaprSubscriptionDefinition.cs

@ -1,6 +1,6 @@
namespace Volo.Abp.AspNetCore.Dapr.Models;
public class DaprSubscriptionDefinition
public class AbpAspNetCoreDaprSubscriptionDefinition
{
public string PubSubName { get; set; }

2
framework/src/Volo.Abp.AspNetCore.Dapr/Volo/Abp/AspNetCore/Dapr/Models/DaprSubscriptionRequest.cs → framework/src/Volo.Abp.AspNetCore.Dapr.EventBus/Volo/Abp/AspNetCore/Dapr/EventBus/Models/AbpAspNetCoreDaprSubscriptionRequest.cs

@ -1,6 +1,6 @@
namespace Volo.Abp.AspNetCore.Dapr.Models;
public class DaprSubscriptionRequest
public class AbpAspNetCoreDaprSubscriptionRequest
{
public string PubSubName { get; set; }

2
framework/src/Volo.Abp.AspNetCore.Dapr/Volo/Abp/AspNetCore/Dapr/SystemTextJson/AbpAspNetCoreDaprJsonNamingPolicy.cs → framework/src/Volo.Abp.AspNetCore.Dapr.EventBus/Volo/Abp/AspNetCore/Dapr/EventBus/SystemTextJson/AbpAspNetCoreDaprPubSubJsonNamingPolicy.cs

@ -2,7 +2,7 @@
namespace Volo.Abp.AspNetCore.Dapr.SystemTextJson;
public class AbpAspNetCoreDaprJsonNamingPolicy : JsonNamingPolicy
public class AbpAspNetCoreDaprPubSubJsonNamingPolicy : JsonNamingPolicy
{
public override string ConvertName(string name)
{

8
framework/src/Volo.Abp.AspNetCore.Dapr/Volo/Abp/AspNetCore/Dapr/SystemTextJson/DaprSubscriptionDefinitionConverter.cs → framework/src/Volo.Abp.AspNetCore.Dapr.EventBus/Volo/Abp/AspNetCore/Dapr/EventBus/SystemTextJson/AbpAspNetCoreDaprSubscriptionDefinitionConverter.cs

@ -4,20 +4,20 @@ using Volo.Abp.AspNetCore.Dapr.Models;
namespace Volo.Abp.AspNetCore.Dapr.SystemTextJson;
public class DaprSubscriptionDefinitionConverter : JsonConverter<DaprSubscriptionDefinition>
public class AbpAspNetCoreDaprSubscriptionDefinitionConverter : JsonConverter<AbpAspNetCoreDaprSubscriptionDefinition>
{
private JsonSerializerOptions _writeJsonSerializerOptions;
public override DaprSubscriptionDefinition Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
public override AbpAspNetCoreDaprSubscriptionDefinition Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
throw new NotSupportedException();
}
public override void Write(Utf8JsonWriter writer, DaprSubscriptionDefinition value, JsonSerializerOptions options)
public override void Write(Utf8JsonWriter writer, AbpAspNetCoreDaprSubscriptionDefinition value, JsonSerializerOptions options)
{
_writeJsonSerializerOptions ??= JsonSerializerOptionsHelper.Create(new JsonSerializerOptions(options)
{
PropertyNamingPolicy = new AbpAspNetCoreDaprJsonNamingPolicy()
PropertyNamingPolicy = new AbpAspNetCoreDaprPubSubJsonNamingPolicy()
}, x => x == this);
JsonSerializer.Serialize(writer, value, _writeJsonSerializerOptions);

7
framework/src/Volo.Abp.AspNetCore.Dapr/Volo.Abp.AspNetCore.Dapr.csproj

@ -12,17 +12,10 @@
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.AspNetCore.Mvc\Volo.Abp.AspNetCore.Mvc.csproj" />
<ProjectReference Include="..\Volo.Abp.AspNetCore\Volo.Abp.AspNetCore.csproj" />
<ProjectReference Include="..\Volo.Abp.EventBus.Dapr\Volo.Abp.EventBus.Dapr.csproj" />
<ProjectReference Include="..\Volo.Abp.Dapr\Volo.Abp.Dapr.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Dapr.AspNetCore" Version="1.8.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="Volo\Abp\AspNetCore\Dapr\Newtonsoft" />
</ItemGroup>
</Project>

25
framework/src/Volo.Abp.AspNetCore.Dapr/Volo/Abp/AspNetCore/Dapr/AbpAspNetCoreDaprModule.cs

@ -1,31 +1,12 @@
using Microsoft.AspNetCore.Http.Json;
using Volo.Abp.AspNetCore.Dapr.SystemTextJson;
using Volo.Abp.EventBus.Dapr;
using Volo.Abp.Json;
using Volo.Abp.Json.SystemTextJson;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Modularity;
namespace Volo.Abp.AspNetCore.Dapr;
[DependsOn(
typeof(AbpAspNetCoreModule),
typeof(AbpEventBusDaprModule),
typeof(AbpJsonModule)
)]
typeof(AbpAspNetCoreMvcModule)
)]
public class AbpAspNetCoreDaprModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
// TODO: Add NewtonsoftJson json converter.
Configure<JsonOptions>(options =>
{
options.SerializerOptions.Converters.Add(new DaprSubscriptionDefinitionConverter());
});
Configure<AbpSystemTextJsonSerializerOptions>(options =>
{
options.JsonSerializerOptions.Converters.Add(new DaprSubscriptionDefinitionConverter());
});
}
}

11
framework/src/Volo.Abp.AspNetCore.Dapr/Volo/Abp/AspNetCore/Dapr/AbpAspNetCoreDaprOptions.cs

@ -1,11 +0,0 @@
namespace Volo.Abp.AspNetCore.Dapr;
public class AbpAspNetCoreDaprOptions
{
public List<IAbpDaprPubSubProviderContributor> Contributors { get; }
public AbpAspNetCoreDaprOptions()
{
Contributors = new List<IAbpDaprPubSubProviderContributor>();
}
}

16
framework/src/Volo.Abp.AspNetCore.Dapr/Volo/Abp/AspNetCore/Dapr/AbpDaprPubSubProviderContributorContext.cs

@ -1,16 +0,0 @@
using Volo.Abp.AspNetCore.Dapr.Models;
namespace Volo.Abp.AspNetCore.Dapr;
public class AbpDaprPubSubProviderContributorContext
{
public IServiceProvider ServiceProvider { get; }
public List<DaprSubscriptionDefinition> Subscriptions { get; }
public AbpDaprPubSubProviderContributorContext(IServiceProvider serviceProvider, List<DaprSubscriptionDefinition> daprSubscriptionModels)
{
ServiceProvider = serviceProvider;
Subscriptions = daprSubscriptionModels;
}
}

6
framework/src/Volo.Abp.AspNetCore.Dapr/Volo/Abp/AspNetCore/Dapr/IAbpDaprPubSubProviderContributor.cs

@ -1,6 +0,0 @@
namespace Volo.Abp.AspNetCore.Dapr;
public interface IAbpDaprPubSubProviderContributor
{
Task ContributeAsync(AbpDaprPubSubProviderContributorContext context);
}

1
nupkg/common.ps1

@ -100,6 +100,7 @@ $projects = (
"framework/src/Volo.Abp.AspNetCore.Authentication.OpenIdConnect",
"framework/src/Volo.Abp.AspNetCore",
"framework/src/Volo.Abp.AspNetCore.Dapr",
"framework/src/Volo.Abp.AspNetCore.Dapr.EventBus",
"framework/src/Volo.Abp.AspNetCore.Components",
"framework/src/Volo.Abp.AspNetCore.Components.Server",
"framework/src/Volo.Abp.AspNetCore.Components.Web",

Loading…
Cancel
Save