Skip to main content

Hosting Endpoints

When using network transports, each process must expose matching Raft endpoints from the hosting application.

gRPC

using Kommander.Communication.Grpc;

WebApplication app = builder.Build();
app.MapGrpcRaftRoutes();
app.Run();

Use GrpcCommunication on the RaftManager:

ICommunication communication = new GrpcCommunication();

REST/JSON

using Kommander.Communication.Rest;

WebApplication app = builder.Build();
app.MapRestRaftRoutes();
app.Run();

Use RestCommunication on the RaftManager:

ICommunication communication = new RestCommunication();

For REST, configure HttpScheme, HttpTimeout, and HttpVersion on RaftConfiguration. For transport authentication and TLS settings, see Security And Authentication.

MapRestRaftRoutes currently maps these protocol endpoints:

MethodRoute
POST/v1/raft/handshake
POST/v1/raft/request-vote
POST/v1/raft/vote
POST/v1/raft/append-logs
POST/v1/raft/append-logs-batch
POST/v1/raft/complete-append-logs
POST/v1/raft/complete-append-logs-batch
POST/v1/raft/batch-requests
GET/v1/raft/get-leader/{partitionId}

In-Memory

InMemoryCommunication is intended for tests and in-process simulations. It does not require ASP.NET Core route mapping.