Giter VIP home page Giter VIP logo

Comments (3)

Vitalis001 avatar Vitalis001 commented on August 10, 2024

文档: 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.

weimch avatar weimch commented on August 10, 2024

Noop的测试编译失败了,同时文档缺少心得体会部分,可以补充上

image

from trpc-cpp.

weimch avatar weimch commented on August 10, 2024

另外,这个issue对于noop的功能,更愿意看到noop数据格式由你自己组织/解析,而不是复用json(因为已经有了json传输的能力)

from trpc-cpp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.