MediatRPC - 基于MediatR和Quic通讯实现的RPC示例,新增Server Stream功能,发布开源地址。

大家好,我是失业在家,正在找工作的博主Jerry。今天发布MediatRPC的开源地址:github.com

文档增加了MediatRPC的架构图和架构说明(英文):

On the client side, it establishes a QUIC connection with the server side. The MediatR's standard methods like ''send/publish/createstream'' are implemented to open outbound bidirectional stream used to send and receive MediatR contract messages.
On the server side, it sets up a QuicListener to listen for client connections and accept the inbound stream when the client make the call after connected. It reads the request message from the stream and passes it to the MediatR handlers for processing, Then it writes the response message to the stream after processed.

通过MediatR的CreateSteam方法,我给MediatRPC增加了类似于GRPC的Server Stream功能,完整功能演示如下:

由于MediatR的CreateSteam方法只支持 IAsyncEnumerable<TResponse>,不支持IAsyncEnumerable<TRequest>,也就是说只能实现Server Stream,无法实现Clinet Stream 和 Bidirectional Stream。所以我给MediaR作者提了个Issue, Add support for IAsyncEnumerable<TRequest> · Issue #804 · jbogard/MediatR (github.com)

 

posted on 2022-11-23 11:48  小庄  阅读(186)  评论(0编辑  收藏  举报