-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Eventing API content, getting closer
- Loading branch information
1 parent
ddf62a1
commit a73f680
Showing
11 changed files
with
163 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
docs/app-host/snippets/AspireApp/AspireApp.ResourceAppHost/AspireApp.ResourceAppHost.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<Sdk Name="Aspire.AppHost.Sdk" Version="9.0.0-rc.1.24511.1" /> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net9.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<IsAspireHost>true</IsAspireHost> | ||
<UserSecretsId>7b352f08-305b-4032-9a21-90deb02efc04</UserSecretsId> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\AspireApp.ApiService\AspireApp.ApiService.csproj" /> | ||
<ProjectReference Include="..\AspireApp.Web\AspireApp.Web.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Aspire.Hosting.AppHost" Version="9.0.0-rc.1.24511.1" /> | ||
<PackageReference Include="Aspire.Hosting.Redis" Version="9.0.0-rc.1.24511.1" /> | ||
</ItemGroup> | ||
|
||
</Project> |
16 changes: 16 additions & 0 deletions
16
docs/app-host/snippets/AspireApp/AspireApp.ResourceAppHost/Console.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
info: Aspire.Hosting.DistributedApplication[0] | ||
Aspire version: 9.0.0 | ||
info: Aspire.Hosting.DistributedApplication[0] | ||
Distributed application starting. | ||
info: Aspire.Hosting.DistributedApplication[0] | ||
Application host directory is: ..\AspireApp\AspireApp.AppHost | ||
info: Program[0] | ||
1. ConnectionStringAvailableEvent | ||
info: Program[0] | ||
2. BeforeResourceStartedEvent | ||
info: Aspire.Hosting.DistributedApplication[0] | ||
Now listening on: https://localhost:17222 | ||
info: Aspire.Hosting.DistributedApplication[0] | ||
Login to the dashboard at https://localhost:17222/login?t=<YOUR_TOKEN> | ||
info: Aspire.Hosting.DistributedApplication[0] | ||
Distributed application started. Press Ctrl+C to shut down. |
39 changes: 39 additions & 0 deletions
39
docs/app-host/snippets/AspireApp/AspireApp.ResourceAppHost/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Logging; | ||
|
||
var builder = DistributedApplication.CreateBuilder(args); | ||
|
||
var cache = builder.AddRedis("cache"); | ||
|
||
_ = builder.Eventing.Subscribe<BeforeResourceStartedEvent>( | ||
cache.Resource, | ||
static (@event, cancellationToken) => | ||
{ | ||
var logger = @event.Services.GetRequiredService<ILogger<Program>>(); | ||
|
||
logger.LogInformation("2. BeforeResourceStartedEvent"); | ||
|
||
return Task.CompletedTask; | ||
}); | ||
|
||
_ = builder.Eventing.Subscribe<ConnectionStringAvailableEvent>( | ||
cache.Resource, | ||
static (@event, cancellationToken) => | ||
{ | ||
var logger = @event.Services.GetRequiredService<ILogger<Program>>(); | ||
|
||
logger.LogInformation("1. ConnectionStringAvailableEvent"); | ||
|
||
return Task.CompletedTask; | ||
}); | ||
|
||
var apiService = builder.AddProject<Projects.AspireApp_ApiService>("apiservice"); | ||
|
||
builder.AddProject<Projects.AspireApp_Web>("webfrontend") | ||
.WithExternalHttpEndpoints() | ||
.WithReference(cache) | ||
.WaitFor(cache) | ||
.WithReference(apiService) | ||
.WaitFor(apiService); | ||
|
||
builder.Build().Run(); |
29 changes: 29 additions & 0 deletions
29
docs/app-host/snippets/AspireApp/AspireApp.ResourceAppHost/Properties/launchSettings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/launchsettings.json", | ||
"profiles": { | ||
"https": { | ||
"commandName": "Project", | ||
"dotnetRunMessages": true, | ||
"launchBrowser": true, | ||
"applicationUrl": "https://localhost:17222;http://localhost:15197", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development", | ||
"DOTNET_ENVIRONMENT": "Development", | ||
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21272", | ||
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22185" | ||
} | ||
}, | ||
"http": { | ||
"commandName": "Project", | ||
"dotnetRunMessages": true, | ||
"launchBrowser": true, | ||
"applicationUrl": "http://localhost:15197", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development", | ||
"DOTNET_ENVIRONMENT": "Development", | ||
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:19149", | ||
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:20298" | ||
} | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
docs/app-host/snippets/AspireApp/AspireApp.ResourceAppHost/appsettings.Development.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.AspNetCore": "Warning" | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
docs/app-host/snippets/AspireApp/AspireApp.ResourceAppHost/appsettings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.AspNetCore": "Warning", | ||
"Aspire.Hosting.Dcp": "Warning" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters