Skip to content

Commit 3ed8001

Browse files
feature: Injected Handlers Filtering (#25)
* feature: Injected Handlers Filtering * fix: OptionalHandlerFilter is now IncludHandlers and ExcludeHandlers for more controll * doc: XML summary * fix: IsHandlerIncluded() to internal * feat: add Aspire example for assembly filtering
1 parent 400ee63 commit 3ed8001

25 files changed

Lines changed: 460 additions & 18 deletions

DispatchR.sln

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,30 +24,127 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{
2424
.github\workflows\build-release.yml = .github\workflows\build-release.yml
2525
EndProjectSection
2626
EndProject
27+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AspireModularSample", "AspireModularSample", "{BA3021C0-B64E-B700-D62A-004419E20C36}"
28+
ProjectSection(SolutionItems) = preProject
29+
src\AspireModularExample\README.md = src\AspireModularExample\README.md
30+
EndProjectSection
31+
EndProject
32+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AspireModularSample.AppHost", "src\AspireModularExample\AspireModularSample.AppHost\AspireModularSample.AppHost.csproj", "{50159CB4-5913-4D77-9FE3-13588DCA300A}"
33+
EndProject
34+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AspireModularSample.Modules", "src\AspireModularExample\AspireModularSample.Modules\AspireModularSample.Modules.csproj", "{3416F900-58F9-4AB6-AC8A-95B03C7BD9A3}"
35+
EndProject
36+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AspireModularSample.ServiceA", "src\AspireModularExample\AspireModularSample.ServiceA\AspireModularSample.ServiceA.csproj", "{7D2890FF-66F7-4870-BB89-952167AB0681}"
37+
EndProject
38+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AspireModularSample.ServiceB", "src\AspireModularExample\AspireModularSample.ServiceB\AspireModularSample.ServiceB.csproj", "{707E07BA-998C-49DE-BA56-7E9C0B6B7DBA}"
39+
EndProject
2740
Global
2841
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2942
Debug|Any CPU = Debug|Any CPU
43+
Debug|x64 = Debug|x64
44+
Debug|x86 = Debug|x86
3045
Release|Any CPU = Release|Any CPU
46+
Release|x64 = Release|x64
47+
Release|x86 = Release|x86
3148
EndGlobalSection
3249
GlobalSection(ProjectConfigurationPlatforms) = postSolution
3350
{9A10D4A1-2E7F-4DE2-AC96-49E2914800D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
3451
{9A10D4A1-2E7F-4DE2-AC96-49E2914800D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
52+
{9A10D4A1-2E7F-4DE2-AC96-49E2914800D7}.Debug|x64.ActiveCfg = Debug|Any CPU
53+
{9A10D4A1-2E7F-4DE2-AC96-49E2914800D7}.Debug|x64.Build.0 = Debug|Any CPU
54+
{9A10D4A1-2E7F-4DE2-AC96-49E2914800D7}.Debug|x86.ActiveCfg = Debug|Any CPU
55+
{9A10D4A1-2E7F-4DE2-AC96-49E2914800D7}.Debug|x86.Build.0 = Debug|Any CPU
3556
{9A10D4A1-2E7F-4DE2-AC96-49E2914800D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
3657
{9A10D4A1-2E7F-4DE2-AC96-49E2914800D7}.Release|Any CPU.Build.0 = Release|Any CPU
58+
{9A10D4A1-2E7F-4DE2-AC96-49E2914800D7}.Release|x64.ActiveCfg = Release|Any CPU
59+
{9A10D4A1-2E7F-4DE2-AC96-49E2914800D7}.Release|x64.Build.0 = Release|Any CPU
60+
{9A10D4A1-2E7F-4DE2-AC96-49E2914800D7}.Release|x86.ActiveCfg = Release|Any CPU
61+
{9A10D4A1-2E7F-4DE2-AC96-49E2914800D7}.Release|x86.Build.0 = Release|Any CPU
3762
{3EB8B2BF-4228-408D-93D8-5280AAB438A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
3863
{3EB8B2BF-4228-408D-93D8-5280AAB438A0}.Debug|Any CPU.Build.0 = Debug|Any CPU
64+
{3EB8B2BF-4228-408D-93D8-5280AAB438A0}.Debug|x64.ActiveCfg = Debug|Any CPU
65+
{3EB8B2BF-4228-408D-93D8-5280AAB438A0}.Debug|x64.Build.0 = Debug|Any CPU
66+
{3EB8B2BF-4228-408D-93D8-5280AAB438A0}.Debug|x86.ActiveCfg = Debug|Any CPU
67+
{3EB8B2BF-4228-408D-93D8-5280AAB438A0}.Debug|x86.Build.0 = Debug|Any CPU
3968
{3EB8B2BF-4228-408D-93D8-5280AAB438A0}.Release|Any CPU.ActiveCfg = Release|Any CPU
4069
{3EB8B2BF-4228-408D-93D8-5280AAB438A0}.Release|Any CPU.Build.0 = Release|Any CPU
70+
{3EB8B2BF-4228-408D-93D8-5280AAB438A0}.Release|x64.ActiveCfg = Release|Any CPU
71+
{3EB8B2BF-4228-408D-93D8-5280AAB438A0}.Release|x64.Build.0 = Release|Any CPU
72+
{3EB8B2BF-4228-408D-93D8-5280AAB438A0}.Release|x86.ActiveCfg = Release|Any CPU
73+
{3EB8B2BF-4228-408D-93D8-5280AAB438A0}.Release|x86.Build.0 = Release|Any CPU
4174
{92588047-1FE1-429A-8679-7B4FB39381F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
4275
{92588047-1FE1-429A-8679-7B4FB39381F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
76+
{92588047-1FE1-429A-8679-7B4FB39381F5}.Debug|x64.ActiveCfg = Debug|Any CPU
77+
{92588047-1FE1-429A-8679-7B4FB39381F5}.Debug|x64.Build.0 = Debug|Any CPU
78+
{92588047-1FE1-429A-8679-7B4FB39381F5}.Debug|x86.ActiveCfg = Debug|Any CPU
79+
{92588047-1FE1-429A-8679-7B4FB39381F5}.Debug|x86.Build.0 = Debug|Any CPU
4380
{92588047-1FE1-429A-8679-7B4FB39381F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
4481
{92588047-1FE1-429A-8679-7B4FB39381F5}.Release|Any CPU.Build.0 = Release|Any CPU
82+
{92588047-1FE1-429A-8679-7B4FB39381F5}.Release|x64.ActiveCfg = Release|Any CPU
83+
{92588047-1FE1-429A-8679-7B4FB39381F5}.Release|x64.Build.0 = Release|Any CPU
84+
{92588047-1FE1-429A-8679-7B4FB39381F5}.Release|x86.ActiveCfg = Release|Any CPU
85+
{92588047-1FE1-429A-8679-7B4FB39381F5}.Release|x86.Build.0 = Release|Any CPU
86+
{50159CB4-5913-4D77-9FE3-13588DCA300A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
87+
{50159CB4-5913-4D77-9FE3-13588DCA300A}.Debug|Any CPU.Build.0 = Debug|Any CPU
88+
{50159CB4-5913-4D77-9FE3-13588DCA300A}.Debug|x64.ActiveCfg = Debug|Any CPU
89+
{50159CB4-5913-4D77-9FE3-13588DCA300A}.Debug|x64.Build.0 = Debug|Any CPU
90+
{50159CB4-5913-4D77-9FE3-13588DCA300A}.Debug|x86.ActiveCfg = Debug|Any CPU
91+
{50159CB4-5913-4D77-9FE3-13588DCA300A}.Debug|x86.Build.0 = Debug|Any CPU
92+
{50159CB4-5913-4D77-9FE3-13588DCA300A}.Release|Any CPU.ActiveCfg = Release|Any CPU
93+
{50159CB4-5913-4D77-9FE3-13588DCA300A}.Release|Any CPU.Build.0 = Release|Any CPU
94+
{50159CB4-5913-4D77-9FE3-13588DCA300A}.Release|x64.ActiveCfg = Release|Any CPU
95+
{50159CB4-5913-4D77-9FE3-13588DCA300A}.Release|x64.Build.0 = Release|Any CPU
96+
{50159CB4-5913-4D77-9FE3-13588DCA300A}.Release|x86.ActiveCfg = Release|Any CPU
97+
{50159CB4-5913-4D77-9FE3-13588DCA300A}.Release|x86.Build.0 = Release|Any CPU
98+
{3416F900-58F9-4AB6-AC8A-95B03C7BD9A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
99+
{3416F900-58F9-4AB6-AC8A-95B03C7BD9A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
100+
{3416F900-58F9-4AB6-AC8A-95B03C7BD9A3}.Debug|x64.ActiveCfg = Debug|Any CPU
101+
{3416F900-58F9-4AB6-AC8A-95B03C7BD9A3}.Debug|x64.Build.0 = Debug|Any CPU
102+
{3416F900-58F9-4AB6-AC8A-95B03C7BD9A3}.Debug|x86.ActiveCfg = Debug|Any CPU
103+
{3416F900-58F9-4AB6-AC8A-95B03C7BD9A3}.Debug|x86.Build.0 = Debug|Any CPU
104+
{3416F900-58F9-4AB6-AC8A-95B03C7BD9A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
105+
{3416F900-58F9-4AB6-AC8A-95B03C7BD9A3}.Release|Any CPU.Build.0 = Release|Any CPU
106+
{3416F900-58F9-4AB6-AC8A-95B03C7BD9A3}.Release|x64.ActiveCfg = Release|Any CPU
107+
{3416F900-58F9-4AB6-AC8A-95B03C7BD9A3}.Release|x64.Build.0 = Release|Any CPU
108+
{3416F900-58F9-4AB6-AC8A-95B03C7BD9A3}.Release|x86.ActiveCfg = Release|Any CPU
109+
{3416F900-58F9-4AB6-AC8A-95B03C7BD9A3}.Release|x86.Build.0 = Release|Any CPU
110+
{7D2890FF-66F7-4870-BB89-952167AB0681}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
111+
{7D2890FF-66F7-4870-BB89-952167AB0681}.Debug|Any CPU.Build.0 = Debug|Any CPU
112+
{7D2890FF-66F7-4870-BB89-952167AB0681}.Debug|x64.ActiveCfg = Debug|Any CPU
113+
{7D2890FF-66F7-4870-BB89-952167AB0681}.Debug|x64.Build.0 = Debug|Any CPU
114+
{7D2890FF-66F7-4870-BB89-952167AB0681}.Debug|x86.ActiveCfg = Debug|Any CPU
115+
{7D2890FF-66F7-4870-BB89-952167AB0681}.Debug|x86.Build.0 = Debug|Any CPU
116+
{7D2890FF-66F7-4870-BB89-952167AB0681}.Release|Any CPU.ActiveCfg = Release|Any CPU
117+
{7D2890FF-66F7-4870-BB89-952167AB0681}.Release|Any CPU.Build.0 = Release|Any CPU
118+
{7D2890FF-66F7-4870-BB89-952167AB0681}.Release|x64.ActiveCfg = Release|Any CPU
119+
{7D2890FF-66F7-4870-BB89-952167AB0681}.Release|x64.Build.0 = Release|Any CPU
120+
{7D2890FF-66F7-4870-BB89-952167AB0681}.Release|x86.ActiveCfg = Release|Any CPU
121+
{7D2890FF-66F7-4870-BB89-952167AB0681}.Release|x86.Build.0 = Release|Any CPU
122+
{707E07BA-998C-49DE-BA56-7E9C0B6B7DBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
123+
{707E07BA-998C-49DE-BA56-7E9C0B6B7DBA}.Debug|Any CPU.Build.0 = Debug|Any CPU
124+
{707E07BA-998C-49DE-BA56-7E9C0B6B7DBA}.Debug|x64.ActiveCfg = Debug|Any CPU
125+
{707E07BA-998C-49DE-BA56-7E9C0B6B7DBA}.Debug|x64.Build.0 = Debug|Any CPU
126+
{707E07BA-998C-49DE-BA56-7E9C0B6B7DBA}.Debug|x86.ActiveCfg = Debug|Any CPU
127+
{707E07BA-998C-49DE-BA56-7E9C0B6B7DBA}.Debug|x86.Build.0 = Debug|Any CPU
128+
{707E07BA-998C-49DE-BA56-7E9C0B6B7DBA}.Release|Any CPU.ActiveCfg = Release|Any CPU
129+
{707E07BA-998C-49DE-BA56-7E9C0B6B7DBA}.Release|Any CPU.Build.0 = Release|Any CPU
130+
{707E07BA-998C-49DE-BA56-7E9C0B6B7DBA}.Release|x64.ActiveCfg = Release|Any CPU
131+
{707E07BA-998C-49DE-BA56-7E9C0B6B7DBA}.Release|x64.Build.0 = Release|Any CPU
132+
{707E07BA-998C-49DE-BA56-7E9C0B6B7DBA}.Release|x86.ActiveCfg = Release|Any CPU
133+
{707E07BA-998C-49DE-BA56-7E9C0B6B7DBA}.Release|x86.Build.0 = Release|Any CPU
134+
EndGlobalSection
135+
GlobalSection(SolutionProperties) = preSolution
136+
HideSolutionNode = FALSE
45137
EndGlobalSection
46138
GlobalSection(NestedProjects) = preSolution
47139
{9A10D4A1-2E7F-4DE2-AC96-49E2914800D7} = {89F559F6-C217-4D24-9A2F-DF25AE215A7C}
48140
{3EB8B2BF-4228-408D-93D8-5280AAB438A0} = {89F559F6-C217-4D24-9A2F-DF25AE215A7C}
49141
{92588047-1FE1-429A-8679-7B4FB39381F5} = {89F559F6-C217-4D24-9A2F-DF25AE215A7C}
50142
{0C407C1E-9E95-40A5-ABCA-52AACCC49C96} = {31F27C13-121E-4784-B06B-0FEF19817791}
51143
{97F0685F-BF3D-4F1F-B195-E33DD15C071E} = {0C407C1E-9E95-40A5-ABCA-52AACCC49C96}
144+
{BA3021C0-B64E-B700-D62A-004419E20C36} = {89F559F6-C217-4D24-9A2F-DF25AE215A7C}
145+
{50159CB4-5913-4D77-9FE3-13588DCA300A} = {BA3021C0-B64E-B700-D62A-004419E20C36}
146+
{3416F900-58F9-4AB6-AC8A-95B03C7BD9A3} = {BA3021C0-B64E-B700-D62A-004419E20C36}
147+
{7D2890FF-66F7-4870-BB89-952167AB0681} = {BA3021C0-B64E-B700-D62A-004419E20C36}
148+
{707E07BA-998C-49DE-BA56-7E9C0B6B7DBA} = {BA3021C0-B64E-B700-D62A-004419E20C36}
52149
EndGlobalSection
53150
EndGlobal
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.0.31903.59
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Global
7+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8+
Debug|Any CPU = Debug|Any CPU
9+
Release|Any CPU = Release|Any CPU
10+
EndGlobalSection
11+
GlobalSection(SolutionProperties) = preSolution
12+
HideSolutionNode = FALSE
13+
EndGlobalSection
14+
EndGlobal
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<Sdk Name="Aspire.AppHost.Sdk" Version="9.3.1" />
4+
5+
<PropertyGroup>
6+
<OutputType>Exe</OutputType>
7+
<TargetFramework>net9.0</TargetFramework>
8+
<ImplicitUsings>enable</ImplicitUsings>
9+
<Nullable>enable</Nullable>
10+
<IsAspireHost>true</IsAspireHost>
11+
<UserSecretsId>0177c1f9-bc41-4a2b-9dd3-cdd0d2e2f842</UserSecretsId>
12+
</PropertyGroup>
13+
14+
<ItemGroup>
15+
<PackageReference Include="Aspire.Hosting.AppHost" Version="9.3.1" />
16+
</ItemGroup>
17+
18+
<ItemGroup>
19+
<ProjectReference Include="..\AspireModularSample.ServiceA\AspireModularSample.ServiceA.csproj" />
20+
<ProjectReference Include="..\AspireModularSample.ServiceB\AspireModularSample.ServiceB.csproj" />
21+
</ItemGroup>
22+
23+
</Project>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
var builder = DistributedApplication.CreateBuilder(args);
2+
3+
var serviceA = builder.AddProject<Projects.AspireModularSample_ServiceA>("ServiceA");
4+
var serviceB = builder.AddProject<Projects.AspireModularSample_ServiceB>("ServiceB");
5+
6+
builder.Build().Run();
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"$schema": "https://json.schemastore.org/launchsettings.json",
3+
"profiles": {
4+
"http": {
5+
"commandName": "Project",
6+
"dotnetRunMessages": true,
7+
"launchBrowser": true,
8+
"applicationUrl": "http://localhost:15244",
9+
"environmentVariables": {
10+
"ASPNETCORE_ENVIRONMENT": "Development",
11+
"DOTNET_ENVIRONMENT": "Development",
12+
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:19113",
13+
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:20175"
14+
}
15+
}
16+
}
17+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft.AspNetCore": "Warning"
6+
}
7+
}
8+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft.AspNetCore": "Warning",
6+
"Aspire.Hosting.Dcp": "Warning"
7+
}
8+
}
9+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net9.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<ProjectReference Include="..\..\DispatchR\DispatchR.csproj" />
11+
</ItemGroup>
12+
13+
</Project>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using DispatchR.Requests.Send;
2+
3+
namespace AspireModularSample.Modules
4+
{
5+
public class Ping : IRequest<Ping, ValueTask<string>>
6+
{
7+
}
8+
9+
public class PingHandler : IRequestHandler<Ping, ValueTask<string>>
10+
{
11+
public ValueTask<string> Handle(Ping request, CancellationToken cancellationToken)
12+
{
13+
return ValueTask.FromResult("Ping from ServiceA");
14+
}
15+
}
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using DispatchR.Requests.Send;
2+
3+
namespace AspireModularSample.Modules
4+
{
5+
public class Pong : IRequest<Pong, ValueTask<string>>
6+
{
7+
}
8+
9+
public class PongHandler : IRequestHandler<Pong, ValueTask<string>>
10+
{
11+
public ValueTask<string> Handle(Pong request, CancellationToken cancellationToken)
12+
{
13+
return ValueTask.FromResult("Pong from ServiceB");
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)