-
-
Notifications
You must be signed in to change notification settings - Fork 502
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added full distribution of projections
- Loading branch information
1 parent
2e6f306
commit a9b1880
Showing
17 changed files
with
241 additions
and
9 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
File renamed without changes.
19 changes: 19 additions & 0 deletions
19
Sample/Helpdesk.ScaledUpProjections/Helpdesk.Kafka/Helpdesk.Kafka.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,19 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Marten.CommandLine" Version="6.0.5" /> | ||
<PackageReference Include="Marten" Version="6.0.5" /> | ||
<PackageReference Include="Confluent.Kafka" Version="2.2.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Helpdesk\Helpdesk.csproj" /> | ||
</ItemGroup> | ||
</Project> |
39 changes: 39 additions & 0 deletions
39
Sample/Helpdesk.ScaledUpProjections/Helpdesk.Kafka/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 System.Text.Json.Serialization; | ||
using Helpdesk; | ||
using Helpdesk.Api.Core.Kafka; | ||
using Marten.Events.Projections; | ||
using Microsoft.AspNetCore.Http.Json; | ||
using Microsoft.AspNetCore.SignalR; | ||
using Oakton; | ||
|
||
var builder = WebApplication.CreateBuilder(args); | ||
|
||
builder.Services | ||
.AddMartenForHelpdeskAsyncOnly( | ||
builder.Configuration, | ||
(options, _) => | ||
options.Projections.Add(new KafkaProducer(builder.Configuration), ProjectionLifecycle.Async) | ||
); | ||
|
||
builder.Services | ||
.Configure<JsonOptions>(o => o.SerializerOptions.Converters.Add(new JsonStringEnumConverter())) | ||
.Configure<Microsoft.AspNetCore.Mvc.JsonOptions>(o => | ||
o.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter())) | ||
.AddSignalR(); | ||
|
||
builder.Host.ApplyOaktonExtensions(); | ||
|
||
var app = builder.Build(); | ||
|
||
app.UseCors("ClientPermission"); | ||
app.MapHub<IncidentsHub>("/hubs/incidents"); | ||
|
||
return await app.RunOaktonCommands(args); | ||
|
||
public class IncidentsHub: Hub | ||
{ | ||
} | ||
|
||
public partial class Program | ||
{ | ||
} |
14 changes: 14 additions & 0 deletions
14
Sample/Helpdesk.ScaledUpProjections/Helpdesk.Kafka/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,14 @@ | ||
{ | ||
"profiles": { | ||
"Helpdesk.Kafka": { | ||
"commandName": "Project", | ||
"dotnetRunMessages": true, | ||
"launchBrowser": true, | ||
"launchUrl": "swagger/index.html", | ||
"applicationUrl": "http://localhost:5250", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
} | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
Sample/Helpdesk.ScaledUpProjections/Helpdesk.Kafka/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" | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
Sample/Helpdesk.ScaledUpProjections/Helpdesk.Kafka/appsettings.Production.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,18 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.AspNetCore": "Warning" | ||
} | ||
}, | ||
"AllowedHosts": "*", | ||
"ConnectionStrings": { | ||
"Incidents": "PORT = 5432; HOST = postgres; TIMEOUT = 15; POOLING = True; MINPOOLSIZE = 1; MAXPOOLSIZE = 100; COMMANDTIMEOUT = 20; DATABASE = 'postgres'; PASSWORD = 'Password12!'; USER ID = 'postgres'" | ||
}, | ||
"KafkaProducer": { | ||
"ProducerConfig": { | ||
"BootstrapServers": "kafka:9092" | ||
}, | ||
"Topic": "Incidents" | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
Sample/Helpdesk.ScaledUpProjections/Helpdesk.Kafka/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,21 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.AspNetCore": "Warning" | ||
} | ||
}, | ||
"AllowedHosts": "*", | ||
"ConnectionStrings": { | ||
"Incidents": "PORT = 5432; HOST = localhost; TIMEOUT = 15; POOLING = True; MINPOOLSIZE = 1; MAXPOOLSIZE = 100; COMMANDTIMEOUT = 20; DATABASE = 'postgres'; PASSWORD = 'Password12!'; USER ID = 'postgres'" | ||
}, | ||
"KafkaProducer": { | ||
"ProducerConfig": { | ||
"BootstrapServers": "localhost:9092" | ||
}, | ||
"Topic": "Incidents" | ||
}, | ||
"Helpdesk": { | ||
"DaemonLockId": 7777 | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
Sample/Helpdesk.ScaledUpProjections/Helpdesk.Projections/Helpdesk.Projections.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,18 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Marten.CommandLine" Version="6.0.5" /> | ||
<PackageReference Include="Marten" Version="6.0.5" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Helpdesk\Helpdesk.csproj" /> | ||
</ItemGroup> | ||
</Project> |
30 changes: 30 additions & 0 deletions
30
Sample/Helpdesk.ScaledUpProjections/Helpdesk.Projections/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,30 @@ | ||
using System.Text.Json.Serialization; | ||
using Helpdesk; | ||
using Helpdesk.Incidents.GetCustomerIncidentsSummary; | ||
using Marten.Events.Projections; | ||
using Microsoft.AspNetCore.Http.Json; | ||
using Oakton; | ||
|
||
var builder = WebApplication.CreateBuilder(args); | ||
|
||
builder.Services | ||
.AddMartenForHelpdeskAsyncOnly( | ||
builder.Configuration, | ||
(options, _) => | ||
options.Projections.Add<CustomerIncidentsSummaryProjection>(ProjectionLifecycle.Async) | ||
); | ||
|
||
builder.Services | ||
.Configure<JsonOptions>(o => o.SerializerOptions.Converters.Add(new JsonStringEnumConverter())) | ||
.Configure<Microsoft.AspNetCore.Mvc.JsonOptions>(o => | ||
o.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter())); | ||
|
||
builder.Host.ApplyOaktonExtensions(); | ||
|
||
var app = builder.Build(); | ||
|
||
return await app.RunOaktonCommands(args); | ||
|
||
public partial class Program | ||
{ | ||
} |
14 changes: 14 additions & 0 deletions
14
Sample/Helpdesk.ScaledUpProjections/Helpdesk.Projections/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,14 @@ | ||
{ | ||
"profiles": { | ||
"Helpdesk.Projections": { | ||
"commandName": "Project", | ||
"dotnetRunMessages": true, | ||
"launchBrowser": true, | ||
"launchUrl": "swagger/index.html", | ||
"applicationUrl": "http://localhost:5251", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
} | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
Sample/Helpdesk.ScaledUpProjections/Helpdesk.Projections/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" | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
Sample/Helpdesk.ScaledUpProjections/Helpdesk.Projections/appsettings.Production.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,18 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.AspNetCore": "Warning" | ||
} | ||
}, | ||
"AllowedHosts": "*", | ||
"ConnectionStrings": { | ||
"Incidents": "PORT = 5432; HOST = postgres; TIMEOUT = 15; POOLING = True; MINPOOLSIZE = 1; MAXPOOLSIZE = 100; COMMANDTIMEOUT = 20; DATABASE = 'postgres'; PASSWORD = 'Password12!'; USER ID = 'postgres'" | ||
}, | ||
"KafkaProducer": { | ||
"ProducerConfig": { | ||
"BootstrapServers": "kafka:9092" | ||
}, | ||
"Topic": "Incidents" | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
Sample/Helpdesk.ScaledUpProjections/Helpdesk.Projections/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,21 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.AspNetCore": "Warning" | ||
} | ||
}, | ||
"AllowedHosts": "*", | ||
"ConnectionStrings": { | ||
"Incidents": "PORT = 5432; HOST = localhost; TIMEOUT = 15; POOLING = True; MINPOOLSIZE = 1; MAXPOOLSIZE = 100; COMMANDTIMEOUT = 20; DATABASE = 'postgres'; PASSWORD = 'Password12!'; USER ID = 'postgres'" | ||
}, | ||
"KafkaProducer": { | ||
"ProducerConfig": { | ||
"BootstrapServers": "localhost:9092" | ||
}, | ||
"Topic": "Incidents" | ||
}, | ||
"Helpdesk": { | ||
"DaemonLockId": 5555 | ||
} | ||
} |
6 changes: 0 additions & 6 deletions
6
Sample/Helpdesk.ScaledUpProjections/Helpdesk.SignalR/.dockerignore
This file was deleted.
Oops, something went wrong.
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
3 changes: 1 addition & 2 deletions
3
Sample/Helpdesk.ScaledUpProjections/Helpdesk/StorageConfiguration.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