Closed iamxiaozhuang closed 1 year ago
Can the request type be IAsyncEnumerable
directly?
@jbogard
In GRPC, I can create a Bidirectional Stream method like this:
public async Task BidirectionalStream(IAsyncStreamReader<BidirectionalStreamRequest> requestStream, IServerStreamWriter<BidirectionalStreamResponse> responseStream, ServerCallContext context) { while (await requestStream.MoveNext()) { //todo } }
So I want to implement the same functionality in the MediatR Handler as follows:
public async IAsyncEnumerable<TestStreamResponse> Handle(IAsyncEnumerable<TestStreamRequest> request, CancellationToken cancellationToken) { await foreach (var item in request) { //todo } }
Can your response type be the full async enumerable?
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.
This issue was closed because it has been stalled for 14 days with no activity.
I know MediatR provides a CreateStream method that returns IAsyncEnumerable with IResponse, but I am wondering if we can add support for IAsyncEnumerable with TRequest. Because I'm working on a a MediatR-based RPC (Remote Procedure Calls) example. I need to implement some functionality for Client Stream/Bidirectional Stream, such as the GRPC framework. Thank you.