queue.proto 754 B

123456789101112131415161718192021222324252627282930313233343536
  1. syntax = "proto3"; //声明proto的版本 只能 是3,才支持 grpc
  2. //声明 包名
  3. package proto;
  4. //服务管理
  5. service QueueService {
  6. //任务发布
  7. rpc Publish (stream PubReq) returns (PubResp) {
  8. }
  9. //任务接收
  10. rpc Receive (RecvReq) returns (stream PubReq) {
  11. }
  12. }
  13. //任务
  14. message PubReq {
  15. string id = 1;//标示
  16. string channelId = 2;//频道
  17. string sender = 3;//发送人id
  18. int32 serial_type = 4;//序列化方式 0 raw bytes,1 json,2 grpc
  19. int32 publish_type = 5 ;//任务发布方式 0 随机 1 广播
  20. bytes param = 6 ;//参数
  21. }
  22. //标准字符串返回结果
  23. message PubResp {
  24. int32 code = 1;//执行状态代码
  25. string msg = 2;//执行状态
  26. }
  27. message RecvReq{
  28. string sender = 1;
  29. string channelId = 2;
  30. }