mq.proto 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /**
  2. 消息队列实现,对应包为 mq
  3. 其中 mq/consumer 为消息消费端,mq/publisher 为消息发布端服务
  4. -- 项目地址:https://gogs.ywtinfo.com/ywt/go_base_core.git
  5. */
  6. syntax = "proto3";
  7. package com.ywt.gapi.mq;
  8. option java_generic_services = true;
  9. option java_multiple_files = true;
  10. option java_package = "com.ywt.gapi.mq";
  11. option go_package = "/gapi";
  12. //gRPC消息队列请求消息体
  13. message ExecuteGRPCRequest {
  14. string method = 1; //gRPC方法名(/${package}.${service}/${method}),如:/com.ywt.gapi.mq.MQExecutorService/executeGRPC
  15. bytes data = 2; //gRPC方法的参数(byte序列化)
  16. int32 priority = 3; //优先级(暂时保留设计)
  17. string msgId = 4; //消息ID,不需传入(仅为了消息完整性而定义)
  18. }
  19. //gRPC请求消息体入队返回结果
  20. message ExecuteGRPCResponse {
  21. int32 code = 1; //返回码(0:成功, 1:失败)
  22. string msgId = 2; //消息ID
  23. }
  24. message ExecuteRestRequest {
  25. message Header {
  26. string key = 1;
  27. string value = 2;
  28. }
  29. string url = 1; //rest服务url格式:rest://${serviceName}/${path},如:rest://com.ywt.MgDrugService/path1/path2
  30. bytes body = 2; //包体
  31. int32 priority = 3; //优先级(暂时保留设计)
  32. string msgId = 4; //消息ID,不需传入(仅为了消息完整性而定义)
  33. string method = 5; // get | post
  34. repeated Header headers = 6;
  35. }
  36. message ExecuteRestResponse {
  37. int32 code = 1; //返回码(0:成功, 1:失败)
  38. string msgId = 2; //消息ID
  39. }
  40. //基于消息队列的导步执行器 // 对应 go_base_core 项目 --> mq --> publisher --> publisher.go 文件
  41. service MQExecutorService {
  42. rpc executeGRPC (ExecuteGRPCRequest) returns (ExecuteGRPCResponse); //异步执行gRPC请求
  43. rpc executeRest (ExecuteRestRequest) returns (ExecuteRestResponse); //异步执行rest服务请求
  44. }