Skip to content

Commit

Permalink
Add Akka.Discovery.Config support (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
Arkatufus authored May 24, 2023
1 parent 5918ca7 commit 5fd96e1
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 14 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,10 @@ paket-files/
# FAKE - F# Make
.fake/

# JetBrains Rider
.idea/
*.sln.iml

# CodeRush personal settings
.cr/personal

Expand Down
1 change: 0 additions & 1 deletion src/WebApiTemplate/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
tools/
.nuget/
.dotnet/
.idea/
.[Dd][Ss]_[Ss]tore

## NBench output
Expand Down
10 changes: 5 additions & 5 deletions src/WebApiTemplate/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<!-- Akka.NET Package Versions -->
<ItemGroup>
<PackageVersion Include="Akka" Version="1.5.7" />
<PackageVersion Include="Akka.Cluster.Hosting" Version="1.5.6.1" />
<PackageVersion Include="Akka.Discovery.Azure" Version="1.5.5" />
<PackageVersion Include="Akka.Cluster.Hosting" Version="1.5.7" />
<PackageVersion Include="Akka.Discovery.Azure" Version="1.5.7" />
<PackageVersion Include="Akka.HealthCheck.Hosting.Web" Version="1.5.2" />
<PackageVersion Include="Akka.Management" Version="1.5.5" />
<PackageVersion Include="Akka.Management" Version="1.5.7" />
<PackageVersion Include="Akka.Persistence.Azure.Hosting" Version="1.5.1" />
<PackageVersion Include="Microsoft.NET.Build.Containers" Version="7.0.302" />
<PackageVersion Include="Petabridge.Cmd.Cluster.Sharding" Version="$(PbmVersion)" />
Expand All @@ -30,7 +30,7 @@
<PackageVersion Include="xunit" Version="2.4.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.4.5" />
<PackageVersion Include="FluentAssertions" Version="6.11.0" />
<PackageVersion Include="coverlet.collector" Version="3.2.0" />
<PackageVersion Include="Akka.Hosting.TestKit" Version="1.5.6.1" />
<PackageVersion Include="coverlet.collector" Version="6.0.0" />
<PackageVersion Include="Akka.Hosting.TestKit" Version="1.5.7" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Akka.Cluster.Sharding;
using Akka.Configuration;
using Akka.Discovery.Azure;
using Akka.Discovery.Config.Hosting;
using Akka.Hosting;
using Akka.Management;
using Akka.Management.Cluster.Bootstrap;
Expand Down Expand Up @@ -99,7 +100,21 @@ public static AkkaConfigurationBuilder ConfigureNetwork(this AkkaConfigurationBu
break;
}
case DiscoveryMethod.Config:
{
b = b
.WithConfigDiscovery(options =>
{
options.Services.Add(new Service
{
Name = settings.AkkaManagementOptions.ServiceName,
Endpoints = new[]
{
$"{settings.AkkaManagementOptions.Hostname}:{settings.AkkaManagementOptions.Port}",
}
});
});
break;
}
default:
throw new ArgumentOutOfRangeException();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@
<PackageReference Include="Swashbuckle.AspNetCore" />
</ItemGroup>

<ItemGroup>
<Content Include="..\.dockerignore">
<Link>.dockerignore</Link>
</Content>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\WebApiTemplate.Domain\WebApiTemplate.Domain.csproj" />
</ItemGroup>
Expand Down
5 changes: 3 additions & 2 deletions src/WebApiTemplate/src/WebApiTemplate.App/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@
"Role": "web-api"
},
"AkkaManagementOptions": {
"Enabled": false,
"Enabled": true,
"Hostname": "localhost",
"PortName": "management",
"ServiceName": "akka-management",
"RequiredContactPointsNr": 3,
"RequiredContactPointsNr": 1,
"DiscoveryMethod": "Config"
},
"PersistenceMode": "InMemory"
Expand Down

0 comments on commit 5fd96e1

Please sign in to comment.