stream模式下服务端如何异步处理消息?
Open
usage
- Dominant language
- C++
- Stars
- 17.6k
- Forks
- 4.1k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 69
Description
on_received_messages看起来是个同步函数。如何做到像grpc那样在OnReadDone里处理消息,处理完后自己调用StartRead读取下一条消息?
比如服务端收到消息后需要把消息通过网络转发给另一个服务,如果只能同步处理消息,那么这里就会阻塞线程。如果服务端收到数据后用另一个线程去处理消息,那么就没办法做到反压了。
Contributor guide
Research direction
Start with the stream-mode on_received_messages callback and compare the requested flow with gRPC's OnReadDone and StartRead APIs. Determine whether an asynchronous server-handling design can preserve backpressure while forwarding messages to another service; done would require an agreed implementation scope or API design, which the issue does not currently specify.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, grpc
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100