diff --git a/common/constant/key.go b/common/constant/key.go index bca658b2623e3ca9241103b5f9c82c7e15fb4062..ba86c531c95e02583a0e7e8be9da10ff622136ca 100644 --- a/common/constant/key.go +++ b/common/constant/key.go @@ -30,6 +30,7 @@ const ( METHODS_KEY = "methods" TIMEOUT_KEY = "timeout" BEAN_NAME_KEY = "bean.name" + GENERIC_KEY = "generic" ) const ( diff --git a/config/generic_service_test.go b/config/generic_service_test.go deleted file mode 100644 index 027edf85b4732abd268050d29eb472834cb23ce0..0000000000000000000000000000000000000000 --- a/config/generic_service_test.go +++ /dev/null @@ -1,17 +0,0 @@ -/* - * 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 config diff --git a/config/reference_config.go b/config/reference_config.go index 99d442ad4629db3fa6240c50c43bdefd7f49ac64..4f2bdbbc2921d3706e440111d45593938ebc99a7 100644 --- a/config/reference_config.go +++ b/config/reference_config.go @@ -55,7 +55,7 @@ type ReferenceConfig struct { Params map[string]string `yaml:"params" json:"params,omitempty" property:"params"` invoker protocol.Invoker urls []*common.URL - Generic bool + Generic bool `yaml:"generic" json:"generic,omitempty" property:"generic"` } func (c *ReferenceConfig) Prefix() string { @@ -157,6 +157,7 @@ func (refconfig *ReferenceConfig) getUrlMap() url.Values { urlMap.Set(constant.RETRIES_KEY, strconv.FormatInt(refconfig.Retries, 10)) urlMap.Set(constant.GROUP_KEY, refconfig.Group) urlMap.Set(constant.VERSION_KEY, refconfig.Version) + urlMap.Set(constant.GENERIC_KEY, strconv.FormatBool(refconfig.Generic)) //getty invoke async or sync urlMap.Set(constant.ASYNC_KEY, strconv.FormatBool(refconfig.async)) @@ -183,8 +184,7 @@ func (refconfig *ReferenceConfig) getUrlMap() url.Values { return urlMap } -func (refconfig *ReferenceConfig) Load(id string) { - //gr.Filter = "genericConsumer" //todo: add genericConsumer filter +func (refconfig *ReferenceConfig) GenericLoad(id string) { genericService := NewGenericService(refconfig.id) SetConsumerService(genericService) refconfig.id = id diff --git a/examples/general/dubbo/go-client/app/client.go b/examples/general/dubbo/go-client/app/client.go index 8fc7d992a4c38d3b897fedfe16052542bf717aaa..9b50ca0a36e23793ff39e228852dd84bb70f90ce 100644 --- a/examples/general/dubbo/go-client/app/client.go +++ b/examples/general/dubbo/go-client/app/client.go @@ -297,7 +297,7 @@ func test3() { Protocol: dubbo.DUBBO, Generic: true, } - referenceConfig.Load(appName) //appName is the unique identification of RPCService + referenceConfig.GenericLoad(appName) //appName is the unique identification of RPCService time.Sleep(3 * time.Second) println("\n\n\nstart to generic invoke") diff --git a/filter/impl/generic_filter.go b/filter/impl/generic_filter.go index b9ed9b62e9298d3ff8a58188b3412448539e61bc..e23c34ebc299e52c21e146946d004d829954f488 100644 --- a/filter/impl/generic_filter.go +++ b/filter/impl/generic_filter.go @@ -17,14 +17,16 @@ package impl +import ( + "reflect" + "strings" +) import ( "github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/extension" "github.com/apache/dubbo-go/filter" "github.com/apache/dubbo-go/protocol" invocation2 "github.com/apache/dubbo-go/protocol/invocation" - "reflect" - "strings" ) const ( diff --git a/filter/impl/generic_filter_test.go b/filter/impl/generic_filter_test.go index bdeb9532974297c092aef8dea9d745956f93ecb0..405bf789b7382ed9e077cc8741c8865955c687c7 100644 --- a/filter/impl/generic_filter_test.go +++ b/filter/impl/generic_filter_test.go @@ -17,13 +17,13 @@ package impl -import ( - "github.com/stretchr/testify/assert" -) import ( "reflect" "testing" ) +import ( + "github.com/stretchr/testify/assert" +) func Test_struct2MapAll(t *testing.T) { var testData struct {