diff --git a/client/client.go b/client/client.go index ae43e71..3b14ce2 100644 --- a/client/client.go +++ b/client/client.go @@ -166,6 +166,9 @@ type Client interface { // ImplActorClientStub is to impl user defined actor client stub ImplActorClientStub(actorClientStub actor.Client, opt ...config.Option) + + // GrpcClient returns the base grpc client if grpc is used and nil otherwise + GrpcClient() pb.DaprClient } // NewClient instantiates Dapr client using DAPR_GRPC_PORT environment variable as port. @@ -308,3 +311,8 @@ func (c *GRPCClient) Shutdown(ctx context.Context) error { } return nil } + +// GrpcClient returns the base grpc client. +func (c *GRPCClient) GrpcClient() pb.DaprClient { + return c.protoClient +} diff --git a/client/client_test.go b/client/client_test.go index a81ffd7..c55c1ee 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -415,3 +415,9 @@ func (s *testDaprServer) UnsubscribeConfigurationAlpha1(ctx context.Context, in delete(s.configurationSubscriptionID, in.Id) return &pb.UnsubscribeConfigurationResponse{Ok: true}, nil } + +func TestGrpcClient(t *testing.T) { + protoClient := pb.NewDaprClient(nil) + client := &GRPCClient{protoClient: protoClient} + assert.Equal(t, protoClient, client.GrpcClient()) +}