From 97a8e5447f704cb961c1a17b2cc753d63b285687 Mon Sep 17 00:00:00 2001 From: aamingaa <774066625@qq.com> Date: Sat, 22 Oct 2022 21:56:48 +0800 Subject: [PATCH 01/17] feat: split context --- dubbo-samples-rpccontext/README.md | 2 + .../case-configuration.yml | 24 ++++ dubbo-samples-rpccontext/case-versions.conf | 24 ++++ dubbo-samples-rpccontext/pom.xml | 128 ++++++++++++++++++ .../rpccontext/RpcContextConsumer.java | 56 ++++++++ .../rpccontext/RpcContextProvider1.java | 54 ++++++++ .../rpccontext/RpcContextProvider2.java | 54 ++++++++ .../rpccontext/api/RpcContextService1.java | 25 ++++ .../rpccontext/api/RpcContextService2.java | 25 ++++ .../PenetrateAttachmentSelectorImpl1.java | 19 +++ .../rpccontext/impl/RpcContextImpl1.java | 52 +++++++ .../rpccontext/impl/RpcContextImpl2.java | 41 ++++++ .../rpccontext/utils/RpcContextUtils.java | 15 ++ ...ache.dubbo.rpc.PenetrateAttachmentSelector | 1 + .../src/main/resources/log4j.properties | 26 ++++ pom.xml | 1 + 16 files changed, 547 insertions(+) create mode 100644 dubbo-samples-rpccontext/README.md create mode 100644 dubbo-samples-rpccontext/case-configuration.yml create mode 100644 dubbo-samples-rpccontext/case-versions.conf create mode 100644 dubbo-samples-rpccontext/pom.xml create mode 100644 dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextConsumer.java create mode 100644 dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextProvider1.java create mode 100644 dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextProvider2.java create mode 100644 dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/api/RpcContextService1.java create mode 100644 dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/api/RpcContextService2.java create mode 100644 dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/impl/PenetrateAttachmentSelectorImpl1.java create mode 100644 dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/impl/RpcContextImpl1.java create mode 100644 dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/impl/RpcContextImpl2.java create mode 100644 dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/utils/RpcContextUtils.java create mode 100644 dubbo-samples-rpccontext/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.rpc.PenetrateAttachmentSelector create mode 100644 dubbo-samples-rpccontext/src/main/resources/log4j.properties diff --git a/dubbo-samples-rpccontext/README.md b/dubbo-samples-rpccontext/README.md new file mode 100644 index 0000000000..2bf4ab19de --- /dev/null +++ b/dubbo-samples-rpccontext/README.md @@ -0,0 +1,2 @@ +## 隐式参数 +可以通过 RpcContext 上的 setAttachment 和 getAttachment 在服务消费方和提供方之间进行参数的隐式传递。 \ No newline at end of file diff --git a/dubbo-samples-rpccontext/case-configuration.yml b/dubbo-samples-rpccontext/case-configuration.yml new file mode 100644 index 0000000000..5ff3db15ba --- /dev/null +++ b/dubbo-samples-rpccontext/case-configuration.yml @@ -0,0 +1,24 @@ +# 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. + +from: app-builtin-zookeeper.yml + +props: + project_name: dubbo-samples-rpccontext + main_class: org.apache.dubbo.samples.rpccontext.RpcContextProvider1 + zookeeper_port: 2181 + dubbo_port: 20880 + diff --git a/dubbo-samples-rpccontext/case-versions.conf b/dubbo-samples-rpccontext/case-versions.conf new file mode 100644 index 0000000000..0e26c8bf14 --- /dev/null +++ b/dubbo-samples-rpccontext/case-versions.conf @@ -0,0 +1,24 @@ +# +# +# 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. +# + + +# Supported component versions of the test case + +# Spring app +dubbo.version=2.7*, 3.* +spring.version=4.*, 5.* diff --git a/dubbo-samples-rpccontext/pom.xml b/dubbo-samples-rpccontext/pom.xml new file mode 100644 index 0000000000..93ffff91bd --- /dev/null +++ b/dubbo-samples-rpccontext/pom.xml @@ -0,0 +1,128 @@ + + + + + org.apache.dubbo + 1.0-SNAPSHOT + + 4.0.0 + + dubbo-samples-rpccontext + + + 1.8 + 1.8 + 3.0.7 + 4.3.16.RELEASE + 4.12 + 3.7.0 + + + + + org.apache.dubbo + dubbo + + + + org.apache.dubbo + dubbo-dependencies-zookeeper + pom + + + + junit + junit + test + + + + org.springframework + spring-test + test + + + + + + + org.springframework + spring-framework-bom + ${spring.version} + pom + import + + + + org.apache.dubbo + dubbo-bom + ${dubbo.version} + pom + import + + + + org.apache.dubbo + dubbo-dependencies-zookeeper + ${dubbo.version} + pom + + + + junit + junit + ${junit.version} + + + + + + + + javax.annotation + + [1.11,) + + + + javax.annotation + javax.annotation-api + 1.3.2 + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + ${source.level} + ${target.level} + + + + + diff --git a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextConsumer.java b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextConsumer.java new file mode 100644 index 0000000000..76d72b4e51 --- /dev/null +++ b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextConsumer.java @@ -0,0 +1,56 @@ +/* + * + * 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 org.apache.dubbo.samples.rpccontext; + +import org.apache.dubbo.config.ApplicationConfig; +import org.apache.dubbo.config.ProtocolConfig; +import org.apache.dubbo.config.ReferenceConfig; +import org.apache.dubbo.config.RegistryConfig; +import org.apache.dubbo.config.bootstrap.DubboBootstrap; +import org.apache.dubbo.rpc.RpcContext; +import org.apache.dubbo.samples.rpccontext.api.RpcContextService1; + +import org.apache.dubbo.samples.rpccontext.utils.RpcContextUtils; +import org.springframework.context.support.ClassPathXmlApplicationContext; + + +public class RpcContextConsumer { + + public static void main(String[] args) { + DubboBootstrap bootstrap = DubboBootstrap.getInstance(); + ReferenceConfig ref = new ReferenceConfig<>(); + ref.setInterface(RpcContextService1.class); + ref.setProtocol(RpcContextUtils.dubbo_protocol); + ref.setTimeout(30000000); + bootstrap.application(new ApplicationConfig("rpccontext-consumer")) + .registry(new RegistryConfig("zookeeper://127.0.0.1:2181")) + .reference(ref) + .protocol(new ProtocolConfig(RpcContextUtils.dubbo_protocol,8000)) + .start(); + RpcContext.getClientAttachment().setAttachment(RpcContextUtils.consumer_req_key, RpcContextUtils.consumer_req_key); + RpcContextService1 greeter = ref.get(); + greeter.sayHello(); + String provider1Res = RpcContext.getClientResponseContext().getAttachment(RpcContextUtils.provider1_res_key); + System.out.println("get response from provider1:" + provider1Res); + String provider2Res = (String) RpcContext.getClientResponseContext().getObjectAttachment(RpcContextUtils.provider2_res_key); + System.out.println("get response from provider2:" + provider2Res); + + } +} diff --git a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextProvider1.java b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextProvider1.java new file mode 100644 index 0000000000..c9d6bdb35d --- /dev/null +++ b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextProvider1.java @@ -0,0 +1,54 @@ +/* + * + * 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 org.apache.dubbo.samples.rpccontext; + +import org.apache.dubbo.config.*; +import org.apache.dubbo.config.bootstrap.DubboBootstrap; +import org.apache.dubbo.samples.rpccontext.api.RpcContextService1; +import org.apache.dubbo.samples.rpccontext.impl.RpcContextImpl1; +import org.apache.dubbo.samples.rpccontext.utils.RpcContextUtils; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +import java.io.IOException; +import java.util.concurrent.CountDownLatch; + + +public class RpcContextProvider1 { + + public static void main(String[] args) throws IOException { + ServiceConfig service = new ServiceConfig<>(); + service.setInterface(RpcContextService1.class); + service.setRef(new RpcContextImpl1()); + ReferenceConfig ref = new ReferenceConfig<>(); + ref.setInterface(RpcContextService1.class); + ref.setProtocol(RpcContextUtils.dubbo_protocol); + ref.setTimeout(30000000); + DubboBootstrap bootstrap = DubboBootstrap.getInstance(); + bootstrap.application(new ApplicationConfig("rpccontext-provider-1")) + .registry(new RegistryConfig("zookeeper://127.0.0.1:2181")) + .protocol(new ProtocolConfig(RpcContextUtils.dubbo_protocol, 8000)) + .service(service) + .reference(ref) + .start() + .await() + ; + System.out.println("Rpc context provider1 started"); + } +} diff --git a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextProvider2.java b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextProvider2.java new file mode 100644 index 0000000000..88801c29bc --- /dev/null +++ b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextProvider2.java @@ -0,0 +1,54 @@ +/* + * + * 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 org.apache.dubbo.samples.rpccontext; + +import org.apache.dubbo.config.ApplicationConfig; +import org.apache.dubbo.config.ProtocolConfig; +import org.apache.dubbo.config.RegistryConfig; +import org.apache.dubbo.config.ServiceConfig; +import org.apache.dubbo.config.bootstrap.DubboBootstrap; +import org.apache.dubbo.samples.rpccontext.api.RpcContextService2; +import org.apache.dubbo.samples.rpccontext.impl.RpcContextImpl2; +import org.apache.dubbo.samples.rpccontext.utils.RpcContextUtils; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +import java.io.IOException; +import java.util.concurrent.CountDownLatch; + + +public class RpcContextProvider2 { + + public static void main(String[] args) throws IOException { + ServiceConfig service = new ServiceConfig<>(); + service.setInterface(RpcContextService2.class); + service.setRef(new RpcContextImpl2()); + + DubboBootstrap bootstrap = DubboBootstrap.getInstance(); + bootstrap.application(new ApplicationConfig("rpccontext-provider-2")) + .registry(new RegistryConfig("zookeeper://127.0.0.1:2181")) + .protocol(new ProtocolConfig(RpcContextUtils.dubbo_protocol, 8001)) + .service(service) + .start() + .await() + ; + System.out.println("Rpc context provider2 started"); + System.in.read(); + } +} diff --git a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/api/RpcContextService1.java b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/api/RpcContextService1.java new file mode 100644 index 0000000000..0507d57059 --- /dev/null +++ b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/api/RpcContextService1.java @@ -0,0 +1,25 @@ +/* + * + * 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 org.apache.dubbo.samples.rpccontext.api; + + +public interface RpcContextService1 { + void sayHello(); +} diff --git a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/api/RpcContextService2.java b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/api/RpcContextService2.java new file mode 100644 index 0000000000..36dcff7175 --- /dev/null +++ b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/api/RpcContextService2.java @@ -0,0 +1,25 @@ +/* + * + * 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 org.apache.dubbo.samples.rpccontext.api; + + +public interface RpcContextService2 { + void sayHi(); +} diff --git a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/impl/PenetrateAttachmentSelectorImpl1.java b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/impl/PenetrateAttachmentSelectorImpl1.java new file mode 100644 index 0000000000..1bc0114bdb --- /dev/null +++ b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/impl/PenetrateAttachmentSelectorImpl1.java @@ -0,0 +1,19 @@ +package org.apache.dubbo.samples.rpccontext.impl; + +import org.apache.dubbo.rpc.Invocation; +import org.apache.dubbo.rpc.PenetrateAttachmentSelector; + +import java.util.Map; + +public class PenetrateAttachmentSelectorImpl1 implements PenetrateAttachmentSelector { + + @Override + public Map select(Invocation invocation) { + return null; + } + + @Override + public Map selectReverse(Invocation invocation) { + return null; + } +} diff --git a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/impl/RpcContextImpl1.java b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/impl/RpcContextImpl1.java new file mode 100644 index 0000000000..0835335b62 --- /dev/null +++ b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/impl/RpcContextImpl1.java @@ -0,0 +1,52 @@ +/* + * + * 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 org.apache.dubbo.samples.rpccontext.impl; + +import org.apache.dubbo.config.ReferenceConfig; +import org.apache.dubbo.config.bootstrap.DubboBootstrap; +import org.apache.dubbo.rpc.RpcContext; +import org.apache.dubbo.samples.rpccontext.api.RpcContextService1; +import org.apache.dubbo.samples.rpccontext.api.RpcContextService2; +import org.apache.dubbo.samples.rpccontext.utils.RpcContextUtils; +import org.springframework.util.Assert; + +import java.text.SimpleDateFormat; +import java.util.Date; + + +public class RpcContextImpl1 implements RpcContextService1 { + + @Override + public void sayHello(){ + String consumerReq = RpcContext.getServerAttachment().getAttachment(RpcContextUtils.consumer_req_key); + System.out.println("get request from consumer:"+ consumerReq); + ReferenceConfig ref = new ReferenceConfig<>(); + ref.setInterface(RpcContextService2.class); + ref.setProtocol(RpcContextUtils.dubbo_protocol); + ref.setTimeout(30000000); + DubboBootstrap bootstrap = DubboBootstrap.getInstance(); + RpcContextService2 greeterSayHi = bootstrap.getCache().get(ref); + RpcContext.getClientAttachment().setObjectAttachment(RpcContextUtils.provider1_req_key, RpcContextUtils.provider1_req_key); + greeterSayHi.sayHi(); + String provider2Res = (String)RpcContext.getClientResponseContext().getObjectAttachment(RpcContextUtils.provider2_res_key); + System.out.println("get response from provider2:"+ provider2Res); + RpcContext.getServerResponseContext().setObjectAttachment(RpcContextUtils.provider1_res_key, RpcContextUtils.provider1_res_key); + } +} diff --git a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/impl/RpcContextImpl2.java b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/impl/RpcContextImpl2.java new file mode 100644 index 0000000000..0b3aff2bb3 --- /dev/null +++ b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/impl/RpcContextImpl2.java @@ -0,0 +1,41 @@ +/* + * + * 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 org.apache.dubbo.samples.rpccontext.impl; + +import org.apache.dubbo.rpc.RpcContext; +import org.apache.dubbo.samples.rpccontext.api.RpcContextService1; +import org.apache.dubbo.samples.rpccontext.api.RpcContextService2; +import org.apache.dubbo.samples.rpccontext.utils.RpcContextUtils; + +import java.text.SimpleDateFormat; +import java.util.Date; + + +public class RpcContextImpl2 implements RpcContextService2 { + + @Override + public void sayHi(){ + String consumerReq = RpcContext.getServerAttachment().getAttachment(RpcContextUtils.consumer_req_key); + System.out.println("get request from consumer:"+ consumerReq); + String provider1Req = (String) RpcContext.getServerAttachment().getObjectAttachment(RpcContextUtils.provider1_req_key); + System.out.println("get request from provider1:"+ provider1Req); + RpcContext.getServerResponseContext().setAttachment(RpcContextUtils.provider2_res_key, RpcContextUtils.provider2_res_key); + } +} diff --git a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/utils/RpcContextUtils.java b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/utils/RpcContextUtils.java new file mode 100644 index 0000000000..9661f46150 --- /dev/null +++ b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/utils/RpcContextUtils.java @@ -0,0 +1,15 @@ +package org.apache.dubbo.samples.rpccontext.utils; + +import org.apache.dubbo.common.constants.CommonConstants; + +public class RpcContextUtils { + public static String dubbo_protocol = CommonConstants.DUBBO; + + public static String consumer_req_key = "consumer_req_key"; + + public static String provider1_req_key = "provider1_req_key"; + + public static String provider2_res_key = "provider2_res_key"; + public static String provider1_res_key = "provider1_res_key"; + +} diff --git a/dubbo-samples-rpccontext/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.rpc.PenetrateAttachmentSelector b/dubbo-samples-rpccontext/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.rpc.PenetrateAttachmentSelector new file mode 100644 index 0000000000..b2948cdc00 --- /dev/null +++ b/dubbo-samples-rpccontext/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.rpc.PenetrateAttachmentSelector @@ -0,0 +1 @@ +mock=org.apache.dubbo.samples.rpccontext.impl.PenetrateAttachmentSelectorImpl1 diff --git a/dubbo-samples-rpccontext/src/main/resources/log4j.properties b/dubbo-samples-rpccontext/src/main/resources/log4j.properties new file mode 100644 index 0000000000..d6ecd5ce34 --- /dev/null +++ b/dubbo-samples-rpccontext/src/main/resources/log4j.properties @@ -0,0 +1,26 @@ +# +# +# 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. +# +# + +###set log levels### +log4j.rootLogger=info, stdout +###output to the console### +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.Target=System.out +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=[%d{dd/MM/yy hh:mm:ss:sss z}] %t %5p %c{2}: %m%n \ No newline at end of file diff --git a/pom.xml b/pom.xml index 68cb4beb7a..a0aeaac38f 100644 --- a/pom.xml +++ b/pom.xml @@ -58,6 +58,7 @@ dubbo-samples-notify dubbo-samples-resilience4j dubbo-samples-rest + dubbo-samples-rpccontext dubbo-samples-scala dubbo-samples-simplified-registry dubbo-samples-spi-compatible From 37b7f1ec3bb178663dfd996970ecfd41cf218b09 Mon Sep 17 00:00:00 2001 From: aamingaa <774066625@qq.com> Date: Mon, 24 Oct 2022 00:09:28 +0800 Subject: [PATCH 02/17] feat: change workflow temp --- .github/workflows/dubbo-2.yml | 4 +- .github/workflows/dubbo-3.yml | 4 +- .../case-configuration.yml | 44 +++++++++---------- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.github/workflows/dubbo-2.yml b/.github/workflows/dubbo-2.yml index 1959f80a1f..3c04f2bc4e 100644 --- a/.github/workflows/dubbo-2.yml +++ b/.github/workflows/dubbo-2.yml @@ -27,7 +27,7 @@ env: spring-boot.version:1.5.22.RELEASE; spring-boot.version:2.4.1; ' - DUBBO_REF: 'master' + DUBBO_REF: 'feature/split_rpcContext_2' jobs: build-samples: @@ -62,7 +62,7 @@ jobs: steps: - uses: actions/checkout@v2 with: - repository: 'apache/dubbo' + repository: 'aamingaa/dubbo' ref: ${{env.DUBBO_REF}} - name: Get commit id and dubbo version id: git-checker diff --git a/.github/workflows/dubbo-3.yml b/.github/workflows/dubbo-3.yml index 7b589fbf6e..dc70c5f8a7 100644 --- a/.github/workflows/dubbo-3.yml +++ b/.github/workflows/dubbo-3.yml @@ -27,7 +27,7 @@ env: spring-boot.version:1.5.22.RELEASE; spring-boot.version:2.4.1; ' - DUBBO_REF: '3.1' + DUBBO_REF: 'feature/split_rpcContext_2' jobs: build-samples: @@ -62,7 +62,7 @@ jobs: steps: - uses: actions/checkout@v2 with: - repository: 'apache/dubbo' + repository: 'aamingaa/dubbo' ref: ${{env.DUBBO_REF}} - name: Get commit id and dubbo version id: git-checker diff --git a/dubbo-samples-rpccontext/case-configuration.yml b/dubbo-samples-rpccontext/case-configuration.yml index 5ff3db15ba..368eff368c 100644 --- a/dubbo-samples-rpccontext/case-configuration.yml +++ b/dubbo-samples-rpccontext/case-configuration.yml @@ -1,24 +1,24 @@ -# 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 +## 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. # -# http://www.apache.org/licenses/LICENSE-2.0 +#from: app-builtin-zookeeper.yml +# +#props: +# project_name: dubbo-samples-rpccontext +# main_class: org.apache.dubbo.samples.rpccontext.RpcContextProvider1 +# zookeeper_port: 2181 +# dubbo_port: 20880 # -# 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. - -from: app-builtin-zookeeper.yml - -props: - project_name: dubbo-samples-rpccontext - main_class: org.apache.dubbo.samples.rpccontext.RpcContextProvider1 - zookeeper_port: 2181 - dubbo_port: 20880 - From 8ef68d8b0e872f9a5547a5dfa0ba440fc419654b Mon Sep 17 00:00:00 2001 From: aamingaa <774066625@qq.com> Date: Mon, 24 Oct 2022 00:37:33 +0800 Subject: [PATCH 03/17] feat: change yml --- .../case-configuration.yml | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/dubbo-samples-rpccontext/case-configuration.yml b/dubbo-samples-rpccontext/case-configuration.yml index 368eff368c..80c9077ae7 100644 --- a/dubbo-samples-rpccontext/case-configuration.yml +++ b/dubbo-samples-rpccontext/case-configuration.yml @@ -1,24 +1,24 @@ -## 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. +# 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 # -#from: app-builtin-zookeeper.yml -# -#props: -# project_name: dubbo-samples-rpccontext -# main_class: org.apache.dubbo.samples.rpccontext.RpcContextProvider1 -# zookeeper_port: 2181 -# dubbo_port: 20880 +# 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. + +from: app-builtin-zookeeper.yml + +props: + project_name: dubbo-samples-rpccontext + main_class: org.apache.dubbo.samples.rpccontext.RpcContextProvider2,org.apache.dubbo.samples.rpccontext.RpcContextProvider1 + zookeeper_port: 2181 + dubbo_port: 20880 + From a951cb50e71d2a00a1b182e8af8eca7cc7ee0bac Mon Sep 17 00:00:00 2001 From: aamingaa <774066625@qq.com> Date: Wed, 26 Oct 2022 01:51:21 +0800 Subject: [PATCH 04/17] feat: rpc context demo --- dubbo-samples-port-unification/pom.xml | 2 +- .../case-configuration.yml | 53 +++- .../samples/rpccontext/EmbeddedZooKeeper.java | 255 ++++++++++++++++++ .../rpccontext/RpcContextConsumer.java | 43 +-- .../rpccontext/RpcContextProvider1.java | 42 +-- .../rpccontext/RpcContextProvider2.java | 45 ++-- .../rpccontext/api/RpcContextService1.java | 4 +- .../rpccontext/api/RpcContextService2.java | 4 +- .../samples/rpccontext/dto/Service1DTO.java | 34 +++ .../samples/rpccontext/dto/Service2DTO.java | 24 ++ .../rpccontext/impl/RpcContextImpl1.java | 16 +- .../rpccontext/impl/RpcContextImpl2.java | 10 +- .../spring/dubbo-rpccontext-consumer.xml | 37 +++ .../spring/dubbo-rpccontext-provider1.xml | 40 +++ .../spring/dubbo-rpccontext-provider2.xml | 38 +++ .../rpccontext/RpcContextServiceIT.java | 123 +++++++++ 16 files changed, 700 insertions(+), 70 deletions(-) create mode 100644 dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/EmbeddedZooKeeper.java create mode 100644 dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/dto/Service1DTO.java create mode 100644 dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/dto/Service2DTO.java create mode 100644 dubbo-samples-rpccontext/src/main/resources/spring/dubbo-rpccontext-consumer.xml create mode 100644 dubbo-samples-rpccontext/src/main/resources/spring/dubbo-rpccontext-provider1.xml create mode 100644 dubbo-samples-rpccontext/src/main/resources/spring/dubbo-rpccontext-provider2.xml create mode 100644 dubbo-samples-rpccontext/src/test/java/org/apache/dubbo/samples/rpccontext/RpcContextServiceIT.java diff --git a/dubbo-samples-port-unification/pom.xml b/dubbo-samples-port-unification/pom.xml index 6d0ec966a7..265700c22e 100644 --- a/dubbo-samples-port-unification/pom.xml +++ b/dubbo-samples-port-unification/pom.xml @@ -1,4 +1,4 @@ - dubbo-samples-all diff --git a/dubbo-samples-rpccontext/case-configuration.yml b/dubbo-samples-rpccontext/case-configuration.yml index 80c9077ae7..709e741d9c 100644 --- a/dubbo-samples-rpccontext/case-configuration.yml +++ b/dubbo-samples-rpccontext/case-configuration.yml @@ -14,11 +14,52 @@ # See the License for the specific language governing permissions and # limitations under the License. -from: app-builtin-zookeeper.yml +services: + zookeeper: + image: zookeeper:latest -props: - project_name: dubbo-samples-rpccontext - main_class: org.apache.dubbo.samples.rpccontext.RpcContextProvider2,org.apache.dubbo.samples.rpccontext.RpcContextProvider1 - zookeeper_port: 2181 - dubbo_port: 20880 + dubbo-samples-rpccontext-provider2: + type: app + basedir: . + mainClass: org.apache.dubbo.samples.rpccontext.RpcContextProvider2 + systemProps: + - zookeeper.address=zookeeper + waitPortsBeforeRun: + - zookeeper:2181 + checkPorts: + - 20882 + checkLog: "Rpc context provider2 started" + depends_on: + - zookeeper + + dubbo-samples-rpccontext-provider: + type: app + basedir: . + mainClass: org.apache.dubbo.samples.rpccontext.RpcContextProvider1 + systemProps: + - zookeeper.address=zookeeper + waitPortsBeforeRun: + - zookeeper:2181 + checkPorts: + - 20880 + checkLog: "Rpc context provider1 started" + depends_on: + - zookeeper + - dubbo-samples-rpccontext-provider2 + + dubbo-samples-rpccontext-consumer: + type: test + basedir: . + tests: + - "**/*IT.class" + systemProps: + - zookeeper.address=zookeeper + waitPortsBeforeRun: + - zookeeper:2181 + - dubbo-samples-rpccontext-provider:20880 + - dubbo-samples-rpccontext-provider2:20882 + depends_on: + - zookeeper + - dubbo-samples-rpccontext-provider + - dubbo-samples-rpccontext-provider2 diff --git a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/EmbeddedZooKeeper.java b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/EmbeddedZooKeeper.java new file mode 100644 index 0000000000..6be3bdca12 --- /dev/null +++ b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/EmbeddedZooKeeper.java @@ -0,0 +1,255 @@ +/* + * Copyright 2014 the original author or authors. + * + * Licensed 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 org.apache.dubbo.samples.rpccontext; + +import org.apache.zookeeper.server.ServerConfig; +import org.apache.zookeeper.server.ZooKeeperServerMain; +import org.apache.zookeeper.server.quorum.QuorumPeerConfig; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.SmartLifecycle; +import org.springframework.util.ErrorHandler; +import org.springframework.util.SocketUtils; + +import java.io.File; +import java.lang.reflect.Method; +import java.util.Properties; +import java.util.UUID; + +/** + * from: https://github.com/spring-projects/spring-xd/blob/v1.3.1.RELEASE/spring-xd-dirt/src/main/java/org/springframework/xd/dirt/zookeeper/ZooKeeperUtils.java + * + * Helper class to start an embedded instance of standalone (non clustered) ZooKeeper. + * + * NOTE: at least an external standalone server (if not an ensemble) are recommended, even for + * {@link org.springframework.xd.dirt.server.singlenode.SingleNodeApplication} + * + * @author Patrick Peralta + * @author Mark Fisher + * @author David Turanski + */ +public class EmbeddedZooKeeper implements SmartLifecycle { + + /** + * Logger. + */ + private static final Logger logger = LoggerFactory.getLogger(EmbeddedZooKeeper.class); + + /** + * ZooKeeper client port. This will be determined dynamically upon startup. + */ + private final int clientPort; + + /** + * Whether to auto-start. Default is true. + */ + private boolean autoStartup = true; + + /** + * Lifecycle phase. Default is 0. + */ + private int phase = 0; + + /** + * Thread for running the ZooKeeper server. + */ + private volatile Thread zkServerThread; + + /** + * ZooKeeper server. + */ + private volatile ZooKeeperServerMain zkServer; + + /** + * {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread. + */ + private ErrorHandler errorHandler; + + private boolean daemon = true; + + /** + * Construct an EmbeddedZooKeeper with a random port. + */ + public EmbeddedZooKeeper() { + clientPort = SocketUtils.findAvailableTcpPort(); + } + + /** + * Construct an EmbeddedZooKeeper with the provided port. + * + * @param clientPort port for ZooKeeper server to bind to + */ + public EmbeddedZooKeeper(int clientPort, boolean daemon) { + this.clientPort = clientPort; + this.daemon = daemon; + } + + /** + * Returns the port that clients should use to connect to this embedded server. + * + * @return dynamically determined client port + */ + public int getClientPort() { + return this.clientPort; + } + + /** + * Specify whether to start automatically. Default is true. + * + * @param autoStartup whether to start automatically + */ + public void setAutoStartup(boolean autoStartup) { + this.autoStartup = autoStartup; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean isAutoStartup() { + return this.autoStartup; + } + + /** + * Specify the lifecycle phase for the embedded server. + * + * @param phase the lifecycle phase + */ + public void setPhase(int phase) { + this.phase = phase; + } + + /** + * {@inheritDoc} + */ + @Override + public int getPhase() { + return this.phase; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean isRunning() { + return (zkServerThread != null); + } + + /** + * Start the ZooKeeper server in a background thread. + *

