Comments (3)
文档: https://github.com/Vitalis001/trpc-cpp/blob/main/docs/zh/trpc_protobuf_json_noop_guide.md
代码仓库: https://github.com/Vitalis001/trpc-cpp
编译运行:
protobuf:
编译整个示例代码
bazel build //examples/helloworld/...
运行服务端程序
./bazel-bin/examples/helloworld/helloworld_svr --config=./examples/helloworld/conf/trpc_cpp_fiber.yaml
打开另外一个终端,运行客户端测试程序。
./bazel-bin/examples/helloworld/test/fiber_client --client_config=./examples/helloworld/test/conf/trpc_cpp_fiber.yaml
或者
./bazel-bin/examples/helloworld/test/future_client --client_config=./examples/helloworld/test/conf/trpc_cpp_future.yaml
将看到如下输出
FLAGS_service_name:trpc.test.helloworld.Greeter
FLAGS_client_config:./examples/helloworld/test/conf/trpc_cpp_fiber.yaml
get rsp:
name: hello issueshooter
age: 19
hobby: opensource project, movies, books
或者
FLAGS_service_name:trpc.test.helloworld.Greeter
FLAGS_client_config:./examples/helloworld/test/conf/trpc_cpp_future.yaml
get rsp:
name: hello issueshooter
age: 19
hobby: opensource project, movies, books
使用 cat helloworld_fiber.log
命令查看服务端的日志信息,可以看到服务端接收到客户端如下信息:
request name: issueshooter
request age: 18
request hobby: opensource project, movies, books
json
编译示例代码
bazel build //examples/features/trpc_json/...
运行服务端程序
./bazel-bin/examples/features/trpc_json/server/demo_server --config=./examples/features/trpc_json/server/trpc_cpp_fiber.yam
运行客户端程序
./bazel-bin/examples/features/trpc_json/client/client --client_config=./examples/features/trpc_json/client/trpc_cpp_fiber.yaml
将看到如下输出
FLAGS_target:trpc.test.helloworld.demo_service
FLAGS_client_config:./examples/features/trpc_json/client/trpc_cpp_fiber.yaml
son name: name, value: hello issueshooter
json name: age, value: 19
json name: hobby, value: opensource project,movies,book
noop
编译示例代码
bazel build //examples/features/trpc_noop/...
运行服务端程序
./bazel-bin/examples/features/trpc_noop/server/demo_server --config=./examples/features/trpc_noop/server/trpc_cpp_fiber.yaml
运行客户端程序
./bazel-bin/examples/features/trpc_noop/client/client --client_config=./examples/features/trpc_noop/client/trpc_cpp_fiber.yaml
将看到如下输出
FLAGS_target:trpc.test.helloworld.demo_service
FLAGS_client_config:./examples/features/trpc_noop/client/trpc_cpp_fiber.yaml
logging plugin configurations is not setted, log will be printed to the console.
response msg: {"age":19,"hobby":["opensource project","movies","books"],"name":"hello issueshooter"}
response msg: {"age":20,"hobby":["opensource project","movies","books"],"name":"bye issueshooter"}
from trpc-cpp.
Noop的测试编译失败了,同时文档缺少心得体会部分,可以补充上
![image](https://private-user-images.githubusercontent.com/28728444/348641473-72fd972a-30ee-43cf-9f92-44c59e077c64.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMyNjA3MzMsIm5iZiI6MTcyMzI2MDQzMywicGF0aCI6Ii8yODcyODQ0NC8zNDg2NDE0NzMtNzJmZDk3MmEtMzBlZS00M2NmLTlmOTItNDRjNTllMDc3YzY0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODEwVDAzMjcxM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQ0OGIwODQ3N2U2Zjg4Njk0MWNhNWJmODM2N2VlNzcxNjc4YjVlOWMxZWJlZmJhYjk1NjJhY2I0MTNiYzQ2ZmYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.cDl2Th9lmPoPfJ0RiYTenz40qyYtWn5ax8jkON6jwsg)
from trpc-cpp.
另外,这个issue对于noop的功能,更愿意看到noop数据格式由你自己组织/解析,而不是复用json(因为已经有了json传输的能力)
from trpc-cpp.
Related Issues (20)
- When using the fiber thread model, there are occasional cases where the unary HTTP server receives the request packet but fails to trigger the business logic properly.
- In the connection pool of fiber scenario, the client-side socket fd cannot be recycled in a timely manner, causing the number of close-wait to increase.
- example 代码中,除了初始化一步,其他七彩石的各种操作都没有,建议补充 HOT 1
- There isn’t any unit-testing building target in the trpc/util/algorithm
- 调用链路的唯一ID HOT 1
- 加密与鉴权 HOT 1
- redis请求的上下文id是怎么关联的 貌似没有找到 HOT 2
- 执行run_client.sh出现无法访问的问题 HOT 3
- The return value from io_uring_submit is not being handled correctly. HOT 2
- 【腾讯犀牛鸟计划】在tRPC-Cpp的2种runtime下发起对2个下游的调用 HOT 12
- 【腾讯犀牛鸟计划】使用tRPC-Cpp开发一个http服务 HOT 5
- 【腾讯犀牛鸟计划】为tRPC-Cpp开发一个简单的校验器 HOT 6
- 【腾讯犀牛鸟计划】为tRPC-Cpp实现一个简单协议的编码器 HOT 16
- 【腾讯犀牛鸟计划】实现IP直连负载均衡插件 - 加权轮询算法 HOT 2
- 【腾讯犀牛鸟计划】实现IP直连负载均衡插件 - hash算法 HOT 1
- 【腾讯犀牛鸟计划】实现过载保护插件 - 固定时间窗口 HOT 11
- 【腾讯犀牛鸟计划】实现过载保护插件 - 令牌桶 HOT 6
- 【腾讯犀牛鸟计划】实现过载保护插件 - 滑动时间窗口 HOT 7
- Fails to compile on Arch with gcc-14.2 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from trpc-cpp.