chickenlj commented on code in PR #2502:
URL: https://github.com/apache/dubbo-go/pull/2502#discussion_r1393533039
##########
client/client.go:
##########
@@ -57,52 +59,65 @@ func (cli *Client) call(ctx context.Context, paramsRawVals
[]interface{}, interf
if err != nil {
return nil, err
}
+
+ refOption := cli.refOpts[common.ServiceKey(interfaceName, group,
version)]
+ if refOption == nil {
+ return nil, fmt.Errorf("no service found for %s/%s:%s, please
check if the service has been registered", group, interfaceName, version)
+ }
// todo: move timeout into context or invocation
- return cli.invoker.Invoke(ctx, inv), nil
+ return refOption.invoker.Invoke(ctx, inv), nil
}
-func (cli *Client) CallUnary(ctx context.Context, req, resp interface{},
interfaceName, methodName string, opts ...CallOption) error {
- res, err := cli.call(ctx, []interface{}{req, resp}, interfaceName,
methodName, constant.CallUnary, opts...)
+func (cli *Client) CallUnary(ctx context.Context, req, resp interface{},
interfaceName, methodName string, group string, version string, opts
...CallOption) error {
+ res, err := cli.call(ctx, []interface{}{req, resp}, interfaceName,
methodName, group, version, constant.CallUnary, opts...)
if err != nil {
return err
}
return res.Error()
}
-func (cli *Client) CallClientStream(ctx context.Context, interfaceName,
methodName string, opts ...CallOption) (interface{}, error) {
- res, err := cli.call(ctx, nil, interfaceName, methodName,
constant.CallClientStream, opts...)
+func (cli *Client) CallClientStream(ctx context.Context, interfaceName,
methodName, group, version string, opts ...CallOption) (interface{}, error) {
+ res, err := cli.call(ctx, nil, interfaceName, methodName, group,
version, constant.CallClientStream, opts...)
if err != nil {
return nil, err
}
return res.Result(), res.Error()
}
-func (cli *Client) CallServerStream(ctx context.Context, req interface{},
interfaceName, methodName string, opts ...CallOption) (interface{}, error) {
- res, err := cli.call(ctx, []interface{}{req}, interfaceName,
methodName, constant.CallServerStream, opts...)
+func (cli *Client) CallServerStream(ctx context.Context, req interface{},
interfaceName, methodName, group, version string, opts ...CallOption)
(interface{}, error) {
+ res, err := cli.call(ctx, []interface{}{req}, interfaceName,
methodName, group, version, constant.CallServerStream, opts...)
if err != nil {
return nil, err
}
return res.Result(), res.Error()
}
-func (cli *Client) CallBidiStream(ctx context.Context, interfaceName,
methodName string, opts ...CallOption) (interface{}, error) {
- res, err := cli.call(ctx, nil, interfaceName, methodName,
constant.CallBidiStream, opts...)
+func (cli *Client) CallBidiStream(ctx context.Context, interfaceName,
methodName, group, version string, opts ...CallOption) (interface{}, error) {
+ res, err := cli.call(ctx, nil, interfaceName, methodName, group,
version, constant.CallBidiStream, opts...)
if err != nil {
return nil, err
}
return res.Result(), res.Error()
}
-func (cli *Client) Init(info *ClientInfo) error {
+func (cli *Client) Init(interfaceName string, info *ClientInfo, opts
...ReferenceOption) (string, string, error) {
Review Comment:
Got
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]