Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions ProtoActor.sln
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SkyriseMiniClient", "benchm
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SkyriseMiniServer", "benchmarks\SkyriseMini\Server\SkyriseMiniServer.csproj", "{7C08B7D5-90BD-45E9-BADF-1B6CEB1A3E97}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AspNetGrains", "AspNetGrains", "{85F44707-946F-453E-9969-E3CDA6CB8F3C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Node1", "examples\AspNetGrains\Node1\Node1.csproj", "{FBD971F3-689A-491D-986B-B9ADBE0656B6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Node2", "examples\AspNetGrains\Node2\Node2.csproj", "{296010B4-B52A-4049-9C0D-497B7AC21C32}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Messages", "examples\AspNetGrains\Messages\Messages.csproj", "{82D29895-93F1-4BD6-938D-7BEDD4D1D2BF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -1274,6 +1282,42 @@ Global
{7C08B7D5-90BD-45E9-BADF-1B6CEB1A3E97}.Release|x64.Build.0 = Release|Any CPU
{7C08B7D5-90BD-45E9-BADF-1B6CEB1A3E97}.Release|x86.ActiveCfg = Release|Any CPU
{7C08B7D5-90BD-45E9-BADF-1B6CEB1A3E97}.Release|x86.Build.0 = Release|Any CPU
{FBD971F3-689A-491D-986B-B9ADBE0656B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FBD971F3-689A-491D-986B-B9ADBE0656B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FBD971F3-689A-491D-986B-B9ADBE0656B6}.Debug|x64.ActiveCfg = Debug|Any CPU
{FBD971F3-689A-491D-986B-B9ADBE0656B6}.Debug|x64.Build.0 = Debug|Any CPU
{FBD971F3-689A-491D-986B-B9ADBE0656B6}.Debug|x86.ActiveCfg = Debug|Any CPU
{FBD971F3-689A-491D-986B-B9ADBE0656B6}.Debug|x86.Build.0 = Debug|Any CPU
{FBD971F3-689A-491D-986B-B9ADBE0656B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FBD971F3-689A-491D-986B-B9ADBE0656B6}.Release|Any CPU.Build.0 = Release|Any CPU
{FBD971F3-689A-491D-986B-B9ADBE0656B6}.Release|x64.ActiveCfg = Release|Any CPU
{FBD971F3-689A-491D-986B-B9ADBE0656B6}.Release|x64.Build.0 = Release|Any CPU
{FBD971F3-689A-491D-986B-B9ADBE0656B6}.Release|x86.ActiveCfg = Release|Any CPU
{FBD971F3-689A-491D-986B-B9ADBE0656B6}.Release|x86.Build.0 = Release|Any CPU
{296010B4-B52A-4049-9C0D-497B7AC21C32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{296010B4-B52A-4049-9C0D-497B7AC21C32}.Debug|Any CPU.Build.0 = Debug|Any CPU
{296010B4-B52A-4049-9C0D-497B7AC21C32}.Debug|x64.ActiveCfg = Debug|Any CPU
{296010B4-B52A-4049-9C0D-497B7AC21C32}.Debug|x64.Build.0 = Debug|Any CPU
{296010B4-B52A-4049-9C0D-497B7AC21C32}.Debug|x86.ActiveCfg = Debug|Any CPU
{296010B4-B52A-4049-9C0D-497B7AC21C32}.Debug|x86.Build.0 = Debug|Any CPU
{296010B4-B52A-4049-9C0D-497B7AC21C32}.Release|Any CPU.ActiveCfg = Release|Any CPU
{296010B4-B52A-4049-9C0D-497B7AC21C32}.Release|Any CPU.Build.0 = Release|Any CPU
{296010B4-B52A-4049-9C0D-497B7AC21C32}.Release|x64.ActiveCfg = Release|Any CPU
{296010B4-B52A-4049-9C0D-497B7AC21C32}.Release|x64.Build.0 = Release|Any CPU
{296010B4-B52A-4049-9C0D-497B7AC21C32}.Release|x86.ActiveCfg = Release|Any CPU
{296010B4-B52A-4049-9C0D-497B7AC21C32}.Release|x86.Build.0 = Release|Any CPU
{82D29895-93F1-4BD6-938D-7BEDD4D1D2BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{82D29895-93F1-4BD6-938D-7BEDD4D1D2BF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{82D29895-93F1-4BD6-938D-7BEDD4D1D2BF}.Debug|x64.ActiveCfg = Debug|Any CPU
{82D29895-93F1-4BD6-938D-7BEDD4D1D2BF}.Debug|x64.Build.0 = Debug|Any CPU
{82D29895-93F1-4BD6-938D-7BEDD4D1D2BF}.Debug|x86.ActiveCfg = Debug|Any CPU
{82D29895-93F1-4BD6-938D-7BEDD4D1D2BF}.Debug|x86.Build.0 = Debug|Any CPU
{82D29895-93F1-4BD6-938D-7BEDD4D1D2BF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{82D29895-93F1-4BD6-938D-7BEDD4D1D2BF}.Release|Any CPU.Build.0 = Release|Any CPU
{82D29895-93F1-4BD6-938D-7BEDD4D1D2BF}.Release|x64.ActiveCfg = Release|Any CPU
{82D29895-93F1-4BD6-938D-7BEDD4D1D2BF}.Release|x64.Build.0 = Release|Any CPU
{82D29895-93F1-4BD6-938D-7BEDD4D1D2BF}.Release|x86.ActiveCfg = Release|Any CPU
{82D29895-93F1-4BD6-938D-7BEDD4D1D2BF}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1392,6 +1436,10 @@ Global
{DF09798D-20CC-418C-901B-DEFEEFF02E1B} = {0F3AB331-C042-4371-A2F0-0AFDFA13DC9F}
{8B0466D8-C57E-4D29-98B3-CB2D087765DC} = {DF09798D-20CC-418C-901B-DEFEEFF02E1B}
{7C08B7D5-90BD-45E9-BADF-1B6CEB1A3E97} = {DF09798D-20CC-418C-901B-DEFEEFF02E1B}
{85F44707-946F-453E-9969-E3CDA6CB8F3C} = {59DCCC96-DDAF-469F-9E8E-9BC733285082}
{FBD971F3-689A-491D-986B-B9ADBE0656B6} = {85F44707-946F-453E-9969-E3CDA6CB8F3C}
{296010B4-B52A-4049-9C0D-497B7AC21C32} = {85F44707-946F-453E-9969-E3CDA6CB8F3C}
{82D29895-93F1-4BD6-938D-7BEDD4D1D2BF} = {85F44707-946F-453E-9969-E3CDA6CB8F3C}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CD0D1E44-8118-4682-8793-6B20ABFA824C}
Expand Down
34 changes: 0 additions & 34 deletions benchmarks/HostedService/Controllers/WeatherForecastController.cs

This file was deleted.

4 changes: 4 additions & 0 deletions benchmarks/HostedService/HostedService.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@
<ProjectReference Include="..\..\src\Proto.Cluster\Proto.Cluster.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="Controllers" />
</ItemGroup>

</Project>
14 changes: 0 additions & 14 deletions benchmarks/HostedService/WeatherForecast.cs

This file was deleted.

21 changes: 21 additions & 0 deletions examples/AspNetGrains/Messages/Messages.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.21.6" />
<PackageReference Include="Grpc.Tools" Version="2.48.1" PrivateAssets="All" />
<PackageReference Include="Proto.Cluster.CodeGen" Version="1.0.0-rc3.15" />
</ItemGroup>
<ItemGroup>
<Protobuf Include="Protos.proto" />
</ItemGroup>
<ItemGroup>
<ProtoGrain Include="Protos.proto" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\src\Proto.Cluster\Proto.Cluster.csproj" />
</ItemGroup>

</Project>
12 changes: 12 additions & 0 deletions examples/AspNetGrains/Messages/Protos.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
syntax = "proto3";
package HelloHelloWorld;
option csharp_namespace = "AspNetGrains.Messages";

message HelloRequest {}
message HelloResponse {
string Message=1;
}

service HelloGrain {
rpc SayHello(HelloRequest) returns (HelloResponse) {}
}
14 changes: 14 additions & 0 deletions examples/AspNetGrains/Node1/Node1.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\src\Proto.Cluster\Proto.Cluster.csproj" />
<ProjectReference Include="..\Messages\Messages.csproj" />
</ItemGroup>

</Project>
30 changes: 30 additions & 0 deletions examples/AspNetGrains/Node1/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using AspNetGrains.Messages;
using Proto;
using Proto.Cluster;
using Proto.Cluster.Seed;
using Proto.Remote;
using Proto.Remote.Healthchecks;

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddLogging(x => x.AddConsole());

builder.Services.AddProtoCluster("MyCluster",
configureRemote: r => r.WithProtoMessages(AspNetGrains.Messages.ProtosReflection.Descriptor),
configureCluster: c => c, clusterProvider:SeedNodeClusterProvider.JoinSeedNode("localhost",8090));

builder.Services.AddHealthChecks().AddCheck<ActorSystemHealthCheck>("proto", null, new[] { "ready", "live" });

var app = builder.Build();

app.MapGet("/", async (Cluster cluster) =>
{
var helloGrain = cluster.GetHelloGrain("MyGrain");

var res = await helloGrain.SayHello(new HelloRequest(), CancellationTokens.FromSeconds(5));
Console.WriteLine(res.Message);

res = await helloGrain.SayHello(new HelloRequest(), CancellationTokens.FromSeconds(5));
return res.Message;
});

app.Run();
28 changes: 28 additions & 0 deletions examples/AspNetGrains/Node1/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:33861",
"sslPort": 44325
}
},
"profiles": {
"Node1": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7189;http://localhost:5110",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
8 changes: 8 additions & 0 deletions examples/AspNetGrains/Node1/appsettings.Development.json
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 examples/AspNetGrains/Node1/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}
26 changes: 26 additions & 0 deletions examples/AspNetGrains/Node2/HelloGrain.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using AspNetGrains.Messages;
using Proto;

namespace Node2;

public class HelloGrain : HelloGrainBase
{
private readonly string _identity;

public HelloGrain(IContext ctx, string identity) : base(ctx)
{
_identity = identity;
}

public override Task<HelloResponse> SayHello(HelloRequest request)
{
Console.WriteLine("Got request!!");

var res = new HelloResponse
{
Message = $"Hello from typed grain {_identity}"
};

return Task.FromResult(res);
}
}
13 changes: 13 additions & 0 deletions examples/AspNetGrains/Node2/Node2.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Messages\Messages.csproj" />
</ItemGroup>

</Project>
20 changes: 20 additions & 0 deletions examples/AspNetGrains/Node2/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using AspNetGrains.Messages;
using Proto.Cluster;
using Proto.Cluster.Seed;
using Proto.Remote;
using Proto.Remote.Healthchecks;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddLogging(x => x.AddConsole());

builder.Services.AddProtoCluster("MyCluster", port: 8090,
configureRemote: r => r.WithProtoMessages(AspNetGrains.Messages.ProtosReflection.Descriptor),
configureCluster: c => c.WithClusterKind(HelloGrainActor.GetClusterKind((ctx,ci) => new Node2.HelloGrain(ctx,ci.Identity))), clusterProvider:SeedNodeClusterProvider.StartSeedNode());

builder.Services.AddHealthChecks().AddCheck<ActorSystemHealthCheck>("proto", null, new[] { "ready", "live" });


var app = builder.Build();

app.Run();
28 changes: 28 additions & 0 deletions examples/AspNetGrains/Node2/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:33313",
"sslPort": 44394
}
},
"profiles": {
"Node2": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7110;http://localhost:5220",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
8 changes: 8 additions & 0 deletions examples/AspNetGrains/Node2/appsettings.Development.json
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 examples/AspNetGrains/Node2/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}
2 changes: 0 additions & 2 deletions examples/ClusterGrainHelloWorld/Messages/Protos.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
package HelloHelloWorld;
option csharp_namespace = "ClusterHelloWorld.Messages";

//dotnet run -p ../../../protobuf/ProtoGrainGenerator/ProtoGrainGenerator.csproj --framework net5.0 many *.proto

message HelloRequest {}
message HelloResponse {
string Message=1;
Expand Down
Loading