/**
消息队列实现，对应包为 mq
其中 mq/consumer 为消息消费端，mq/publisher 为消息发布端服务
-- 项目地址：https://gogs.ywtinfo.com/ywt/go_base_core.git
*/
syntax = "proto3";

package com.ywt.gapi.mq;

option java_generic_services = true;
option java_multiple_files = true;
option java_package = "com.ywt.gapi.mq";
option go_package = "/gapi";

//gRPC消息队列请求消息体
message ExecuteGRPCRequest {
    string method = 1; //gRPC方法名(/${package}.${service}/${method})，如：/com.ywt.gapi.mq.MQExecutorService/executeGRPC
    bytes data = 2; //gRPC方法的参数(byte序列化)
    int32 priority = 3; //优先级(暂时保留设计)
    string msgId = 4; //消息ID，不需传入(仅为了消息完整性而定义)
}

//gRPC请求消息体入队返回结果
message ExecuteGRPCResponse {
    int32 code = 1; //返回码(0：成功, 1：失败)
    string msgId = 2; //消息ID
}

message ExecuteRestRequest {
    message Header {
        string key = 1;
        string value = 2;
    }
    string url = 1; //rest服务url格式：rest://${serviceName}/${path}，如：rest://com.ywt.MgDrugService/path1/path2
    bytes body = 2; //包体
    int32 priority = 3; //优先级(暂时保留设计)
    string msgId = 4; //消息ID，不需传入(仅为了消息完整性而定义)
    string method = 5; // get | post
    repeated Header headers = 6;
}

message ExecuteRestResponse {
    int32 code = 1; //返回码(0：成功, 1：失败)
    string msgId = 2; //消息ID
}

//基于消息队列的导步执行器  // 对应 go_base_core 项目 --> mq --> publisher --> publisher.go 文件
service MQExecutorService {
    rpc executeGRPC (ExecuteGRPCRequest) returns (ExecuteGRPCResponse); //异步执行gRPC请求
    rpc executeRest (ExecuteRestRequest) returns (ExecuteRestResponse); //异步执行rest服务请求
}