+ * Register an error handler via {@link #setErrorHandler} in order to handle + * any exceptions thrown during startup or execution. + */ + @Override + public synchronized void start() { + if (zkServerThread == null) { + zkServerThread = new Thread(new ServerRunnable(), "ZooKeeper Server Starter"); + zkServerThread.setDaemon(daemon); + zkServerThread.start(); + } + } + + /** + * Shutdown the ZooKeeper server. + */ + @Override + public synchronized void stop() { + if (zkServerThread != null) { + // The shutdown method is protected...thus this hack to invoke it. + // This will log an exception on shutdown; see + // https://issues.apache.org/jira/browse/ZOOKEEPER-1873 for details. + try { + Method shutdown = ZooKeeperServerMain.class.getDeclaredMethod("shutdown"); + shutdown.setAccessible(true); + shutdown.invoke(zkServer); + } + + catch (Exception e) { + throw new RuntimeException(e); + } + + // It is expected that the thread will exit after + // the server is shutdown; this will block until + // the shutdown is complete. + try { + zkServerThread.join(5000); + zkServerThread = null; + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + logger.warn("Interrupted while waiting for embedded ZooKeeper to exit"); + // abandoning zk thread + zkServerThread = null; + } + } + } + + /** + * Stop the server if running and invoke the callback when complete. + */ + @Override + public void stop(Runnable callback) { + stop(); + callback.run(); + } + + /** + * Provide an {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread. If none + * is provided, only error-level logging will occur. + * + * @param errorHandler the {@link ErrorHandler} to be invoked + */ + public void setErrorHandler(ErrorHandler errorHandler) { + this.errorHandler = errorHandler; + } + + /** + * Runnable implementation that starts the ZooKeeper server. + */ + private class ServerRunnable implements Runnable { + + @Override + public void run() { + try { + Properties properties = new Properties(); + File file = new File(System.getProperty("java.io.tmpdir") + + File.separator + UUID.randomUUID()); + file.deleteOnExit(); + properties.setProperty("dataDir", file.getAbsolutePath()); + properties.setProperty("clientPort", String.valueOf(clientPort)); + + QuorumPeerConfig quorumPeerConfig = new QuorumPeerConfig(); + quorumPeerConfig.parseProperties(properties); + + zkServer = new ZooKeeperServerMain(); + ServerConfig configuration = new ServerConfig(); + configuration.readFrom(quorumPeerConfig); + + zkServer.runFromConfig(configuration); + } + catch (Exception e) { + if (errorHandler != null) { + errorHandler.handleError(e); + } + else { + logger.error("Exception running embedded ZooKeeper", e); + } + } + } + } + +} \ No newline at end of file diff --git a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextConsumer.java b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextConsumer.java index 76d72b4e51..1bc5667054 100644 --- a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextConsumer.java +++ b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextConsumer.java @@ -32,25 +32,30 @@ public class RpcContextConsumer { - public static void main(String[] args) { - DubboBootstrap bootstrap = DubboBootstrap.getInstance(); - ReferenceConfig ref = new ReferenceConfig<>(); - ref.setInterface(RpcContextService1.class); - ref.setProtocol(RpcContextUtils.dubbo_protocol); - ref.setTimeout(30000000); - bootstrap.application(new ApplicationConfig("rpccontext-consumer")) - .registry(new RegistryConfig("zookeeper://127.0.0.1:2181")) - .reference(ref) - .protocol(new ProtocolConfig(RpcContextUtils.dubbo_protocol,8000)) - .start(); - RpcContext.getClientAttachment().setAttachment(RpcContextUtils.consumer_req_key, RpcContextUtils.consumer_req_key); - RpcContextService1 greeter = ref.get(); - greeter.sayHello(); - String provider1Res = RpcContext.getClientResponseContext().getAttachment(RpcContextUtils.provider1_res_key); - System.out.println("get response from provider1:" + provider1Res); - String provider2Res = (String) RpcContext.getClientResponseContext().getObjectAttachment(RpcContextUtils.provider2_res_key); - System.out.println("get response from provider2:" + provider2Res); - + ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/dubbo-rpccontext-consumer.xml"); + context.start(); + RpcContextService1 rpcContextService1 = context.getBean("consumerService", RpcContextService1.class); + rpcContextService1.sayHello(); } +// public static void main(String[] args) { +// DubboBootstrap bootstrap = DubboBootstrap.getInstance(); +// ReferenceConfig ref = new ReferenceConfig<>(); +// ref.setInterface(RpcContextService1.class); +// ref.setProtocol(RpcContextUtils.dubbo_protocol); +// ref.setTimeout(30000000); +// bootstrap.application(new ApplicationConfig("rpccontext-consumer")) +// .registry(new RegistryConfig("zookeeper://127.0.0.1:2181")) +// .reference(ref) +// .protocol(new ProtocolConfig(RpcContextUtils.dubbo_protocol,8000)) +// .start(); +// RpcContext.getClientAttachment().setAttachment(RpcContextUtils.consumer_req_key, RpcContextUtils.consumer_req_key); +// RpcContextService1 greeter = ref.get(); +// greeter.sayHello(); +// String provider1Res = RpcContext.getClientResponseContext().getAttachment(RpcContextUtils.provider1_res_key); +// System.out.println("get response from provider1:" + provider1Res); +// String provider2Res = (String) RpcContext.getClientResponseContext().getObjectAttachment(RpcContextUtils.provider2_res_key); +// System.out.println("get response from provider2:" + provider2Res); +// +// } } diff --git a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextProvider1.java b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextProvider1.java index c9d6bdb35d..e0e8c1e6f2 100644 --- a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextProvider1.java +++ b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextProvider1.java @@ -27,28 +27,34 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; import java.io.IOException; +import java.util.concurrent.CompletableFuture; import java.util.concurrent.CountDownLatch; public class RpcContextProvider1 { - - public static void main(String[] args) throws IOException { - ServiceConfig service = new ServiceConfig<>(); - service.setInterface(RpcContextService1.class); - service.setRef(new RpcContextImpl1()); - ReferenceConfig ref = new ReferenceConfig<>(); - ref.setInterface(RpcContextService1.class); - ref.setProtocol(RpcContextUtils.dubbo_protocol); - ref.setTimeout(30000000); - DubboBootstrap bootstrap = DubboBootstrap.getInstance(); - bootstrap.application(new ApplicationConfig("rpccontext-provider-1")) - .registry(new RegistryConfig("zookeeper://127.0.0.1:2181")) - .protocol(new ProtocolConfig(RpcContextUtils.dubbo_protocol, 8000)) - .service(service) - .reference(ref) - .start() - .await() - ; + public static void main(String[] args) throws Exception { + ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/dubbo-rpccontext-provider1.xml"); + context.start(); System.out.println("Rpc context provider1 started"); + new CountDownLatch(1).await(); } +// public static void main(String[] args) throws IOException { +// ServiceConfig service = new ServiceConfig<>(); +// service.setInterface(RpcContextService1.class); +// service.setRef(new RpcContextImpl1()); +// ReferenceConfig ref = new ReferenceConfig<>(); +// ref.setInterface(RpcContextService1.class); +// ref.setProtocol(RpcContextUtils.dubbo_protocol); +// ref.setTimeout(30000000); +// DubboBootstrap bootstrap = DubboBootstrap.getInstance(); +// bootstrap.application(new ApplicationConfig("rpccontext-provider-1")) +// .registry(new RegistryConfig("zookeeper://127.0.0.1:2181")) +// .protocol(new ProtocolConfig(RpcContextUtils.dubbo_protocol, 8000)) +// .service(service) +// .reference(ref) +// .start() +// .await() +// ; +// System.out.println("Rpc context provider1 started"); +// } } diff --git a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextProvider2.java b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextProvider2.java index 88801c29bc..0f8198c028 100644 --- a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextProvider2.java +++ b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextProvider2.java @@ -19,36 +19,43 @@ package org.apache.dubbo.samples.rpccontext; -import org.apache.dubbo.config.ApplicationConfig; -import org.apache.dubbo.config.ProtocolConfig; -import org.apache.dubbo.config.RegistryConfig; -import org.apache.dubbo.config.ServiceConfig; +import org.apache.dubbo.config.*; import org.apache.dubbo.config.bootstrap.DubboBootstrap; +import org.apache.dubbo.samples.rpccontext.api.RpcContextService1; import org.apache.dubbo.samples.rpccontext.api.RpcContextService2; +import org.apache.dubbo.samples.rpccontext.impl.RpcContextImpl1; import org.apache.dubbo.samples.rpccontext.impl.RpcContextImpl2; import org.apache.dubbo.samples.rpccontext.utils.RpcContextUtils; import org.springframework.context.support.ClassPathXmlApplicationContext; import java.io.IOException; +import java.util.concurrent.CompletableFuture; import java.util.concurrent.CountDownLatch; public class RpcContextProvider2 { - - public static void main(String[] args) throws IOException { - ServiceConfig service = new ServiceConfig<>(); - service.setInterface(RpcContextService2.class); - service.setRef(new RpcContextImpl2()); - - DubboBootstrap bootstrap = DubboBootstrap.getInstance(); - bootstrap.application(new ApplicationConfig("rpccontext-provider-2")) - .registry(new RegistryConfig("zookeeper://127.0.0.1:2181")) - .protocol(new ProtocolConfig(RpcContextUtils.dubbo_protocol, 8001)) - .service(service) - .start() - .await() - ; + public static void main(String[] args) throws Exception { + new EmbeddedZooKeeper(2181, false).start(); + ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/dubbo-rpccontext-provider2.xml"); + context.start(); System.out.println("Rpc context provider2 started"); - System.in.read(); + new CountDownLatch(1).await(); } +// public static void main(String[] args) throws IOException { +// new EmbeddedZooKeeper(2181, false).start(); +// ServiceConfig service = new ServiceConfig<>(); +// service.setInterface(RpcContextService2.class); +// service.setRef(new RpcContextImpl2()); +// +// DubboBootstrap bootstrap = DubboBootstrap.getInstance(); +// bootstrap.application(new ApplicationConfig("rpccontext-provider-2")) +// .registry(new RegistryConfig("zookeeper://127.0.0.1:2181")) +// .protocol(new ProtocolConfig(RpcContextUtils.dubbo_protocol, 8001)) +// .service(service) +// .start() +//// .await() +// ; +// System.out.println("Rpc context provider2 started"); +// System.in.read(); +// } } diff --git a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/api/RpcContextService1.java b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/api/RpcContextService1.java index 0507d57059..00dabe94f7 100644 --- a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/api/RpcContextService1.java +++ b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/api/RpcContextService1.java @@ -20,6 +20,8 @@ package org.apache.dubbo.samples.rpccontext.api; +import org.apache.dubbo.samples.rpccontext.dto.Service1DTO; + public interface RpcContextService1 { - void sayHello(); + Service1DTO sayHello(); } diff --git a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/api/RpcContextService2.java b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/api/RpcContextService2.java index 36dcff7175..453f269911 100644 --- a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/api/RpcContextService2.java +++ b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/api/RpcContextService2.java @@ -20,6 +20,8 @@ package org.apache.dubbo.samples.rpccontext.api; +import org.apache.dubbo.samples.rpccontext.dto.Service2DTO; + public interface RpcContextService2 { - void sayHi(); + Service2DTO sayHi(); } diff --git a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/dto/Service1DTO.java b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/dto/Service1DTO.java new file mode 100644 index 0000000000..a8e22e66a6 --- /dev/null +++ b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/dto/Service1DTO.java @@ -0,0 +1,34 @@ +package org.apache.dubbo.samples.rpccontext.dto; + +import java.io.Serializable; + +public class Service1DTO implements Serializable { + private String consumerReq; + private String provider2Res; + + private Service2DTO service2DTO; + + public Service2DTO getService2DTO() { + return service2DTO; + } + + public void setService2DTO(Service2DTO service2DTO) { + this.service2DTO = service2DTO; + } + + public String getConsumerReq() { + return consumerReq; + } + + public void setConsumerReq(String consumerReq) { + this.consumerReq = consumerReq; + } + + public String getProvider2Res() { + return provider2Res; + } + + public void setProvider2Res(String provider2Res) { + this.provider2Res = provider2Res; + } +} diff --git a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/dto/Service2DTO.java b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/dto/Service2DTO.java new file mode 100644 index 0000000000..948f94035a --- /dev/null +++ b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/dto/Service2DTO.java @@ -0,0 +1,24 @@ +package org.apache.dubbo.samples.rpccontext.dto; + +import java.io.Serializable; + +public class Service2DTO implements Serializable { + private String consumerReq; + private String provider1Req; + + public String getConsumerReq() { + return consumerReq; + } + + public void setConsumerReq(String consumerReq) { + this.consumerReq = consumerReq; + } + + public String getProvider1Req() { + return provider1Req; + } + + public void setProvider1Req(String provider1Req) { + this.provider1Req = provider1Req; + } +} diff --git a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/impl/RpcContextImpl1.java b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/impl/RpcContextImpl1.java index 0835335b62..74e7ee6a0c 100644 --- a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/impl/RpcContextImpl1.java +++ b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/impl/RpcContextImpl1.java @@ -24,17 +24,23 @@ import org.apache.dubbo.rpc.RpcContext; import org.apache.dubbo.samples.rpccontext.api.RpcContextService1; import org.apache.dubbo.samples.rpccontext.api.RpcContextService2; +import org.apache.dubbo.samples.rpccontext.dto.Service1DTO; +import org.apache.dubbo.samples.rpccontext.dto.Service2DTO; import org.apache.dubbo.samples.rpccontext.utils.RpcContextUtils; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; import org.springframework.util.Assert; import java.text.SimpleDateFormat; import java.util.Date; - +@Service +@Component("demoService") public class RpcContextImpl1 implements RpcContextService1 { @Override - public void sayHello(){ + public Service1DTO sayHello(){ + Service1DTO service1DTO = new Service1DTO(); String consumerReq = RpcContext.getServerAttachment().getAttachment(RpcContextUtils.consumer_req_key); System.out.println("get request from consumer:"+ consumerReq); ReferenceConfig ref = new ReferenceConfig<>(); @@ -44,9 +50,13 @@ public void sayHello(){ DubboBootstrap bootstrap = DubboBootstrap.getInstance(); RpcContextService2 greeterSayHi = bootstrap.getCache().get(ref); RpcContext.getClientAttachment().setObjectAttachment(RpcContextUtils.provider1_req_key, RpcContextUtils.provider1_req_key); - greeterSayHi.sayHi(); + Service2DTO service2DTO = greeterSayHi.sayHi(); String provider2Res = (String)RpcContext.getClientResponseContext().getObjectAttachment(RpcContextUtils.provider2_res_key); System.out.println("get response from provider2:"+ provider2Res); RpcContext.getServerResponseContext().setObjectAttachment(RpcContextUtils.provider1_res_key, RpcContextUtils.provider1_res_key); + service1DTO.setConsumerReq(consumerReq); + service1DTO.setProvider2Res(provider2Res); + service1DTO.setService2DTO(service2DTO); + return service1DTO; } } diff --git a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/impl/RpcContextImpl2.java b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/impl/RpcContextImpl2.java index 0b3aff2bb3..813fc26689 100644 --- a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/impl/RpcContextImpl2.java +++ b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/impl/RpcContextImpl2.java @@ -22,20 +22,26 @@ import org.apache.dubbo.rpc.RpcContext; import org.apache.dubbo.samples.rpccontext.api.RpcContextService1; import org.apache.dubbo.samples.rpccontext.api.RpcContextService2; +import org.apache.dubbo.samples.rpccontext.dto.Service2DTO; import org.apache.dubbo.samples.rpccontext.utils.RpcContextUtils; +import org.springframework.stereotype.Service; import java.text.SimpleDateFormat; import java.util.Date; - +@Service public class RpcContextImpl2 implements RpcContextService2 { @Override - public void sayHi(){ + public Service2DTO sayHi(){ + Service2DTO service2DTO = new Service2DTO(); String consumerReq = RpcContext.getServerAttachment().getAttachment(RpcContextUtils.consumer_req_key); System.out.println("get request from consumer:"+ consumerReq); String provider1Req = (String) RpcContext.getServerAttachment().getObjectAttachment(RpcContextUtils.provider1_req_key); System.out.println("get request from provider1:"+ provider1Req); RpcContext.getServerResponseContext().setAttachment(RpcContextUtils.provider2_res_key, RpcContextUtils.provider2_res_key); + service2DTO.setConsumerReq(consumerReq); + service2DTO.setProvider1Req(provider1Req); + return service2DTO; } } diff --git a/dubbo-samples-rpccontext/src/main/resources/spring/dubbo-rpccontext-consumer.xml b/dubbo-samples-rpccontext/src/main/resources/spring/dubbo-rpccontext-consumer.xml new file mode 100644 index 0000000000..08560ab4f2 --- /dev/null +++ b/dubbo-samples-rpccontext/src/main/resources/spring/dubbo-rpccontext-consumer.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + diff --git a/dubbo-samples-rpccontext/src/main/resources/spring/dubbo-rpccontext-provider1.xml b/dubbo-samples-rpccontext/src/main/resources/spring/dubbo-rpccontext-provider1.xml new file mode 100644 index 0000000000..8cdea6299e --- /dev/null +++ b/dubbo-samples-rpccontext/src/main/resources/spring/dubbo-rpccontext-provider1.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/dubbo-samples-rpccontext/src/main/resources/spring/dubbo-rpccontext-provider2.xml b/dubbo-samples-rpccontext/src/main/resources/spring/dubbo-rpccontext-provider2.xml new file mode 100644 index 0000000000..09f3eca4ab --- /dev/null +++ b/dubbo-samples-rpccontext/src/main/resources/spring/dubbo-rpccontext-provider2.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + diff --git a/dubbo-samples-rpccontext/src/test/java/org/apache/dubbo/samples/rpccontext/RpcContextServiceIT.java b/dubbo-samples-rpccontext/src/test/java/org/apache/dubbo/samples/rpccontext/RpcContextServiceIT.java new file mode 100644 index 0000000000..19f85d5e85 --- /dev/null +++ b/dubbo-samples-rpccontext/src/test/java/org/apache/dubbo/samples/rpccontext/RpcContextServiceIT.java @@ -0,0 +1,123 @@ +/* + * 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 org.apache.dubbo.samples.rpccontext; + +import org.apache.dubbo.config.*; +import org.apache.dubbo.config.bootstrap.DubboBootstrap; +import org.apache.dubbo.rpc.RpcContext; +import org.apache.dubbo.samples.rpccontext.api.RpcContextService1; +import org.apache.dubbo.samples.rpccontext.api.RpcContextService2; +import org.apache.dubbo.samples.rpccontext.dto.Service1DTO; +import org.apache.dubbo.samples.rpccontext.dto.Service2DTO; +import org.apache.dubbo.samples.rpccontext.impl.RpcContextImpl1; +import org.apache.dubbo.samples.rpccontext.utils.RpcContextUtils; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import javax.annotation.Resource; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(locations = {"classpath*:spring/dubbo-rpccontext-consumer.xml"}) +public class RpcContextServiceIT { + + @Autowired + private RpcContextService1 service; + + /** + * A -> B -> C + * Both B and C can receive the client attachment from A + */ + + @Test + public void testAttachment1() { + RpcContext.getClientAttachment().setAttachment(RpcContextUtils.consumer_req_key, RpcContextUtils.consumer_req_key); + Service1DTO service1DTO = service.sayHello(); + Service2DTO service2DTO = service1DTO.getService2DTO(); + String provider1Res = RpcContext.getClientResponseContext().getAttachment(RpcContextUtils.provider1_res_key); + Assert.assertEquals(RpcContextUtils.provider1_res_key, provider1Res); + + Assert.assertEquals(RpcContextUtils.consumer_req_key, service1DTO.getConsumerReq()); + Assert.assertEquals(null, service2DTO.getConsumerReq()); + + Assert.assertEquals(RpcContextUtils.provider1_req_key, service2DTO.getProvider1Req()); + + String provider2Res = (String) RpcContext.getClientResponseContext().getObjectAttachment(RpcContextUtils.provider2_res_key); + Assert.assertEquals(null, provider2Res); + Assert.assertEquals(RpcContextUtils.provider2_res_key, service1DTO.getProvider2Res()); + } + + /** + * A -> B -> C + * Only C can receive the client attachment from A + */ + @Test + public void testAttachment2() { + RpcContext.getClientAttachment().setObjectAttachment(RpcContextUtils.provider1_req_key, RpcContextUtils.provider1_req_key); +// String result = service.sayHello(); +// Assert.assertTrue(result.startsWith("Hello dubbo")); +// Assert.assertTrue(result.endsWith("index: 1")); +// RpcContext.getContext().setAttachment("index", "2"); +// result = service.sayHello("dubbo"); +// Assert.assertTrue(result.endsWith("index: 2")); +// result = service.sayHello("dubbo"); +// Assert.assertTrue(result.endsWith("index: null")); + } + + /** + * A -> B -> C + * Both A and B can receive the response context from C + */ + @Test + public void testResponseContext1() { + RpcContext.getClientAttachment().setObjectAttachment(RpcContextUtils.provider1_req_key, RpcContextUtils.provider1_req_key); +// String result = service.sayHello(); +// Assert.assertTrue(result.startsWith("Hello dubbo")); +// Assert.assertTrue(result.endsWith("index: 1")); +// RpcContext.getContext().setAttachment("index", "2"); +// result = service.sayHello("dubbo"); +// Assert.assertTrue(result.endsWith("index: 2")); +// result = service.sayHello("dubbo"); +// Assert.assertTrue(result.endsWith("index: null")); + } + + /** + * A -> B -> C + * Only A can receive the response context from C + */ + @Test + public void testResponseContext2() { + RpcContext.getClientAttachment().setObjectAttachment(RpcContextUtils.provider1_req_key, RpcContextUtils.provider1_req_key); +// String result = service.sayHello(); +// Assert.assertTrue(result.startsWith("Hello dubbo")); +// Assert.assertTrue(result.endsWith("index: 1")); +// RpcContext.getContext().setAttachment("index", "2"); +// result = service.sayHello("dubbo"); +// Assert.assertTrue(result.endsWith("index: 2")); +// result = service.sayHello("dubbo"); +// Assert.assertTrue(result.endsWith("index: null")); + } + + +} From c24006227e2d44058176bb90b57a54f1b8a0a957 Mon Sep 17 00:00:00 2001 From: aamingaa <774066625@qq.com> Date: Wed, 26 Oct 2022 02:00:25 +0800 Subject: [PATCH 05/17] feat: rpc context demo v2 --- dubbo-samples-port-unification/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dubbo-samples-port-unification/pom.xml b/dubbo-samples-port-unification/pom.xml index 265700c22e..6d0ec966a7 100644 --- a/dubbo-samples-port-unification/pom.xml +++ b/dubbo-samples-port-unification/pom.xml @@ -1,4 +1,4 @@ -"" dubbo-samples-all From b560fbbd24b70753423df5cd455d36a8ea01f109 Mon Sep 17 00:00:00 2001 From: aamingaa <774066625@qq.com> Date: Wed, 26 Oct 2022 20:12:12 +0800 Subject: [PATCH 06/17] feat: add param to penetrateattachment --- .../rpccontext/impl/PenetrateAttachmentSelectorImpl1.java | 5 +++-- .../apache/dubbo/samples/rpccontext/RpcContextServiceIT.java | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/impl/PenetrateAttachmentSelectorImpl1.java b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/impl/PenetrateAttachmentSelectorImpl1.java index 1bc0114bdb..af68a3e2fc 100644 --- a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/impl/PenetrateAttachmentSelectorImpl1.java +++ b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/impl/PenetrateAttachmentSelectorImpl1.java @@ -2,18 +2,19 @@ import org.apache.dubbo.rpc.Invocation; import org.apache.dubbo.rpc.PenetrateAttachmentSelector; +import org.apache.dubbo.rpc.RpcContextAttachment; import java.util.Map; public class PenetrateAttachmentSelectorImpl1 implements PenetrateAttachmentSelector { @Override - public Map select(Invocation invocation) { + public Map select(Invocation invocation, RpcContextAttachment clientAttachment, RpcContextAttachment serverAttachment) { return null; } @Override - public Map selectReverse(Invocation invocation) { + public Map selectReverse(Invocation invocation, RpcContextAttachment clientResponse, RpcContextAttachment serverResponse) { return null; } } diff --git a/dubbo-samples-rpccontext/src/test/java/org/apache/dubbo/samples/rpccontext/RpcContextServiceIT.java b/dubbo-samples-rpccontext/src/test/java/org/apache/dubbo/samples/rpccontext/RpcContextServiceIT.java index 19f85d5e85..f3eeea3904 100644 --- a/dubbo-samples-rpccontext/src/test/java/org/apache/dubbo/samples/rpccontext/RpcContextServiceIT.java +++ b/dubbo-samples-rpccontext/src/test/java/org/apache/dubbo/samples/rpccontext/RpcContextServiceIT.java @@ -48,6 +48,9 @@ public class RpcContextServiceIT { /** * A -> B -> C * Both B and C can receive the client attachment from A + * consumer_req_key means the A request data + * provider1_req_key 、provider1_res_key respectively means the B request data and response data + * provider2_res_key means the C response data */ @Test From f58742b105bf98947111546307e356a0e1b587e2 Mon Sep 17 00:00:00 2001 From: aamingaa <774066625@qq.com> Date: Thu, 27 Oct 2022 01:24:52 +0800 Subject: [PATCH 07/17] feat: remove notes --- .../dubbo/samples/rpccontext/RpcContextServiceIT.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/dubbo-samples-rpccontext/src/test/java/org/apache/dubbo/samples/rpccontext/RpcContextServiceIT.java b/dubbo-samples-rpccontext/src/test/java/org/apache/dubbo/samples/rpccontext/RpcContextServiceIT.java index f3eeea3904..6657387fea 100644 --- a/dubbo-samples-rpccontext/src/test/java/org/apache/dubbo/samples/rpccontext/RpcContextServiceIT.java +++ b/dubbo-samples-rpccontext/src/test/java/org/apache/dubbo/samples/rpccontext/RpcContextServiceIT.java @@ -17,27 +17,18 @@ package org.apache.dubbo.samples.rpccontext; -import org.apache.dubbo.config.*; -import org.apache.dubbo.config.bootstrap.DubboBootstrap; import org.apache.dubbo.rpc.RpcContext; import org.apache.dubbo.samples.rpccontext.api.RpcContextService1; -import org.apache.dubbo.samples.rpccontext.api.RpcContextService2; import org.apache.dubbo.samples.rpccontext.dto.Service1DTO; import org.apache.dubbo.samples.rpccontext.dto.Service2DTO; -import org.apache.dubbo.samples.rpccontext.impl.RpcContextImpl1; import org.apache.dubbo.samples.rpccontext.utils.RpcContextUtils; import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import javax.annotation.Resource; - @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {"classpath*:spring/dubbo-rpccontext-consumer.xml"}) public class RpcContextServiceIT { From c6ee8bd4a47516ebaf67754cfc225791e8f3ccf6 Mon Sep 17 00:00:00 2001 From: aamingaa <774066625@qq.com> Date: Thu, 27 Oct 2022 01:46:43 +0800 Subject: [PATCH 08/17] feat: remove notes v2 --- .../rpccontext/RpcContextServiceIT.java | 55 +------------------ 1 file changed, 1 insertion(+), 54 deletions(-) diff --git a/dubbo-samples-rpccontext/src/test/java/org/apache/dubbo/samples/rpccontext/RpcContextServiceIT.java b/dubbo-samples-rpccontext/src/test/java/org/apache/dubbo/samples/rpccontext/RpcContextServiceIT.java index 6657387fea..02e73f73d4 100644 --- a/dubbo-samples-rpccontext/src/test/java/org/apache/dubbo/samples/rpccontext/RpcContextServiceIT.java +++ b/dubbo-samples-rpccontext/src/test/java/org/apache/dubbo/samples/rpccontext/RpcContextServiceIT.java @@ -45,7 +45,7 @@ public class RpcContextServiceIT { */ @Test - public void testAttachment1() { + public void testRpcContext1() { RpcContext.getClientAttachment().setAttachment(RpcContextUtils.consumer_req_key, RpcContextUtils.consumer_req_key); Service1DTO service1DTO = service.sayHello(); Service2DTO service2DTO = service1DTO.getService2DTO(); @@ -61,57 +61,4 @@ public void testAttachment1() { Assert.assertEquals(null, provider2Res); Assert.assertEquals(RpcContextUtils.provider2_res_key, service1DTO.getProvider2Res()); } - - /** - * A -> B -> C - * Only C can receive the client attachment from A - */ - @Test - public void testAttachment2() { - RpcContext.getClientAttachment().setObjectAttachment(RpcContextUtils.provider1_req_key, RpcContextUtils.provider1_req_key); -// String result = service.sayHello(); -// Assert.assertTrue(result.startsWith("Hello dubbo")); -// Assert.assertTrue(result.endsWith("index: 1")); -// RpcContext.getContext().setAttachment("index", "2"); -// result = service.sayHello("dubbo"); -// Assert.assertTrue(result.endsWith("index: 2")); -// result = service.sayHello("dubbo"); -// Assert.assertTrue(result.endsWith("index: null")); - } - - /** - * A -> B -> C - * Both A and B can receive the response context from C - */ - @Test - public void testResponseContext1() { - RpcContext.getClientAttachment().setObjectAttachment(RpcContextUtils.provider1_req_key, RpcContextUtils.provider1_req_key); -// String result = service.sayHello(); -// Assert.assertTrue(result.startsWith("Hello dubbo")); -// Assert.assertTrue(result.endsWith("index: 1")); -// RpcContext.getContext().setAttachment("index", "2"); -// result = service.sayHello("dubbo"); -// Assert.assertTrue(result.endsWith("index: 2")); -// result = service.sayHello("dubbo"); -// Assert.assertTrue(result.endsWith("index: null")); - } - - /** - * A -> B -> C - * Only A can receive the response context from C - */ - @Test - public void testResponseContext2() { - RpcContext.getClientAttachment().setObjectAttachment(RpcContextUtils.provider1_req_key, RpcContextUtils.provider1_req_key); -// String result = service.sayHello(); -// Assert.assertTrue(result.startsWith("Hello dubbo")); -// Assert.assertTrue(result.endsWith("index: 1")); -// RpcContext.getContext().setAttachment("index", "2"); -// result = service.sayHello("dubbo"); -// Assert.assertTrue(result.endsWith("index: 2")); -// result = service.sayHello("dubbo"); -// Assert.assertTrue(result.endsWith("index: null")); - } - - } From 734559ebc03db2b9480e199552f84837ec64f18c Mon Sep 17 00:00:00 2001 From: aamingaa <774066625@qq.com> Date: Thu, 27 Oct 2022 11:16:32 +0800 Subject: [PATCH 09/17] feat: remove redundant code --- .../rpccontext/RpcContextConsumer.java | 20 ------------------- .../rpccontext/RpcContextProvider1.java | 19 ------------------ .../rpccontext/RpcContextProvider2.java | 17 ---------------- 3 files changed, 56 deletions(-) diff --git a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextConsumer.java b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextConsumer.java index 1bc5667054..44f01b19f4 100644 --- a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextConsumer.java +++ b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextConsumer.java @@ -38,24 +38,4 @@ public static void main(String[] args) { RpcContextService1 rpcContextService1 = context.getBean("consumerService", RpcContextService1.class); rpcContextService1.sayHello(); } -// public static void main(String[] args) { -// DubboBootstrap bootstrap = DubboBootstrap.getInstance(); -// ReferenceConfig ref = new ReferenceConfig<>(); -// ref.setInterface(RpcContextService1.class); -// ref.setProtocol(RpcContextUtils.dubbo_protocol); -// ref.setTimeout(30000000); -// bootstrap.application(new ApplicationConfig("rpccontext-consumer")) -// .registry(new RegistryConfig("zookeeper://127.0.0.1:2181")) -// .reference(ref) -// .protocol(new ProtocolConfig(RpcContextUtils.dubbo_protocol,8000)) -// .start(); -// RpcContext.getClientAttachment().setAttachment(RpcContextUtils.consumer_req_key, RpcContextUtils.consumer_req_key); -// RpcContextService1 greeter = ref.get(); -// greeter.sayHello(); -// String provider1Res = RpcContext.getClientResponseContext().getAttachment(RpcContextUtils.provider1_res_key); -// System.out.println("get response from provider1:" + provider1Res); -// String provider2Res = (String) RpcContext.getClientResponseContext().getObjectAttachment(RpcContextUtils.provider2_res_key); -// System.out.println("get response from provider2:" + provider2Res); -// -// } } diff --git a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextProvider1.java b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextProvider1.java index e0e8c1e6f2..8129e70011 100644 --- a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextProvider1.java +++ b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextProvider1.java @@ -38,23 +38,4 @@ public static void main(String[] args) throws Exception { System.out.println("Rpc context provider1 started"); new CountDownLatch(1).await(); } -// public static void main(String[] args) throws IOException { -// ServiceConfig service = new ServiceConfig<>(); -// service.setInterface(RpcContextService1.class); -// service.setRef(new RpcContextImpl1()); -// ReferenceConfig ref = new ReferenceConfig<>(); -// ref.setInterface(RpcContextService1.class); -// ref.setProtocol(RpcContextUtils.dubbo_protocol); -// ref.setTimeout(30000000); -// DubboBootstrap bootstrap = DubboBootstrap.getInstance(); -// bootstrap.application(new ApplicationConfig("rpccontext-provider-1")) -// .registry(new RegistryConfig("zookeeper://127.0.0.1:2181")) -// .protocol(new ProtocolConfig(RpcContextUtils.dubbo_protocol, 8000)) -// .service(service) -// .reference(ref) -// .start() -// .await() -// ; -// System.out.println("Rpc context provider1 started"); -// } } diff --git a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextProvider2.java b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextProvider2.java index 0f8198c028..b0cc6360b7 100644 --- a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextProvider2.java +++ b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/RpcContextProvider2.java @@ -41,21 +41,4 @@ public static void main(String[] args) throws Exception { System.out.println("Rpc context provider2 started"); new CountDownLatch(1).await(); } -// public static void main(String[] args) throws IOException { -// new EmbeddedZooKeeper(2181, false).start(); -// ServiceConfig service = new ServiceConfig<>(); -// service.setInterface(RpcContextService2.class); -// service.setRef(new RpcContextImpl2()); -// -// DubboBootstrap bootstrap = DubboBootstrap.getInstance(); -// bootstrap.application(new ApplicationConfig("rpccontext-provider-2")) -// .registry(new RegistryConfig("zookeeper://127.0.0.1:2181")) -// .protocol(new ProtocolConfig(RpcContextUtils.dubbo_protocol, 8001)) -// .service(service) -// .start() -//// .await() -// ; -// System.out.println("Rpc context provider2 started"); -// System.in.read(); -// } } From ef105fa6c88811ca7bf1f19a005c351b6541e9e0 Mon Sep 17 00:00:00 2001 From: aamingaa <49740762+aamingaa@users.noreply.github.com> Date: Wed, 9 Nov 2022 16:40:44 +0800 Subject: [PATCH 10/17] Update dubbo-3.yml --- .github/workflows/dubbo-3.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dubbo-3.yml b/.github/workflows/dubbo-3.yml index dc70c5f8a7..3020831fb5 100644 --- a/.github/workflows/dubbo-3.yml +++ b/.github/workflows/dubbo-3.yml @@ -27,7 +27,7 @@ env: spring-boot.version:1.5.22.RELEASE; spring-boot.version:2.4.1; ' - DUBBO_REF: 'feature/split_rpcContext_2' + DUBBO_REF: 'feature/split_rpcContext_3' jobs: build-samples: From a88f1be63847495744389c619104774caeb9b3c0 Mon Sep 17 00:00:00 2001 From: aamingaa <774066625@qq.com> Date: Wed, 9 Nov 2022 17:57:55 +0800 Subject: [PATCH 11/17] feat: modify yml --- .github/workflows/dubbo-3.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dubbo-3.yml b/.github/workflows/dubbo-3.yml index 3020831fb5..dc70c5f8a7 100644 --- a/.github/workflows/dubbo-3.yml +++ b/.github/workflows/dubbo-3.yml @@ -27,7 +27,7 @@ env: spring-boot.version:1.5.22.RELEASE; spring-boot.version:2.4.1; ' - DUBBO_REF: 'feature/split_rpcContext_3' + DUBBO_REF: 'feature/split_rpcContext_2' jobs: build-samples: From 3227e1e644f9dfc579feb3a8970b353826299abd Mon Sep 17 00:00:00 2001 From: aamingaa <49740762+aamingaa@users.noreply.github.com> Date: Wed, 9 Nov 2022 20:52:38 +0800 Subject: [PATCH 12/17] Delete dubbo-2.yml --- .github/workflows/dubbo-2.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .github/workflows/dubbo-2.yml diff --git a/.github/workflows/dubbo-2.yml b/.github/workflows/dubbo-2.yml deleted file mode 100644 index e69de29bb2..0000000000 From 05363892d5c2072a66a9733c93fef4fa542a60a5 Mon Sep 17 00:00:00 2001 From: aamingaa <49740762+aamingaa@users.noreply.github.com> Date: Sat, 12 Nov 2022 16:09:37 +0800 Subject: [PATCH 13/17] Update dubbo-3.yml --- .github/workflows/dubbo-3.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dubbo-3.yml b/.github/workflows/dubbo-3.yml index dc70c5f8a7..7e54e11d8e 100644 --- a/.github/workflows/dubbo-3.yml +++ b/.github/workflows/dubbo-3.yml @@ -27,7 +27,7 @@ env: spring-boot.version:1.5.22.RELEASE; spring-boot.version:2.4.1; ' - DUBBO_REF: 'feature/split_rpcContext_2' + DUBBO_REF: '3.2' jobs: build-samples: @@ -62,7 +62,7 @@ jobs: steps: - uses: actions/checkout@v2 with: - repository: 'aamingaa/dubbo' + repository: 'apache/dubbo' ref: ${{env.DUBBO_REF}} - name: Get commit id and dubbo version id: git-checker From 0ceb7a0d1ee4d7bc9723a3e2ca694c717f9e0479 Mon Sep 17 00:00:00 2001 From: aamingaa <774066625@qq.com> Date: Sat, 12 Nov 2022 16:20:02 +0800 Subject: [PATCH 14/17] feat: modify dubbo-3.yml and add license --- .github/workflows/dubbo-3.yml | 4 ++-- dubbo-samples-rpccontext/pom.xml | 2 +- .../samples/rpccontext/dto/Service1DTO.java | 19 +++++++++++++++++++ .../samples/rpccontext/dto/Service2DTO.java | 19 +++++++++++++++++++ .../PenetrateAttachmentSelectorImpl1.java | 19 +++++++++++++++++++ .../rpccontext/utils/RpcContextUtils.java | 19 +++++++++++++++++++ 6 files changed, 79 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dubbo-3.yml b/.github/workflows/dubbo-3.yml index dc70c5f8a7..7e54e11d8e 100644 --- a/.github/workflows/dubbo-3.yml +++ b/.github/workflows/dubbo-3.yml @@ -27,7 +27,7 @@ env: spring-boot.version:1.5.22.RELEASE; spring-boot.version:2.4.1; ' - DUBBO_REF: 'feature/split_rpcContext_2' + DUBBO_REF: '3.2' jobs: build-samples: @@ -62,7 +62,7 @@ jobs: steps: - uses: actions/checkout@v2 with: - repository: 'aamingaa/dubbo' + repository: 'apache/dubbo' ref: ${{env.DUBBO_REF}} - name: Get commit id and dubbo version id: git-checker diff --git a/dubbo-samples-rpccontext/pom.xml b/dubbo-samples-rpccontext/pom.xml index 93ffff91bd..1acb61747f 100644 --- a/dubbo-samples-rpccontext/pom.xml +++ b/dubbo-samples-rpccontext/pom.xml @@ -31,7 +31,7 @@ 1.8 1.8 - 3.0.7 + 3.2.0-beta.1 4.3.16.RELEASE 4.12 3.7.0 diff --git a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/dto/Service1DTO.java b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/dto/Service1DTO.java index a8e22e66a6..e09b8e6b23 100644 --- a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/dto/Service1DTO.java +++ b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/dto/Service1DTO.java @@ -1,3 +1,22 @@ +/* + * + * 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 org.apache.dubbo.samples.rpccontext.dto; import java.io.Serializable; diff --git a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/dto/Service2DTO.java b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/dto/Service2DTO.java index 948f94035a..954f093be5 100644 --- a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/dto/Service2DTO.java +++ b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/dto/Service2DTO.java @@ -1,3 +1,22 @@ +/* + * + * 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 org.apache.dubbo.samples.rpccontext.dto; import java.io.Serializable; diff --git a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/impl/PenetrateAttachmentSelectorImpl1.java b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/impl/PenetrateAttachmentSelectorImpl1.java index af68a3e2fc..056c4c1259 100644 --- a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/impl/PenetrateAttachmentSelectorImpl1.java +++ b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/impl/PenetrateAttachmentSelectorImpl1.java @@ -1,3 +1,22 @@ +/* + * + * 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 org.apache.dubbo.samples.rpccontext.impl; import org.apache.dubbo.rpc.Invocation; diff --git a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/utils/RpcContextUtils.java b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/utils/RpcContextUtils.java index 9661f46150..27ab0f9270 100644 --- a/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/utils/RpcContextUtils.java +++ b/dubbo-samples-rpccontext/src/main/java/org/apache/dubbo/samples/rpccontext/utils/RpcContextUtils.java @@ -1,3 +1,22 @@ +/* + * + * 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 org.apache.dubbo.samples.rpccontext.utils; import org.apache.dubbo.common.constants.CommonConstants; From 551d862839d370ecb822262c123fd68b7071998f Mon Sep 17 00:00:00 2001 From: aamingaa <49740762+aamingaa@users.noreply.github.com> Date: Wed, 30 Nov 2022 14:41:04 +0800 Subject: [PATCH 15/17] Update dubbo-samples-rpccontext/case-versions.conf Co-authored-by: Albumen Kevin --- dubbo-samples-rpccontext/case-versions.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dubbo-samples-rpccontext/case-versions.conf b/dubbo-samples-rpccontext/case-versions.conf index 0e26c8bf14..a226141fc7 100644 --- a/dubbo-samples-rpccontext/case-versions.conf +++ b/dubbo-samples-rpccontext/case-versions.conf @@ -20,5 +20,5 @@ # Supported component versions of the test case # Spring app -dubbo.version=2.7*, 3.* +dubbo.version= [ >= 3.2.0 ] spring.version=4.*, 5.* From 9cecb0ffeaf8dc5e312d3c2458e05d06dd8b5a76 Mon Sep 17 00:00:00 2001 From: aamingaa <49740762+aamingaa@users.noreply.github.com> Date: Wed, 30 Nov 2022 14:42:49 +0800 Subject: [PATCH 16/17] Update dubbo-3_1.yml --- .github/workflows/dubbo-3_1.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dubbo-3_1.yml b/.github/workflows/dubbo-3_1.yml index 80089c9e5a..3d7b17b92d 100644 --- a/.github/workflows/dubbo-3_1.yml +++ b/.github/workflows/dubbo-3_1.yml @@ -27,7 +27,7 @@ env: spring-boot.version:1.5.22.RELEASE; spring-boot.version:2.4.1; ' - DUBBO_REF: '3.2' + DUBBO_REF: '3.1' jobs: build-samples: From 4d26af8f96a2b8dc28cb21cef945a1a4128b7d02 Mon Sep 17 00:00:00 2001 From: aamingaa <774066625@qq.com> Date: Wed, 30 Nov 2022 17:40:39 +0800 Subject: [PATCH 17/17] feat: modify dubbo version --- dubbo-samples-rpccontext/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dubbo-samples-rpccontext/pom.xml b/dubbo-samples-rpccontext/pom.xml index 1acb61747f..ee604b3815 100644 --- a/dubbo-samples-rpccontext/pom.xml +++ b/dubbo-samples-rpccontext/pom.xml @@ -31,7 +31,7 @@ 1.8 1.8 - 3.2.0-beta.1 + 3.2.0-beta.2 4.3.16.RELEASE 4.12 3.7.0