fix proto
This commit is contained in:
parent
c46336431f
commit
a687abdefd
54
proto/service.proto
Normal file
54
proto/service.proto
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
// 微服务通过 ws_channel 与 efka 之间的通道消息定义。
|
||||||
|
// 该协议用于替代当前基于 JSON 的请求/响应/推送格式。
|
||||||
|
|
||||||
|
message ServiceRequest {
|
||||||
|
uint32 packet_id = 1;
|
||||||
|
|
||||||
|
message Register {
|
||||||
|
string service_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Subscribe {
|
||||||
|
string topic = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
oneof request {
|
||||||
|
Register register = 10;
|
||||||
|
Subscribe subscribe = 11;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message ServiceReply {
|
||||||
|
uint32 packet_id = 1;
|
||||||
|
|
||||||
|
message Error {
|
||||||
|
int32 code = 1;
|
||||||
|
string message = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
oneof reply {
|
||||||
|
bytes result = 10;
|
||||||
|
Error error = 11;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message ServiceCast {
|
||||||
|
|
||||||
|
message MetricData {
|
||||||
|
bytes route_key = 1;
|
||||||
|
bytes metric = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message TopicEvent {
|
||||||
|
string topic = 1;
|
||||||
|
bytes content = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
oneof body {
|
||||||
|
TopicEvent topic_event = 10;
|
||||||
|
MetricData metric_data = 11;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -8,8 +8,8 @@
|
|||||||
% 核心:强制指定 proto 路径 + 输出到你的 apps/sdlan
|
% 核心:强制指定 proto 路径 + 输出到你的 apps/sdlan
|
||||||
% ======================
|
% ======================
|
||||||
{gpb_opts, [
|
{gpb_opts, [
|
||||||
{i, "../proto"}, % 共享 proto 文件路径
|
{i, "proto"}, % 共享 proto 文件路径
|
||||||
{src_dirs, ["../proto"]}, % 源码目录(必须)
|
{src_dirs, ["proto"]}, % 源码目录(必须)
|
||||||
{f, ["service.proto"]},
|
{f, ["service.proto"]},
|
||||||
recursive, % 递归查找 proto 文件
|
recursive, % 递归查找 proto 文件
|
||||||
{module_name_suffix, "_pb"}, % 生成模块后缀
|
{module_name_suffix, "_pb"}, % 生成模块后缀
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user