From 26a9e62a175d91d10df07ff1271f86117ca7b128 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sun, 27 Oct 2024 12:54:39 +0800 Subject: [PATCH] :sparkles: Nexus will refer broadcast event request --- pkg/internal/directory/service_rpc.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkg/internal/directory/service_rpc.go b/pkg/internal/directory/service_rpc.go index f0ba2fa..d94bfb9 100644 --- a/pkg/internal/directory/service_rpc.go +++ b/pkg/internal/directory/service_rpc.go @@ -99,3 +99,16 @@ func (v *ServiceRpcServer) RemoveService(ctx context.Context, request *proto.Rem IsSuccess: err == nil, }, nil } + +func (v *ServiceRpcServer) BroadcastEvent(ctx context.Context, in *proto.EventInfo) (*proto.EventResponse, error) { + services := ListServiceInstance() + for _, service := range services { + conn, err := service.GetGrpcConn() + if err != nil { + continue + } + _, _ = proto.NewDirectoryServiceClient(conn).BroadcastEvent(ctx, in) + } + + return &proto.EventResponse{}, nil +}