7 changed files with 101 additions and 13 deletions
@ -0,0 +1,40 @@
|
||||
syntax = "proto3"; |
||||
|
||||
option go_package = "./pb"; |
||||
|
||||
|
||||
// 通过网关向客户端投递消息 |
||||
service GatewayPostal { |
||||
// 使用流连续发送数据 |
||||
rpc DeliverStream(stream ReqDeliver) returns (ResDeliver); |
||||
|
||||
// 发送一次数据 |
||||
rpc Deliver(ReqDeliver) returns (ResDeliver); |
||||
|
||||
// 批量发送数据 |
||||
rpc DeliverBatch(ReqDeliverBatch) returns (ResDeliver); |
||||
} |
||||
|
||||
message Message { |
||||
int64 time = 3; |
||||
string target = 4; // 消息处理 handler |
||||
bytes body = 15; // protobuf bytes |
||||
} |
||||
|
||||
message ReqDeliver { |
||||
string receiver = 1; |
||||
Message msg = 2; |
||||
|
||||
bool sync = 7; // 是否同步阻塞等待投递结果, 默认false立即返回放到队列消费投递 |
||||
} |
||||
message ResDeliver { |
||||
bool ok = 1; |
||||
int32 code = 2; |
||||
string msg = 3; |
||||
} |
||||
|
||||
message ReqDeliverBatch { |
||||
repeated string receivers = 1; |
||||
Message msg = 2; |
||||
bool sync = 7; |
||||
} |
||||
@ -1,7 +1,12 @@
|
||||
#! /bin/bash |
||||
|
||||
./build.sh market 1.0 \ |
||||
&& ./build.sh exchange 1.0 \ |
||||
&& ./build.sh gateway 1.0 \ |
||||
&& ./build.sh admin 1.0 \ |
||||
&& ./build.sh trading 1.0 |
||||
# ./build-all.sh 1.0 hub.docker.com |
||||
|
||||
VERSION=$1 |
||||
DOMAIN=$2 |
||||
|
||||
./build.sh market $VERSION $DOMAIN \ |
||||
&& ./build.sh exchange $VERSION $DOMAIN \ |
||||
&& ./build.sh gateway $VERSION $DOMAIN \ |
||||
&& ./build.sh admin $VERSION $DOMAIN \ |
||||
&& ./build.sh trading $VERSION $DOMAIN |
||||
|
||||
@ -0,0 +1,34 @@
|
||||
package gateway |
||||
|
||||
import ( |
||||
"context" |
||||
"sig-pub/api/pb" |
||||
|
||||
"google.golang.org/grpc" |
||||
) |
||||
|
||||
type GatewayPostalGrpcServer struct { |
||||
pb.UnimplementedGatewayPostalServer |
||||
} |
||||
|
||||
func NewGatewayGrpcServer() *GatewayPostalGrpcServer { |
||||
return &GatewayPostalGrpcServer{} |
||||
} |
||||
|
||||
// DeliverStream 使用流连续发送数据
|
||||
func (svr *GatewayPostalGrpcServer) DeliverStream(req grpc.ClientStreamingServer[pb.ReqDeliver, pb.ResDeliver]) (err error) { |
||||
|
||||
return nil |
||||
} |
||||
|
||||
// Deliver 发送一次数据
|
||||
func (svr *GatewayPostalGrpcServer) Deliver(ctx context.Context, req *pb.ReqDeliver) (*pb.ResDeliver, error) { |
||||
|
||||
return nil, nil |
||||
} |
||||
|
||||
// DeliverBatch 批量发送数据
|
||||
func (svr *GatewayPostalGrpcServer) DeliverBatch(ctx context.Context, req *pb.ReqDeliverBatch) (res *pb.ResDeliver, err error) { |
||||
|
||||
return nil, nil |
||||
} |
||||
Loading…
Reference in new issue