Similarityoung commented on code in PR #1429: URL: https://github.com/apache/dubbo-admin/pull/1429#discussion_r2901920571
########## pkg/console/service/service_generic_invoke.go: ########## @@ -0,0 +1,292 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package service + +import ( + "context" + "fmt" + "sort" + "time" + + hessian "github.com/apache/dubbo-go-hessian2" + + dubbo "dubbo.apache.org/dubbo-go/v3" + "dubbo.apache.org/dubbo-go/v3/client" + dubboconstant "dubbo.apache.org/dubbo-go/v3/common/constant" + _ "dubbo.apache.org/dubbo-go/v3/imports" + + "github.com/apache/dubbo-admin/pkg/common/bizerror" + consolectx "github.com/apache/dubbo-admin/pkg/console/context" + "github.com/apache/dubbo-admin/pkg/console/model" + "github.com/apache/dubbo-admin/pkg/core/logger" + "github.com/apache/dubbo-admin/pkg/core/manager" + meshresource "github.com/apache/dubbo-admin/pkg/core/resource/apis/mesh/v1alpha1" + "github.com/apache/dubbo-admin/pkg/core/store/index" +) + +const genericInvokeInstanceName = "dubbo-admin-generic-invoke" + +type genericInvocation struct { + URL string + ServiceName string + Group string + Version string + MethodName string + ParameterTypes []string + Args []hessian.Object +} + +type tripleInvokeTarget struct { + instance *meshresource.RPCInstanceResource + port int64 +} + +var invokeGenericServiceRPC = func(callCtx context.Context, invocation genericInvocation) (any, error) { + ins, err := dubbo.NewInstance(dubbo.WithName(genericInvokeInstanceName)) + if err != nil { + return nil, err + } + + cli, err := ins.NewClient( Review Comment: 这里其他协议我还没做测试,我记得序列化好像只有 Hessian2,我回头看看。 -- 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]
