added two samples
This commit is contained in:
15
wolverine-nats/WolverineAndNats/.idea/.idea.WolverineAndNats/.idea/.gitignore
generated
vendored
Normal file
15
wolverine-nats/WolverineAndNats/.idea/.idea.WolverineAndNats/.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Rider ignored files
|
||||
/contentModel.xml
|
||||
/modules.xml
|
||||
/projectSettingsUpdater.xml
|
||||
/.idea.WolverineAndNats.iml
|
||||
# Ignored default folder with query files
|
||||
/queries/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AgentMigrationStateService">
|
||||
<option name="migrationStatus" value="COMPLETED" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Ask2AgentMigrationStateService">
|
||||
<option name="migrationStatus" value="COMPLETED" />
|
||||
</component>
|
||||
</project>
|
||||
19
wolverine-nats/WolverineAndNats/.idea/.idea.WolverineAndNats/.idea/dataSources.xml
generated
Normal file
19
wolverine-nats/WolverineAndNats/.idea/.idea.WolverineAndNats/.idea/dataSources.xml
generated
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="pg" uuid="ce1a7cb8-729e-46fe-9898-8bf0c03ad5cf">
|
||||
<driver-ref>postgresql</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>org.postgresql.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:postgresql://localhost:51238/?password=v0%7Ew8n1%7BE%29KYsw-1*3st0R&user=postgres</jdbc-url>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
<data-source source="LOCAL" name="pg" uuid="567fbbf8-b474-4c51-b1d6-afcfe5c05a76">
|
||||
<driver-ref>postgresql</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>org.postgresql.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:postgresql://localhost:54454/?password=v0%7Ew8n1%7BE%29KYsw-1*3st0R&user=postgres</jdbc-url>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
||||
6
wolverine-nats/WolverineAndNats/.idea/.idea.WolverineAndNats/.idea/db-forest-config.xml
generated
Normal file
6
wolverine-nats/WolverineAndNats/.idea/.idea.WolverineAndNats/.idea/db-forest-config.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="db-tree-configuration">
|
||||
<option name="data" value="---------------------------------------- 1:0:ce1a7cb8-729e-46fe-9898-8bf0c03ad5cf 2:0:567fbbf8-b474-4c51-b1d6-afcfe5c05a76 " />
|
||||
</component>
|
||||
</project>
|
||||
4
wolverine-nats/WolverineAndNats/.idea/.idea.WolverineAndNats/.idea/encodings.xml
generated
Normal file
4
wolverine-nats/WolverineAndNats/.idea/.idea.WolverineAndNats/.idea/encodings.xml
generated
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
|
||||
</project>
|
||||
8
wolverine-nats/WolverineAndNats/.idea/.idea.WolverineAndNats/.idea/indexLayout.xml
generated
Normal file
8
wolverine-nats/WolverineAndNats/.idea/.idea.WolverineAndNats/.idea/indexLayout.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="UserContentModel">
|
||||
<attachedFolders />
|
||||
<explicitIncludes />
|
||||
<explicitExcludes />
|
||||
</component>
|
||||
</project>
|
||||
7
wolverine-nats/WolverineAndNats/.idea/.idea.WolverineAndNats/.idea/vcs.xml
generated
Normal file
7
wolverine-nats/WolverineAndNats/.idea/.idea.WolverineAndNats/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
20
wolverine-nats/WolverineAndNats/ApiOne/ApiOne.csproj
Normal file
20
wolverine-nats/WolverineAndNats/ApiOne/ApiOne.csproj
Normal file
@@ -0,0 +1,20 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Messages\Messages.csproj" />
|
||||
<ProjectReference Include="..\ServiceDefaults\ServiceDefaults.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Aspire.Npgsql" Version="13.1.0" />
|
||||
<PackageReference Include="WolverineFx.Marten" Version="5.13.0" />
|
||||
<PackageReference Include="WolverineFx.Nats" Version="5.13.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,44 @@
|
||||
using Messages;
|
||||
using Wolverine;
|
||||
|
||||
namespace ApiOne.Endpoints;
|
||||
|
||||
public static class Extensions
|
||||
{
|
||||
extension(IEndpointRouteBuilder endpoints)
|
||||
{
|
||||
public IEndpointRouteBuilder MapApiOneEndpoints()
|
||||
{
|
||||
endpoints.MapPost("/messages", async (SendMessage request, IMessageBus messageBus) =>
|
||||
{
|
||||
await messageBus.PublishAsync(request);
|
||||
return Results.Accepted();
|
||||
});
|
||||
|
||||
endpoints.MapPost("/math", async (AddThem request, IMessageBus bus) =>
|
||||
{
|
||||
var result = await bus.InvokeAsync<NumbersAdded>(request);
|
||||
return Results.Ok(result);
|
||||
});
|
||||
|
||||
endpoints.MapPost("/users", async (UserCreate user, IMessageBus bus) =>
|
||||
{
|
||||
var doc = new UserDocument(Guid.NewGuid(), user.Name);
|
||||
await bus.PublishAsync(doc);
|
||||
return Results.Accepted();
|
||||
});
|
||||
endpoints.MapPut("/users/{id:guid}/name", async (Guid id, UserCreate user, IMessageBus bus) =>
|
||||
{
|
||||
var nameChanged = new UserNameChanged(id, user.Name);
|
||||
await bus.PublishAsync(nameChanged);
|
||||
return Results.Accepted();
|
||||
});
|
||||
|
||||
return endpoints;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public record UserCreate(string Name);
|
||||
|
||||
|
||||
56
wolverine-nats/WolverineAndNats/ApiOne/Program.cs
Normal file
56
wolverine-nats/WolverineAndNats/ApiOne/Program.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using ApiOne.Endpoints;
|
||||
using Marten;
|
||||
using Messages;
|
||||
using Wolverine;
|
||||
using Wolverine.Marten;
|
||||
using Wolverine.Nats;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.AddServiceDefaults();
|
||||
builder.AddNpgsqlDataSource("db-one");
|
||||
|
||||
builder.UseWolverine(options =>
|
||||
{
|
||||
options.UseNats(builder.Configuration.GetConnectionString("nats") ??
|
||||
throw new Exception("No NATS connection string configured"))
|
||||
.AutoProvision()
|
||||
.UseJetStream(js =>
|
||||
{
|
||||
js.MaxDeliver = 5;
|
||||
js.AckWait = TimeSpan.FromSeconds(30);
|
||||
})
|
||||
|
||||
.DefineStream("PEOPLE", stream =>
|
||||
stream.WithSubject("people.>")
|
||||
.WithLimits(maxMessages: 5_000, maxAge: TimeSpan.FromDays(5))
|
||||
//.WithReplicas(3)
|
||||
.EnableScheduledDelivery());
|
||||
|
||||
|
||||
|
||||
options.PublishMessage<SendMessage>()
|
||||
.ToNatsSubject("messages-sent");
|
||||
|
||||
options.PublishMessage<UserDocument>()
|
||||
.ToNatsSubject("people.created");
|
||||
options.PublishMessage<UserNameChanged>()
|
||||
.ToNatsSubject("people.name-changed");
|
||||
|
||||
options.PublishMessage<AddThem>()
|
||||
.ToNatsSubject("math.add");
|
||||
|
||||
});
|
||||
|
||||
builder.Services.AddMarten(config =>
|
||||
{
|
||||
|
||||
}).UseLightweightSessions()
|
||||
.IntegrateWithWolverine()
|
||||
.UseNpgsqlDataSource();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
app.MapGet("/", () => "Hello World!");
|
||||
app.MapApiOneEndpoints();
|
||||
app.MapDefaultEndpoints();
|
||||
app.Run();
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||
"profiles": {
|
||||
|
||||
"https": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": false,
|
||||
"applicationUrl": "https://apione.dev.localhost:7131",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
||||
10
wolverine-nats/WolverineAndNats/ApiOne/appsettings.json
Normal file
10
wolverine-nats/WolverineAndNats/ApiOne/appsettings.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning",
|
||||
"Npgsql": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/ApiOne
Executable file
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/ApiOne
Executable file
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"runtimeOptions": {
|
||||
"tfm": "net10.0",
|
||||
"frameworks": [
|
||||
{
|
||||
"name": "Microsoft.NETCore.App",
|
||||
"version": "10.0.0"
|
||||
},
|
||||
{
|
||||
"name": "Microsoft.AspNetCore.App",
|
||||
"version": "10.0.0"
|
||||
}
|
||||
],
|
||||
"configProperties": {
|
||||
"System.GC.Server": true,
|
||||
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"Version":1,"ManifestType":"Build","Endpoints":[]}
|
||||
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/Aspire.Npgsql.dll
Executable file
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/Aspire.Npgsql.dll
Executable file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/FSharp.Core.dll
Executable file
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/FSharp.Core.dll
Executable file
Binary file not shown.
Binary file not shown.
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/HealthChecks.NpgSql.dll
Executable file
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/HealthChecks.NpgSql.dll
Executable file
Binary file not shown.
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/Humanizer.dll
Executable file
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/Humanizer.dll
Executable file
Binary file not shown.
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/JasperFx.Events.dll
Executable file
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/JasperFx.Events.dll
Executable file
Binary file not shown.
Binary file not shown.
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/JasperFx.dll
Executable file
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/JasperFx.dll
Executable file
Binary file not shown.
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/Marten.dll
Executable file
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/Marten.dll
Executable file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/NATS.Client.Core.dll
Executable file
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/NATS.Client.Core.dll
Executable file
Binary file not shown.
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/NATS.Client.Hosting.dll
Executable file
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/NATS.Client.Hosting.dll
Executable file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/NATS.Net.dll
Executable file
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/NATS.Net.dll
Executable file
Binary file not shown.
Binary file not shown.
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/NetTopologySuite.dll
Executable file
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/NetTopologySuite.dll
Executable file
Binary file not shown.
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/NewId.dll
Executable file
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/NewId.dll
Executable file
Binary file not shown.
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/Newtonsoft.Json.dll
Executable file
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/Newtonsoft.Json.dll
Executable file
Binary file not shown.
Binary file not shown.
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/Npgsql.Json.NET.dll
Executable file
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/Npgsql.Json.NET.dll
Executable file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/Npgsql.dll
Executable file
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/Npgsql.dll
Executable file
Binary file not shown.
Binary file not shown.
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/OpenTelemetry.Api.dll
Executable file
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/OpenTelemetry.Api.dll
Executable file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/OpenTelemetry.dll
Executable file
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/OpenTelemetry.dll
Executable file
Binary file not shown.
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/Polly.Core.dll
Executable file
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/Polly.Core.dll
Executable file
Binary file not shown.
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/Polly.Extensions.dll
Executable file
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/Polly.Extensions.dll
Executable file
Binary file not shown.
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/Polly.RateLimiting.dll
Executable file
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/Polly.RateLimiting.dll
Executable file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/Spectre.Console.dll
Executable file
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/Spectre.Console.dll
Executable file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/Weasel.Core.dll
Executable file
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/Weasel.Core.dll
Executable file
Binary file not shown.
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/Weasel.Postgresql.dll
Executable file
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/Weasel.Postgresql.dll
Executable file
Binary file not shown.
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/Wolverine.Marten.dll
Executable file
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/Wolverine.Marten.dll
Executable file
Binary file not shown.
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/Wolverine.Nats.dll
Executable file
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/Wolverine.Nats.dll
Executable file
Binary file not shown.
Binary file not shown.
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/Wolverine.RDBMS.dll
Executable file
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/Wolverine.RDBMS.dll
Executable file
Binary file not shown.
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/Wolverine.dll
Executable file
BIN
wolverine-nats/WolverineAndNats/ApiOne/bin/Debug/net10.0/Wolverine.dll
Executable file
Binary file not shown.
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user