After reading the entire Readme.md file, I still don't understand how to use this library.
I'm confused about how to use this library on both the client-side and server-side.
So I'm reviewing your source code to try to understand the logic.
Is this implementation correct?
On the Client side, add:
// Define Custom IMediator Interface
public interface IGrpcMediator : IRemoteMediator;
public class GrpcMediator(IMediator mediator) : RemoteMediator(mediator), IGrpcMediator
{
public override string ProtocolName => "grpc";
}
services.AddRemoteMediatR<IGrpcMediator, GrpcMediator>("public-api", "grpc", remoteBuilder =>
{
remoteBuilder.AddGrpcStrategy("internal-api1", client => client.Address = new Uri("http://localhost:5011"));
});
public class SomeService(IRemoteMediator mediator)
{
public async Task SendRequest()
{
await mediator.Send(new SomeRequest());
}
}
On the Server side, add:
// Configure Service
services.AddGrpc();
// Configure Middleware
app.UseRemoteMediatR(applicationBuilder => applicationBuilder.UseGrpcListener());
After reading the entire Readme.md file, I still don't understand how to use this library.
I'm confused about how to use this library on both the client-side and server-side.
So I'm reviewing your source code to try to understand the logic.
Is this implementation correct?
On the Client side, add:
On the Server side, add: