service.proto 798 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. syntax = "proto3";
  2. package main;
  3. option go_package = ".;a2s";
  4. service Caller {
  5. //远程调用
  6. rpc Call (Request) returns (Response) {}
  7. //状态查看
  8. rpc ViewState(StateReq)returns(StateResp){}
  9. }
  10. //请求
  11. message Request {
  12. string topic = 1;//主题
  13. int64 timeout = 2;//超时设定
  14. bytes data =3;//数据序列化
  15. }
  16. //回应
  17. message Response {
  18. int32 code =1;//返回码
  19. string msg = 2;//
  20. bytes data =3;//结构数据
  21. }
  22. //空消息体
  23. message StateReq{
  24. string topic =1;
  25. }
  26. //状态消息体
  27. message StateResp{
  28. int32 currentRequest =1 ; //当前处理的请求数
  29. }
  30. //发送给nats的消息体
  31. message NatsRequest{
  32. string msgId =1;
  33. int64 timestamp = 2;
  34. int64 timeout =3;
  35. bytes data=4;
  36. }
  37. //回应给nats的消息体
  38. message NatsResponse{
  39. string msgId =1;
  40. bytes data=4;
  41. }