This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-samples.git
The following commit(s) were added to refs/heads/master by this push:
new 123f7e69 Add shop task (#645)
123f7e69 is described below
commit 123f7e692748ed22e6d04e41e09d7c9425528b96
Author: Albumen Kevin <[email protected]>
AuthorDate: Tue Dec 20 16:09:39 2022 +0800
Add shop task (#645)
---
10-task/dubbo-samples-shop/deploy/All.yml | 484 +++++++++++++++++++++
10-task/dubbo-samples-shop/deploy/App.yml | 275 ++++++++++++
10-task/dubbo-samples-shop/deploy/Namespace.yml | 25 ++
.../deploy/detail/Deployment.yml | 64 +++
.../deploy/dubbo-admin/ConfigMap.yml | 27 ++
.../deploy/dubbo-admin/Deployment.yml | 44 ++
.../deploy/dubbo-admin/Service.yml | 27 ++
.../deploy/frontend/Deployment.yml | 64 +++
.../dubbo-samples-shop/deploy/nacos/Deployment.yml | 54 +++
.../dubbo-samples-shop/deploy/nacos/Service.yml | 32 ++
.../deploy/order-v1/Deployment.yml | 64 +++
.../deploy/order-v2/Deployment.yml | 64 +++
.../deploy/skywalking/Deployment.yml | 58 +++
.../deploy/skywalking/Service.yml | 47 ++
.../dubbo-samples-shop/deploy/user/Deployment.yml | 64 +++
.../{ => dubbo-samples-shop-detail-api}/pom.xml | 18 +-
.../org/apache/dubbo/samples/DetailService.java | 24 +
.../main/java/org/apache/dubbo/samples/Item.java | 58 +++
.../dubbo-samples-shop-detail/pom.xml | 107 +++++
.../dubbo/samples/detail/DetailApplication.java | 32 ++
.../dubbo/samples/detail/DetailServiceImpl.java | 56 +++
.../src/main/resources/application.properties | 30 ++
.../{ => dubbo-samples-shop-frontend-api}/pom.xml | 18 +-
.../java/org/apache/dubbo/samples/ShopService.java | 28 ++
.../dubbo-samples-shop-frontend/pom.xml | 123 ++++++
.../dubbo/samples/frontend/BenchmarkClient.java | 114 +++++
.../samples/frontend/FrontEndApplication.java | 32 ++
.../dubbo/samples/frontend/ShopServiceImpl.java | 76 ++++
.../src/main/resources/application.properties | 30 ++
.../{ => dubbo-samples-shop-order-api}/pom.xml | 18 +-
.../main/java/org/apache/dubbo/samples/Order.java | 68 +++
.../org/apache/dubbo/samples/OrderService.java | 22 +
.../dubbo-samples-shop-order-v1/pom.xml | 107 +++++
.../dubbo/samples/order/OrderApplicationV1.java | 32 ++
.../dubbo/samples/order/OrderServiceImpl.java | 40 ++
.../src/main/resources/application.properties | 30 ++
.../dubbo-samples-shop-order-v2/pom.xml | 112 +++++
.../dubbo/samples/order/OrderApplicationV2.java | 32 ++
.../dubbo/samples/order/OrderServiceImpl.java | 45 ++
.../src/main/resources/application.properties | 30 ++
.../{ => dubbo-samples-shop-user-api}/pom.xml | 18 +-
.../main/java/org/apache/dubbo/samples/User.java | 67 +++
.../java/org/apache/dubbo/samples/UserService.java | 24 +
.../dubbo-samples-shop-user/pom.xml | 107 +++++
.../apache/dubbo/samples/user/UserApplication.java | 32 ++
.../apache/dubbo/samples/user/UserServiceImpl.java | 60 +++
.../src/main/resources/application.properties | 30 ++
10-task/dubbo-samples-shop/pom.xml | 16 +-
48 files changed, 2998 insertions(+), 31 deletions(-)
diff --git a/10-task/dubbo-samples-shop/deploy/All.yml
b/10-task/dubbo-samples-shop/deploy/All.yml
new file mode 100644
index 00000000..08271977
--- /dev/null
+++ b/10-task/dubbo-samples-shop/deploy/All.yml
@@ -0,0 +1,484 @@
+# 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.
+
+# Namespace
+apiVersion: v1
+kind: Namespace
+metadata:
+ name: dubbo-demo
+---
+apiVersion: v1
+kind: Namespace
+metadata:
+ name: dubbo-system
+---
+
+# Nacos
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: nacos
+ namespace: dubbo-system
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: nacos
+ template:
+ metadata:
+ labels:
+ app: nacos
+ spec:
+ containers:
+ - name: consumer
+ image: nacos/nacos-server:v2.1.2
+ imagePullPolicy: Always
+ resources:
+ requests:
+ memory: "2Gi"
+ cpu: "500m"
+ ports:
+ - containerPort: 8848
+ name: client
+ - containerPort: 9848
+ name: client-rpc
+ env:
+ - name: NACOS_SERVER_PORT
+ value: "8848"
+ - name: NACOS_APPLICATION_PORT
+ value: "8848"
+ - name: PREFER_HOST_MODE
+ value: "hostname"
+ - name: MODE
+ value: "standalone"
+ - name: NACOS_AUTH_ENABLE
+ value: "true"
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: nacos
+ namespace: dubbo-system
+spec:
+ type: ClusterIP
+ sessionAffinity: None
+ selector:
+ app: nacos
+ ports:
+ - port: 8848
+ name: server
+ targetPort: 8848
+ - port: 9848
+ name: client-rpc
+ targetPort: 9848
+---
+
+# Dubbo Admin
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: dubbo-admin
+ namespace: dubbo-system
+data:
+ # Set the properties you want to override, properties not set here will be
using the default values
+ # check application.properties inside dubbo-admin project for the keys
supported
+ application.properties: |
+
admin.registry.address=nacos://nacos.dubbo-system.svc:8848?username=nacos&password=nacos
+
admin.config-center=nacos://nacos.dubbo-system.svc:8848?username=nacos&password=nacos
+
admin.metadata-report.address=nacos://nacos.dubbo-system.svc:8848?username=nacos&password=nacos
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: dubbo-admin
+ namespace: dubbo-system
+ labels:
+ app: dubbo-admin
+spec:
+ replicas: 2
+ selector:
+ matchLabels:
+ app: dubbo-admin
+ template:
+ metadata:
+ labels:
+ app: dubbo-admin
+ spec:
+ containers:
+ - image: apache/dubbo-admin:0.5.0
+ name: dubbo-admin
+ ports:
+ - containerPort: 38080
+ volumeMounts:
+ - mountPath: /config
+ name: application-properties
+ volumes:
+ - name: application-properties
+ configMap:
+ name: dubbo-admin
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: dubbo-admin
+ namespace: dubbo-system
+spec:
+ selector:
+ app: dubbo-admin
+ ports:
+ - protocol: TCP
+ port: 38080
+ targetPort: 38080
+---
+
+# Skywalking
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: skywalking-oap-server
+ namespace: dubbo-system
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: skywalking-oap-server
+ template:
+ metadata:
+ labels:
+ app: skywalking-oap-server
+ spec:
+ containers:
+ - name: skywalking-oap-server
+ image: apache/skywalking-oap-server:9.3.0
+ imagePullPolicy: Always
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: skywalking-oap-dashboard
+ namespace: dubbo-system
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: skywalking-oap-dashboard
+ template:
+ metadata:
+ labels:
+ app: skywalking-oap-dashboard
+ spec:
+ containers:
+ - name: skywalking-oap-dashboard
+ image: apache/skywalking-ui:9.3.0
+ imagePullPolicy: Always
+ env:
+ - name: SW_OAP_ADDRESS
+ value: http://skywalking-oap-server.dubbo-system.svc:12800
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: skywalking-oap-server
+ namespace: dubbo-system
+spec:
+ type: ClusterIP
+ sessionAffinity: None
+ selector:
+ app: skywalking-oap-server
+ ports:
+ - port: 12800
+ name: rest
+ targetPort: 12800
+ - port: 11800
+ name: grpc
+ targetPort: 11800
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: skywalking-oap-dashboard
+ namespace: dubbo-system
+spec:
+ type: ClusterIP
+ sessionAffinity: None
+ selector:
+ app: skywalking-oap-dashboard
+ ports:
+ - port: 8080
+ name: http
+ targetPort: 8080
+---
+
+# App FrontEnd
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: shop-frontend
+ namespace: dubbo-demo
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: shop-frontend
+ template:
+ metadata:
+ labels:
+ app: shop-frontend
+ spec:
+ volumes:
+ - name: skywalking-agent
+ emptyDir: { }
+
+ initContainers:
+ - name: agent-container
+ image: apache/skywalking-java-agent:8.13.0-java17
+ volumeMounts:
+ - name: skywalking-agent
+ mountPath: /agent
+ command: [ "/bin/sh" ]
+ args: [ "-c", "cp -R /skywalking/agent /agent/" ]
+
+ containers:
+ - name: shop-frontend
+ image: apache/dubbo-demo:dubbo-samples-shop-frontend_0.0.1
+ imagePullPolicy: Always
+ ports:
+ - name: dubbo
+ containerPort: 20881
+ protocol: TCP
+ - name: dubbo-qos
+ containerPort: 20991
+ protocol: TCP
+ volumeMounts:
+ - name: skywalking-agent
+ mountPath: /skywalking
+ env:
+ - name: JAVA_TOOL_OPTIONS
+ value: "-javaagent:/skywalking/agent/skywalking-agent.jar"
+ - name: SW_AGENT_NAME
+ value: shop::shop-frontend
+ - name: SW_AGENT_COLLECTOR_BACKEND_SERVICES
+ value: "skywalking-oap-server.dubbo-system.svc:11800"
+---
+
+# App Order V1
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: shop-order-v1
+ namespace: dubbo-demo
+spec:
+ replicas: 2
+ selector:
+ matchLabels:
+ app: shop-order-v1
+ template:
+ metadata:
+ labels:
+ app: shop-order-v1
+ spec:
+ volumes:
+ - name: skywalking-agent
+ emptyDir: { }
+
+ initContainers:
+ - name: agent-container
+ image: apache/skywalking-java-agent:8.13.0-java17
+ volumeMounts:
+ - name: skywalking-agent
+ mountPath: /agent
+ command: [ "/bin/sh" ]
+ args: [ "-c", "cp -R /skywalking/agent /agent/" ]
+
+ containers:
+ - name: shop-order
+ image: apache/dubbo-demo:dubbo-samples-shop-order_v1_0.0.1
+ imagePullPolicy: Always
+ ports:
+ - name: dubbo
+ containerPort: 20882
+ protocol: TCP
+ - name: dubbo-qos
+ containerPort: 20992
+ protocol: TCP
+ volumeMounts:
+ - name: skywalking-agent
+ mountPath: /skywalking
+ env:
+ - name: JAVA_TOOL_OPTIONS
+ value: "-javaagent:/skywalking/agent/skywalking-agent.jar"
+ - name: SW_AGENT_NAME
+ value: shop::shop-order
+ - name: SW_AGENT_COLLECTOR_BACKEND_SERVICES
+ value: "skywalking-oap-server.dubbo-system.svc:11800"
+---
+
+# App Order V2
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: shop-order-v2
+ namespace: dubbo-demo
+spec:
+ replicas: 3
+ selector:
+ matchLabels:
+ app: shop-order-v2
+ template:
+ metadata:
+ labels:
+ app: shop-order-v2
+ spec:
+ volumes:
+ - name: skywalking-agent
+ emptyDir: { }
+
+ initContainers:
+ - name: agent-container
+ image: apache/skywalking-java-agent:8.13.0-java17
+ volumeMounts:
+ - name: skywalking-agent
+ mountPath: /agent
+ command: [ "/bin/sh" ]
+ args: [ "-c", "cp -R /skywalking/agent /agent/" ]
+
+ containers:
+ - name: shop-order
+ image: apache/dubbo-demo:dubbo-samples-shop-order_v2_0.0.1
+ imagePullPolicy: Always
+ ports:
+ - name: dubbo
+ containerPort: 20883
+ protocol: TCP
+ - name: dubbo-qos
+ containerPort: 20993
+ protocol: TCP
+ volumeMounts:
+ - name: skywalking-agent
+ mountPath: /skywalking
+ env:
+ - name: JAVA_TOOL_OPTIONS
+ value: "-javaagent:/skywalking/agent/skywalking-agent.jar"
+ - name: SW_AGENT_NAME
+ value: shop::shop-order
+ - name: SW_AGENT_COLLECTOR_BACKEND_SERVICES
+ value: "skywalking-oap-server.dubbo-system.svc:11800"
+
+---
+
+# App User
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: shop-user
+ namespace: dubbo-demo
+spec:
+ replicas: 3
+ selector:
+ matchLabels:
+ app: shop-user
+ template:
+ metadata:
+ labels:
+ app: shop-user
+ spec:
+ volumes:
+ - name: skywalking-agent
+ emptyDir: { }
+
+ initContainers:
+ - name: agent-container
+ image: apache/skywalking-java-agent:8.13.0-java17
+ volumeMounts:
+ - name: skywalking-agent
+ mountPath: /agent
+ command: [ "/bin/sh" ]
+ args: [ "-c", "cp -R /skywalking/agent /agent/" ]
+
+ containers:
+ - name: shop-user
+ image: apache/dubbo-demo:dubbo-samples-shop-user_0.0.1
+ imagePullPolicy: Always
+ ports:
+ - name: dubbo
+ containerPort: 20884
+ protocol: TCP
+ - name: dubbo-qos
+ containerPort: 20994
+ protocol: TCP
+ volumeMounts:
+ - name: skywalking-agent
+ mountPath: /skywalking
+ env:
+ - name: JAVA_TOOL_OPTIONS
+ value: "-javaagent:/skywalking/agent/skywalking-agent.jar"
+ - name: SW_AGENT_NAME
+ value: shop::shop-user
+ - name: SW_AGENT_COLLECTOR_BACKEND_SERVICES
+ value: "skywalking-oap-server.dubbo-system.svc:11800"
+---
+
+# App Detail
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: shop-detail
+ namespace: dubbo-demo
+spec:
+ replicas: 3
+ selector:
+ matchLabels:
+ app: shop-detail
+ template:
+ metadata:
+ labels:
+ app: shop-detail
+ spec:
+ volumes:
+ - name: skywalking-agent
+ emptyDir: { }
+
+ initContainers:
+ - name: agent-container
+ image: apache/skywalking-java-agent:8.13.0-java17
+ volumeMounts:
+ - name: skywalking-agent
+ mountPath: /agent
+ command: [ "/bin/sh" ]
+ args: [ "-c", "cp -R /skywalking/agent /agent/" ]
+
+ containers:
+ - name: shop-detail
+ image: apache/dubbo-demo:dubbo-samples-shop-detail_0.0.1
+ imagePullPolicy: Always
+ ports:
+ - name: dubbo
+ containerPort: 20885
+ protocol: TCP
+ - name: dubbo-qos
+ containerPort: 20995
+ protocol: TCP
+ volumeMounts:
+ - name: skywalking-agent
+ mountPath: /skywalking
+ env:
+ - name: JAVA_TOOL_OPTIONS
+ value: "-javaagent:/skywalking/agent/skywalking-agent.jar"
+ - name: SW_AGENT_NAME
+ value: shop::shop-detail
+ - name: SW_AGENT_COLLECTOR_BACKEND_SERVICES
+ value: "skywalking-oap-server.dubbo-system.svc:11800"
+---
+
diff --git a/10-task/dubbo-samples-shop/deploy/App.yml
b/10-task/dubbo-samples-shop/deploy/App.yml
new file mode 100644
index 00000000..09c75f0b
--- /dev/null
+++ b/10-task/dubbo-samples-shop/deploy/App.yml
@@ -0,0 +1,275 @@
+# 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.
+
+# App FrontEnd
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: shop-frontend
+ namespace: dubbo-demo
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: shop-frontend
+ template:
+ metadata:
+ labels:
+ app: shop-frontend
+ spec:
+ volumes:
+ - name: skywalking-agent
+ emptyDir: { }
+
+ initContainers:
+ - name: agent-container
+ image: apache/skywalking-java-agent:8.13.0-java17
+ volumeMounts:
+ - name: skywalking-agent
+ mountPath: /agent
+ command: [ "/bin/sh" ]
+ args: [ "-c", "cp -R /skywalking/agent /agent/" ]
+
+ containers:
+ - name: shop-frontend
+ image: apache/dubbo-demo:dubbo-samples-shop-frontend_0.0.1
+ imagePullPolicy: Always
+ ports:
+ - name: dubbo
+ containerPort: 20881
+ protocol: TCP
+ - name: dubbo-qos
+ containerPort: 20991
+ protocol: TCP
+ volumeMounts:
+ - name: skywalking-agent
+ mountPath: /skywalking
+ env:
+ - name: JAVA_TOOL_OPTIONS
+ value: "-javaagent:/skywalking/agent/skywalking-agent.jar"
+ - name: SW_AGENT_NAME
+ value: shop::shop-frontend
+ - name: SW_AGENT_COLLECTOR_BACKEND_SERVICES
+ value: "skywalking-oap-server.dubbo-system.svc:11800"
+---
+
+# App Order V1
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: shop-order-v1
+ namespace: dubbo-demo
+spec:
+ replicas: 2
+ selector:
+ matchLabels:
+ app: shop-order-v1
+ template:
+ metadata:
+ labels:
+ app: shop-order-v1
+ spec:
+ volumes:
+ - name: skywalking-agent
+ emptyDir: { }
+
+ initContainers:
+ - name: agent-container
+ image: apache/skywalking-java-agent:8.13.0-java17
+ volumeMounts:
+ - name: skywalking-agent
+ mountPath: /agent
+ command: [ "/bin/sh" ]
+ args: [ "-c", "cp -R /skywalking/agent /agent/" ]
+
+ containers:
+ - name: shop-order
+ image: apache/dubbo-demo:dubbo-samples-shop-order_v1_0.0.1
+ imagePullPolicy: Always
+ ports:
+ - name: dubbo
+ containerPort: 20882
+ protocol: TCP
+ - name: dubbo-qos
+ containerPort: 20992
+ protocol: TCP
+ volumeMounts:
+ - name: skywalking-agent
+ mountPath: /skywalking
+ env:
+ - name: JAVA_TOOL_OPTIONS
+ value: "-javaagent:/skywalking/agent/skywalking-agent.jar"
+ - name: SW_AGENT_NAME
+ value: shop::shop-order
+ - name: SW_AGENT_COLLECTOR_BACKEND_SERVICES
+ value: "skywalking-oap-server.dubbo-system.svc:11800"
+---
+
+# App Order V2
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: shop-order-v2
+ namespace: dubbo-demo
+spec:
+ replicas: 3
+ selector:
+ matchLabels:
+ app: shop-order-v2
+ template:
+ metadata:
+ labels:
+ app: shop-order-v2
+ spec:
+ volumes:
+ - name: skywalking-agent
+ emptyDir: { }
+
+ initContainers:
+ - name: agent-container
+ image: apache/skywalking-java-agent:8.13.0-java17
+ volumeMounts:
+ - name: skywalking-agent
+ mountPath: /agent
+ command: [ "/bin/sh" ]
+ args: [ "-c", "cp -R /skywalking/agent /agent/" ]
+
+ containers:
+ - name: shop-order
+ image: apache/dubbo-demo:dubbo-samples-shop-order_v2_0.0.1
+ imagePullPolicy: Always
+ ports:
+ - name: dubbo
+ containerPort: 20883
+ protocol: TCP
+ - name: dubbo-qos
+ containerPort: 20993
+ protocol: TCP
+ volumeMounts:
+ - name: skywalking-agent
+ mountPath: /skywalking
+ env:
+ - name: JAVA_TOOL_OPTIONS
+ value: "-javaagent:/skywalking/agent/skywalking-agent.jar"
+ - name: SW_AGENT_NAME
+ value: shop::shop-order
+ - name: SW_AGENT_COLLECTOR_BACKEND_SERVICES
+ value: "skywalking-oap-server.dubbo-system.svc:11800"
+
+---
+
+# App User
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: shop-user
+ namespace: dubbo-demo
+spec:
+ replicas: 3
+ selector:
+ matchLabels:
+ app: shop-user
+ template:
+ metadata:
+ labels:
+ app: shop-user
+ spec:
+ volumes:
+ - name: skywalking-agent
+ emptyDir: { }
+
+ initContainers:
+ - name: agent-container
+ image: apache/skywalking-java-agent:8.13.0-java17
+ volumeMounts:
+ - name: skywalking-agent
+ mountPath: /agent
+ command: [ "/bin/sh" ]
+ args: [ "-c", "cp -R /skywalking/agent /agent/" ]
+
+ containers:
+ - name: shop-user
+ image: apache/dubbo-demo:dubbo-samples-shop-user_0.0.1
+ imagePullPolicy: Always
+ ports:
+ - name: dubbo
+ containerPort: 20884
+ protocol: TCP
+ - name: dubbo-qos
+ containerPort: 20994
+ protocol: TCP
+ volumeMounts:
+ - name: skywalking-agent
+ mountPath: /skywalking
+ env:
+ - name: JAVA_TOOL_OPTIONS
+ value: "-javaagent:/skywalking/agent/skywalking-agent.jar"
+ - name: SW_AGENT_NAME
+ value: shop::shop-user
+ - name: SW_AGENT_COLLECTOR_BACKEND_SERVICES
+ value: "skywalking-oap-server.dubbo-system.svc:11800"
+---
+
+# App Detail
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: shop-detail
+ namespace: dubbo-demo
+spec:
+ replicas: 3
+ selector:
+ matchLabels:
+ app: shop-detail
+ template:
+ metadata:
+ labels:
+ app: shop-detail
+ spec:
+ volumes:
+ - name: skywalking-agent
+ emptyDir: { }
+
+ initContainers:
+ - name: agent-container
+ image: apache/skywalking-java-agent:8.13.0-java17
+ volumeMounts:
+ - name: skywalking-agent
+ mountPath: /agent
+ command: [ "/bin/sh" ]
+ args: [ "-c", "cp -R /skywalking/agent /agent/" ]
+
+ containers:
+ - name: shop-detail
+ image: apache/dubbo-demo:dubbo-samples-shop-detail_0.0.1
+ imagePullPolicy: Always
+ ports:
+ - name: dubbo
+ containerPort: 20885
+ protocol: TCP
+ - name: dubbo-qos
+ containerPort: 20995
+ protocol: TCP
+ volumeMounts:
+ - name: skywalking-agent
+ mountPath: /skywalking
+ env:
+ - name: JAVA_TOOL_OPTIONS
+ value: "-javaagent:/skywalking/agent/skywalking-agent.jar"
+ - name: SW_AGENT_NAME
+ value: shop::shop-detail
+ - name: SW_AGENT_COLLECTOR_BACKEND_SERVICES
+ value: "skywalking-oap-server.dubbo-system.svc:11800"
+---
diff --git a/10-task/dubbo-samples-shop/deploy/Namespace.yml
b/10-task/dubbo-samples-shop/deploy/Namespace.yml
new file mode 100644
index 00000000..20d311f1
--- /dev/null
+++ b/10-task/dubbo-samples-shop/deploy/Namespace.yml
@@ -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.
+
+apiVersion: v1
+kind: Namespace
+metadata:
+ name: dubbo-demo
+---
+
+apiVersion: v1
+kind: Namespace
+metadata:
+ name: dubbo-system
\ No newline at end of file
diff --git a/10-task/dubbo-samples-shop/deploy/detail/Deployment.yml
b/10-task/dubbo-samples-shop/deploy/detail/Deployment.yml
new file mode 100644
index 00000000..301ff76c
--- /dev/null
+++ b/10-task/dubbo-samples-shop/deploy/detail/Deployment.yml
@@ -0,0 +1,64 @@
+# 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.
+
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: shop-detail
+ namespace: dubbo-demo
+spec:
+ replicas: 3
+ selector:
+ matchLabels:
+ app: shop-detail
+ template:
+ metadata:
+ labels:
+ app: shop-detail
+ spec:
+ volumes:
+ - name: skywalking-agent
+ emptyDir: { }
+
+ initContainers:
+ - name: agent-container
+ image: apache/skywalking-java-agent:8.13.0-java17
+ volumeMounts:
+ - name: skywalking-agent
+ mountPath: /agent
+ command: [ "/bin/sh" ]
+ args: [ "-c", "cp -R /skywalking/agent /agent/" ]
+
+ containers:
+ - name: shop-detail
+ image: apache/dubbo-demo:dubbo-samples-shop-detail_0.0.1
+ imagePullPolicy: Always
+ ports:
+ - name: dubbo
+ containerPort: 20885
+ protocol: TCP
+ - name: dubbo-qos
+ containerPort: 20995
+ protocol: TCP
+ volumeMounts:
+ - name: skywalking-agent
+ mountPath: /skywalking
+ env:
+ - name: JAVA_TOOL_OPTIONS
+ value: "-javaagent:/skywalking/agent/skywalking-agent.jar"
+ - name: SW_AGENT_NAME
+ value: shop::shop-detail
+ - name: SW_AGENT_COLLECTOR_BACKEND_SERVICES
+ value: "skywalking-oap-server.dubbo-system.svc:11800"
diff --git a/10-task/dubbo-samples-shop/deploy/dubbo-admin/ConfigMap.yml
b/10-task/dubbo-samples-shop/deploy/dubbo-admin/ConfigMap.yml
new file mode 100644
index 00000000..f1876acb
--- /dev/null
+++ b/10-task/dubbo-samples-shop/deploy/dubbo-admin/ConfigMap.yml
@@ -0,0 +1,27 @@
+# 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.
+
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: dubbo-admin
+ namespace: dubbo-system
+data:
+ # Set the properties you want to override, properties not set here will be
using the default values
+ # check application.properties inside dubbo-admin project for the keys
supported
+ application.properties: |
+
admin.registry.address=nacos://nacos.dubbo-system.svc:8848?username=nacos&password=nacos
+
admin.config-center=nacos://nacos.dubbo-system.svc:8848?username=nacos&password=nacos
+
admin.metadata-report.address=nacos://nacos.dubbo-system.svc:8848?username=nacos&password=nacos
diff --git a/10-task/dubbo-samples-shop/deploy/dubbo-admin/Deployment.yml
b/10-task/dubbo-samples-shop/deploy/dubbo-admin/Deployment.yml
new file mode 100644
index 00000000..e4a64856
--- /dev/null
+++ b/10-task/dubbo-samples-shop/deploy/dubbo-admin/Deployment.yml
@@ -0,0 +1,44 @@
+# 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.
+
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: dubbo-admin
+ namespace: dubbo-system
+ labels:
+ app: dubbo-admin
+spec:
+ replicas: 2
+ selector:
+ matchLabels:
+ app: dubbo-admin
+ template:
+ metadata:
+ labels:
+ app: dubbo-admin
+ spec:
+ containers:
+ - image: apache/dubbo-admin:0.5.0
+ name: dubbo-admin
+ ports:
+ - containerPort: 38080
+ volumeMounts:
+ - mountPath: /config
+ name: application-properties
+ volumes:
+ - name: application-properties
+ configMap:
+ name: dubbo-admin
diff --git a/10-task/dubbo-samples-shop/deploy/dubbo-admin/Service.yml
b/10-task/dubbo-samples-shop/deploy/dubbo-admin/Service.yml
new file mode 100644
index 00000000..3d3b9ebd
--- /dev/null
+++ b/10-task/dubbo-samples-shop/deploy/dubbo-admin/Service.yml
@@ -0,0 +1,27 @@
+# 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.
+
+apiVersion: v1
+kind: Service
+metadata:
+ name: dubbo-admin
+ namespace: dubbo-system
+spec:
+ selector:
+ app: dubbo-admin
+ ports:
+ - protocol: TCP
+ port: 38080
+ targetPort: 38080
diff --git a/10-task/dubbo-samples-shop/deploy/frontend/Deployment.yml
b/10-task/dubbo-samples-shop/deploy/frontend/Deployment.yml
new file mode 100644
index 00000000..e05809c7
--- /dev/null
+++ b/10-task/dubbo-samples-shop/deploy/frontend/Deployment.yml
@@ -0,0 +1,64 @@
+# 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.
+
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: shop-frontend
+ namespace: dubbo-demo
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: shop-frontend
+ template:
+ metadata:
+ labels:
+ app: shop-frontend
+ spec:
+ volumes:
+ - name: skywalking-agent
+ emptyDir: { }
+
+ initContainers:
+ - name: agent-container
+ image: apache/skywalking-java-agent:8.13.0-java17
+ volumeMounts:
+ - name: skywalking-agent
+ mountPath: /agent
+ command: [ "/bin/sh" ]
+ args: [ "-c", "cp -R /skywalking/agent /agent/" ]
+
+ containers:
+ - name: shop-frontend
+ image: apache/dubbo-demo:dubbo-samples-shop-frontend_0.0.1
+ imagePullPolicy: Always
+ ports:
+ - name: dubbo
+ containerPort: 20881
+ protocol: TCP
+ - name: dubbo-qos
+ containerPort: 20991
+ protocol: TCP
+ volumeMounts:
+ - name: skywalking-agent
+ mountPath: /skywalking
+ env:
+ - name: JAVA_TOOL_OPTIONS
+ value: "-javaagent:/skywalking/agent/skywalking-agent.jar"
+ - name: SW_AGENT_NAME
+ value: shop::shop-frontend
+ - name: SW_AGENT_COLLECTOR_BACKEND_SERVICES
+ value: "skywalking-oap-server.dubbo-system.svc:11800"
diff --git a/10-task/dubbo-samples-shop/deploy/nacos/Deployment.yml
b/10-task/dubbo-samples-shop/deploy/nacos/Deployment.yml
new file mode 100644
index 00000000..16037ec1
--- /dev/null
+++ b/10-task/dubbo-samples-shop/deploy/nacos/Deployment.yml
@@ -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.
+
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: nacos
+ namespace: dubbo-system
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: nacos
+ template:
+ metadata:
+ labels:
+ app: nacos
+ spec:
+ containers:
+ - name: consumer
+ image: nacos/nacos-server:v2.1.2
+ imagePullPolicy: Always
+ resources:
+ requests:
+ memory: "2Gi"
+ cpu: "500m"
+ ports:
+ - containerPort: 8848
+ name: client
+ - containerPort: 9848
+ name: client-rpc
+ env:
+ - name: NACOS_SERVER_PORT
+ value: "8848"
+ - name: NACOS_APPLICATION_PORT
+ value: "8848"
+ - name: PREFER_HOST_MODE
+ value: "hostname"
+ - name: MODE
+ value: "standalone"
+ - name: NACOS_AUTH_ENABLE
+ value: "true"
\ No newline at end of file
diff --git a/10-task/dubbo-samples-shop/deploy/nacos/Service.yml
b/10-task/dubbo-samples-shop/deploy/nacos/Service.yml
new file mode 100644
index 00000000..94498143
--- /dev/null
+++ b/10-task/dubbo-samples-shop/deploy/nacos/Service.yml
@@ -0,0 +1,32 @@
+# 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.
+
+apiVersion: v1
+kind: Service
+metadata:
+ name: nacos
+ namespace: dubbo-system
+spec:
+ type: ClusterIP
+ sessionAffinity: None
+ selector:
+ app: nacos
+ ports:
+ - port: 8848
+ name: server
+ targetPort: 8848
+ - port: 9848
+ name: client-rpc
+ targetPort: 9848
\ No newline at end of file
diff --git a/10-task/dubbo-samples-shop/deploy/order-v1/Deployment.yml
b/10-task/dubbo-samples-shop/deploy/order-v1/Deployment.yml
new file mode 100644
index 00000000..36e54d93
--- /dev/null
+++ b/10-task/dubbo-samples-shop/deploy/order-v1/Deployment.yml
@@ -0,0 +1,64 @@
+# 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.
+
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: shop-order-v1
+ namespace: dubbo-demo
+spec:
+ replicas: 2
+ selector:
+ matchLabels:
+ app: shop-order-v1
+ template:
+ metadata:
+ labels:
+ app: shop-order-v1
+ spec:
+ volumes:
+ - name: skywalking-agent
+ emptyDir: { }
+
+ initContainers:
+ - name: agent-container
+ image: apache/skywalking-java-agent:8.13.0-java17
+ volumeMounts:
+ - name: skywalking-agent
+ mountPath: /agent
+ command: [ "/bin/sh" ]
+ args: [ "-c", "cp -R /skywalking/agent /agent/" ]
+
+ containers:
+ - name: shop-order
+ image: apache/dubbo-demo:dubbo-samples-shop-order_v1_0.0.1
+ imagePullPolicy: Always
+ ports:
+ - name: dubbo
+ containerPort: 20882
+ protocol: TCP
+ - name: dubbo-qos
+ containerPort: 20992
+ protocol: TCP
+ volumeMounts:
+ - name: skywalking-agent
+ mountPath: /skywalking
+ env:
+ - name: JAVA_TOOL_OPTIONS
+ value: "-javaagent:/skywalking/agent/skywalking-agent.jar"
+ - name: SW_AGENT_NAME
+ value: shop::shop-order
+ - name: SW_AGENT_COLLECTOR_BACKEND_SERVICES
+ value: "skywalking-oap-server.dubbo-system.svc:11800"
diff --git a/10-task/dubbo-samples-shop/deploy/order-v2/Deployment.yml
b/10-task/dubbo-samples-shop/deploy/order-v2/Deployment.yml
new file mode 100644
index 00000000..cdde71bb
--- /dev/null
+++ b/10-task/dubbo-samples-shop/deploy/order-v2/Deployment.yml
@@ -0,0 +1,64 @@
+# 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.
+
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: shop-order-v2
+ namespace: dubbo-demo
+spec:
+ replicas: 3
+ selector:
+ matchLabels:
+ app: shop-order-v2
+ template:
+ metadata:
+ labels:
+ app: shop-order-v2
+ spec:
+ volumes:
+ - name: skywalking-agent
+ emptyDir: { }
+
+ initContainers:
+ - name: agent-container
+ image: apache/skywalking-java-agent:8.13.0-java17
+ volumeMounts:
+ - name: skywalking-agent
+ mountPath: /agent
+ command: [ "/bin/sh" ]
+ args: [ "-c", "cp -R /skywalking/agent /agent/" ]
+
+ containers:
+ - name: shop-order
+ image: apache/dubbo-demo:dubbo-samples-shop-order_v2_0.0.1
+ imagePullPolicy: Always
+ ports:
+ - name: dubbo
+ containerPort: 20883
+ protocol: TCP
+ - name: dubbo-qos
+ containerPort: 20993
+ protocol: TCP
+ volumeMounts:
+ - name: skywalking-agent
+ mountPath: /skywalking
+ env:
+ - name: JAVA_TOOL_OPTIONS
+ value: "-javaagent:/skywalking/agent/skywalking-agent.jar"
+ - name: SW_AGENT_NAME
+ value: shop::shop-order
+ - name: SW_AGENT_COLLECTOR_BACKEND_SERVICES
+ value: "skywalking-oap-server.dubbo-system.svc:11800"
diff --git a/10-task/dubbo-samples-shop/deploy/skywalking/Deployment.yml
b/10-task/dubbo-samples-shop/deploy/skywalking/Deployment.yml
new file mode 100644
index 00000000..e5bac123
--- /dev/null
+++ b/10-task/dubbo-samples-shop/deploy/skywalking/Deployment.yml
@@ -0,0 +1,58 @@
+# 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.
+
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: skywalking-oap-server
+ namespace: dubbo-system
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: skywalking-oap-server
+ template:
+ metadata:
+ labels:
+ app: skywalking-oap-server
+ spec:
+ containers:
+ - name: skywalking-oap-server
+ image: apache/skywalking-oap-server:9.0.0
+ imagePullPolicy: Always
+
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: skywalking-oap-dashboard
+ namespace: dubbo-system
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: skywalking-oap-dashboard
+ template:
+ metadata:
+ labels:
+ app: skywalking-oap-dashboard
+ spec:
+ containers:
+ - name: skywalking-oap-dashboard
+ image: apache/skywalking-ui:8.8.0
+ imagePullPolicy: Always
+ env:
+ - name: SW_OAP_ADDRESS
+ value: http://skywalking-oap-server.dubbo-system.svc:12800
\ No newline at end of file
diff --git a/10-task/dubbo-samples-shop/deploy/skywalking/Service.yml
b/10-task/dubbo-samples-shop/deploy/skywalking/Service.yml
new file mode 100644
index 00000000..a50e50de
--- /dev/null
+++ b/10-task/dubbo-samples-shop/deploy/skywalking/Service.yml
@@ -0,0 +1,47 @@
+# 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.
+
+apiVersion: v1
+kind: Service
+metadata:
+ name: skywalking-oap-server
+ namespace: dubbo-system
+spec:
+ type: ClusterIP
+ sessionAffinity: None
+ selector:
+ app: skywalking-oap-server
+ ports:
+ - port: 12800
+ name: rest
+ targetPort: 12800
+ - port: 11800
+ name: grpc
+ targetPort: 11800
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: skywalking-oap-dashboard
+ namespace: dubbo-system
+spec:
+ type: ClusterIP
+ sessionAffinity: None
+ selector:
+ app: skywalking-oap-dashboard
+ ports:
+ - port: 8080
+ name: http
+ targetPort: 8080
\ No newline at end of file
diff --git a/10-task/dubbo-samples-shop/deploy/user/Deployment.yml
b/10-task/dubbo-samples-shop/deploy/user/Deployment.yml
new file mode 100644
index 00000000..c2d75d3f
--- /dev/null
+++ b/10-task/dubbo-samples-shop/deploy/user/Deployment.yml
@@ -0,0 +1,64 @@
+# 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.
+
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: shop-user
+ namespace: dubbo-demo
+spec:
+ replicas: 3
+ selector:
+ matchLabels:
+ app: shop-user
+ template:
+ metadata:
+ labels:
+ app: shop-user
+ spec:
+ volumes:
+ - name: skywalking-agent
+ emptyDir: { }
+
+ initContainers:
+ - name: agent-container
+ image: apache/skywalking-java-agent:8.13.0-java17
+ volumeMounts:
+ - name: skywalking-agent
+ mountPath: /agent
+ command: [ "/bin/sh" ]
+ args: [ "-c", "cp -R /skywalking/agent /agent/" ]
+
+ containers:
+ - name: shop-user
+ image: apache/dubbo-demo:dubbo-samples-shop-user_0.0.1
+ imagePullPolicy: Always
+ ports:
+ - name: dubbo
+ containerPort: 20884
+ protocol: TCP
+ - name: dubbo-qos
+ containerPort: 20994
+ protocol: TCP
+ volumeMounts:
+ - name: skywalking-agent
+ mountPath: /skywalking
+ env:
+ - name: JAVA_TOOL_OPTIONS
+ value: "-javaagent:/skywalking/agent/skywalking-agent.jar"
+ - name: SW_AGENT_NAME
+ value: shop::shop-user
+ - name: SW_AGENT_COLLECTOR_BACKEND_SERVICES
+ value: "skywalking-oap-server.dubbo-system.svc:11800"
diff --git a/10-task/dubbo-samples-shop/pom.xml
b/10-task/dubbo-samples-shop/dubbo-samples-shop-detail-api/pom.xml
similarity index 71%
copy from 10-task/dubbo-samples-shop/pom.xml
copy to 10-task/dubbo-samples-shop/dubbo-samples-shop-detail-api/pom.xml
index fa1ff0be..b368e55e 100644
--- a/10-task/dubbo-samples-shop/pom.xml
+++ b/10-task/dubbo-samples-shop/dubbo-samples-shop-detail-api/pom.xml
@@ -18,15 +18,19 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.apache</groupId>
+ <artifactId>apache</artifactId>
+ <version>23</version>
+ <relativePath/>
+ </parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-samples-shop</artifactId>
- <packaging>pom</packaging>
- <version>1.0-SNAPSHOT</version>
-
- <name>Shop Task</name>
- <description>Dubbo Samples Shop Task</description>
+ <groupId>org.apache.dubbo.samples</groupId>
+ <artifactId>dubbo-samples-shop-detail-api</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <name>Dubbo Task - Shop - Detail's API</name>
+ <description>Dubbo Task - Shop - Detail's API</description>
</project>
\ No newline at end of file
diff --git
a/10-task/dubbo-samples-shop/dubbo-samples-shop-detail-api/src/main/java/org/apache/dubbo/samples/DetailService.java
b/10-task/dubbo-samples-shop/dubbo-samples-shop-detail-api/src/main/java/org/apache/dubbo/samples/DetailService.java
new file mode 100644
index 00000000..2b75902d
--- /dev/null
+++
b/10-task/dubbo-samples-shop/dubbo-samples-shop-detail-api/src/main/java/org/apache/dubbo/samples/DetailService.java
@@ -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.
+ */
+package org.apache.dubbo.samples;
+
+public interface DetailService {
+
+ boolean createItem(Item item);
+
+ boolean deductStock(long sku, int count);
+}
diff --git
a/10-task/dubbo-samples-shop/dubbo-samples-shop-detail-api/src/main/java/org/apache/dubbo/samples/Item.java
b/10-task/dubbo-samples-shop/dubbo-samples-shop-detail-api/src/main/java/org/apache/dubbo/samples/Item.java
new file mode 100644
index 00000000..37153842
--- /dev/null
+++
b/10-task/dubbo-samples-shop/dubbo-samples-shop-detail-api/src/main/java/org/apache/dubbo/samples/Item.java
@@ -0,0 +1,58 @@
+/*
+ * 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;
+
+import java.io.Serializable;
+
+public class Item implements Serializable {
+ private long sku;
+ private String itemName;
+ private String description;
+ private int stock;
+
+ public long getSku() {
+ return sku;
+ }
+
+ public void setSku(long sku) {
+ this.sku = sku;
+ }
+
+ public String getItemName() {
+ return itemName;
+ }
+
+ public void setItemName(String itemName) {
+ this.itemName = itemName;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public int getStock() {
+ return stock;
+ }
+
+ public void setStock(int stock) {
+ this.stock = stock;
+ }
+}
diff --git a/10-task/dubbo-samples-shop/dubbo-samples-shop-detail/pom.xml
b/10-task/dubbo-samples-shop/dubbo-samples-shop-detail/pom.xml
new file mode 100644
index 00000000..eed59393
--- /dev/null
+++ b/10-task/dubbo-samples-shop/dubbo-samples-shop-detail/pom.xml
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
https://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-parent</artifactId>
+ <version>3.0.0</version>
+ <relativePath/> <!-- lookup parent from repository -->
+ </parent>
+
+ <groupId>org.apache.dubbo.samples</groupId>
+ <artifactId>dubbo-samples-shop-detail</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+
+ <name>Dubbo Task - Shop - Detail</name>
+ <description>Dubbo Task - Shop - Detail</description>
+
+ <properties>
+ <java.version>17</java.version>
+ <dubbo.version>3.2.0-beta.2</dubbo.version>
+ <nacos.version>2.2.0</nacos.version>
+ </properties>
+
+ <dependencies>
+ <!-- common api -->
+ <dependency>
+ <groupId>org.apache.dubbo.samples</groupId>
+ <artifactId>dubbo-samples-shop-detail-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- registry dependency -->
+ <dependency>
+ <groupId>com.alibaba.nacos</groupId>
+ <artifactId>nacos-client</artifactId>
+ <version>${nacos.version}</version>
+ </dependency>
+
+ <!-- dubbo dependency-->
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-spring-boot-starter</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.graalvm.buildtools</groupId>
+ <artifactId>native-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>com.google.cloud.tools</groupId>
+ <artifactId>jib-maven-plugin</artifactId>
+ <version>3.2.1</version>
+ <configuration>
+ <to>
+
<image>apache/dubbo-demo:dubbo-samples-shop-detail_0.0.1</image>
+ </to>
+ <container>
+ <jvmFlags>
+
<jvmFlag>-Dnacos.address=nacos.dubbo-system.svc</jvmFlag>
+ </jvmFlags>
+ <ports>
+ <port>20885</port>
+ <port>20995</port>
+ </ports>
+ </container>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git
a/10-task/dubbo-samples-shop/dubbo-samples-shop-detail/src/main/java/org/apache/dubbo/samples/detail/DetailApplication.java
b/10-task/dubbo-samples-shop/dubbo-samples-shop-detail/src/main/java/org/apache/dubbo/samples/detail/DetailApplication.java
new file mode 100644
index 00000000..c9fccda3
--- /dev/null
+++
b/10-task/dubbo-samples-shop/dubbo-samples-shop-detail/src/main/java/org/apache/dubbo/samples/detail/DetailApplication.java
@@ -0,0 +1,32 @@
+/*
+ * 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.detail;
+
+import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@EnableDubbo
+@SpringBootApplication
+public class DetailApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(DetailApplication.class, args);
+ }
+
+}
diff --git
a/10-task/dubbo-samples-shop/dubbo-samples-shop-detail/src/main/java/org/apache/dubbo/samples/detail/DetailServiceImpl.java
b/10-task/dubbo-samples-shop/dubbo-samples-shop-detail/src/main/java/org/apache/dubbo/samples/detail/DetailServiceImpl.java
new file mode 100644
index 00000000..caad12bb
--- /dev/null
+++
b/10-task/dubbo-samples-shop/dubbo-samples-shop-detail/src/main/java/org/apache/dubbo/samples/detail/DetailServiceImpl.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.detail;
+
+import org.apache.dubbo.config.annotation.DubboService;
+import org.apache.dubbo.samples.DetailService;
+import org.apache.dubbo.samples.Item;
+
+import java.math.BigInteger;
+import java.util.concurrent.ThreadLocalRandom;
+
+@DubboService
+public class DetailServiceImpl implements DetailService {
+
+ @Override
+ public boolean createItem(Item item) {
+ try {
+ // Do something that consumes resources
+ for (int i = 0; i < 1000; i++) {
+ Math.pow(ThreadLocalRandom.current().nextDouble(10),
ThreadLocalRandom.current().nextDouble(5));
+ }
+ Thread.sleep(ThreadLocalRandom.current().nextInt(100));
+ } catch (InterruptedException ignore) {
+ Thread.currentThread().interrupt();
+ }
+ return true;
+ }
+
+ @Override
+ public boolean deductStock(long sku, int count) {
+ try {
+ // Do something that consumes resources
+ for (int i = 0; i < 500; i++) {
+ Math.pow(ThreadLocalRandom.current().nextDouble(10),
ThreadLocalRandom.current().nextDouble(5));
+ }
+ Thread.sleep(ThreadLocalRandom.current().nextInt(50));
+ } catch (InterruptedException ignore) {
+ Thread.currentThread().interrupt();
+ }
+ return true;
+ }
+}
diff --git
a/10-task/dubbo-samples-shop/dubbo-samples-shop-detail/src/main/resources/application.properties
b/10-task/dubbo-samples-shop/dubbo-samples-shop-detail/src/main/resources/application.properties
new file mode 100644
index 00000000..c64a752d
--- /dev/null
+++
b/10-task/dubbo-samples-shop/dubbo-samples-shop-detail/src/main/resources/application.properties
@@ -0,0 +1,30 @@
+# 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.
+
+# Specify the application name of Dubbo
+dubbo.application.name=shop-detail
+
+# Specify the QoS port
+dubbo.application.qos-port=20995
+
+# Enable token verification for each invocation
+dubbo.provider.token=true
+
+# Specify the registry address
+# dubbo.registry.address=nacos://localhost:8848?username=nacos&password=nacos
+dubbo.registry.address=nacos://${nacos.address:localhost}:8848?username=nacos&password=nacos
+
+# Specify the port of Dubbo protocol
+dubbo.protocol.port=20885
\ No newline at end of file
diff --git a/10-task/dubbo-samples-shop/pom.xml
b/10-task/dubbo-samples-shop/dubbo-samples-shop-frontend-api/pom.xml
similarity index 71%
copy from 10-task/dubbo-samples-shop/pom.xml
copy to 10-task/dubbo-samples-shop/dubbo-samples-shop-frontend-api/pom.xml
index fa1ff0be..801b0466 100644
--- a/10-task/dubbo-samples-shop/pom.xml
+++ b/10-task/dubbo-samples-shop/dubbo-samples-shop-frontend-api/pom.xml
@@ -18,15 +18,19 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.apache</groupId>
+ <artifactId>apache</artifactId>
+ <version>23</version>
+ <relativePath/>
+ </parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-samples-shop</artifactId>
- <packaging>pom</packaging>
- <version>1.0-SNAPSHOT</version>
-
- <name>Shop Task</name>
- <description>Dubbo Samples Shop Task</description>
+ <groupId>org.apache.dubbo.samples</groupId>
+ <artifactId>dubbo-samples-shop-frontend-api</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <name>Dubbo Task - Shop - FrontEnd's API</name>
+ <description>Dubbo Task - Shop - FrontEnd's API</description>
</project>
\ No newline at end of file
diff --git
a/10-task/dubbo-samples-shop/dubbo-samples-shop-frontend-api/src/main/java/org/apache/dubbo/samples/ShopService.java
b/10-task/dubbo-samples-shop/dubbo-samples-shop-frontend-api/src/main/java/org/apache/dubbo/samples/ShopService.java
new file mode 100644
index 00000000..61c7386c
--- /dev/null
+++
b/10-task/dubbo-samples-shop/dubbo-samples-shop-frontend-api/src/main/java/org/apache/dubbo/samples/ShopService.java
@@ -0,0 +1,28 @@
+/*
+ * 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;
+
+public interface ShopService {
+
+ boolean register(String username, String password, String realName, String
mail, String phone);
+
+ boolean login(String username, String password);
+
+ boolean createItem(long sku, String itemName, String description, int
stock);
+
+ boolean submitOrder(long sku, int count, String address, String phone,
String receiver);
+}
diff --git a/10-task/dubbo-samples-shop/dubbo-samples-shop-frontend/pom.xml
b/10-task/dubbo-samples-shop/dubbo-samples-shop-frontend/pom.xml
new file mode 100644
index 00000000..a178d9c2
--- /dev/null
+++ b/10-task/dubbo-samples-shop/dubbo-samples-shop-frontend/pom.xml
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
https://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-parent</artifactId>
+ <version>3.0.0</version>
+ <relativePath/> <!-- lookup parent from repository -->
+ </parent>
+
+ <groupId>org.apache.dubbo.samples</groupId>
+ <artifactId>dubbo-samples-shop-frontend</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+
+ <name>Dubbo Task - Shop - FrontEnd</name>
+ <description>Dubbo Task - Shop - FrontEnd</description>
+
+ <properties>
+ <java.version>17</java.version>
+ <dubbo.version>3.2.0-beta.2</dubbo.version>
+ <nacos.version>2.2.0</nacos.version>
+ </properties>
+
+ <dependencies>
+ <!-- common api -->
+ <dependency>
+ <groupId>org.apache.dubbo.samples</groupId>
+ <artifactId>dubbo-samples-shop-frontend-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo.samples</groupId>
+ <artifactId>dubbo-samples-shop-detail-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo.samples</groupId>
+ <artifactId>dubbo-samples-shop-order-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo.samples</groupId>
+ <artifactId>dubbo-samples-shop-user-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- registry dependency -->
+ <dependency>
+ <groupId>com.alibaba.nacos</groupId>
+ <artifactId>nacos-client</artifactId>
+ <version>${nacos.version}</version>
+ </dependency>
+
+ <!-- dubbo dependency-->
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-spring-boot-starter</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.graalvm.buildtools</groupId>
+ <artifactId>native-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>com.google.cloud.tools</groupId>
+ <artifactId>jib-maven-plugin</artifactId>
+ <version>3.2.1</version>
+ <configuration>
+ <to>
+
<image>apache/dubbo-demo:dubbo-samples-shop-frontend_0.0.1</image>
+ </to>
+ <container>
+ <jvmFlags>
+
<jvmFlag>-Dnacos.address=nacos.dubbo-system.svc</jvmFlag>
+ </jvmFlags>
+ <ports>
+ <port>20881</port>
+ <port>20991</port>
+ </ports>
+ </container>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git
a/10-task/dubbo-samples-shop/dubbo-samples-shop-frontend/src/main/java/org/apache/dubbo/samples/frontend/BenchmarkClient.java
b/10-task/dubbo-samples-shop/dubbo-samples-shop-frontend/src/main/java/org/apache/dubbo/samples/frontend/BenchmarkClient.java
new file mode 100644
index 00000000..f94a51c0
--- /dev/null
+++
b/10-task/dubbo-samples-shop/dubbo-samples-shop-frontend/src/main/java/org/apache/dubbo/samples/frontend/BenchmarkClient.java
@@ -0,0 +1,114 @@
+/*
+ * 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.frontend;
+
+import org.apache.dubbo.config.annotation.DubboReference;
+import org.apache.dubbo.samples.ShopService;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.stereotype.Component;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadLocalRandom;
+
+@Component
+public class BenchmarkClient implements CommandLineRunner {
+ private static final Logger logger =
LoggerFactory.getLogger(BenchmarkClient.class);
+
+ @DubboReference
+ private ShopService shopService;
+
+ @Override
+ public void run(String... args) {
+ ExecutorService executorService = Executors.newCachedThreadPool();
+
+ // Register (5 Concurrent)
+ for (int i = 0; i < 5; i++) {
+ executorService.submit(() -> {
+ while (true) {
+ try {
+ List<String> names = Arrays.asList("John", "Mike",
"Kevin", "Grace", "Mark");
+ String name =
names.get(ThreadLocalRandom.current().nextInt(names.size()));
+
+ List<String> passwords = Arrays.asList("123456",
"654321", "admin", "root", "pwd");
+ String password =
passwords.get(ThreadLocalRandom.current().nextInt(passwords.size()));
+ shopService.register(name, password, name,
"[email protected]", "12345678");
+ } catch (Throwable t) {
+ logger.error("Running Register Bench Failed.", t);
+ }
+ }
+ });
+ }
+ logger.info("Start Register Bench with 5 Concurrent.");
+
+ // Login (10 Concurrent)
+ for (int i = 0; i < 10; i++) {
+ executorService.submit(() -> {
+ while (true) {
+ try {
+ List<String> names = Arrays.asList("John", "Mike",
"Kevin", "Grace", "Mark");
+ String name =
names.get(ThreadLocalRandom.current().nextInt(names.size()));
+
+ List<String> passwords = Arrays.asList("123456",
"654321", "admin", "root", "pwd");
+ String password =
passwords.get(ThreadLocalRandom.current().nextInt(passwords.size()));
+ shopService.login(name, password);
+ } catch (Throwable t) {
+ logger.error("Running Login Bench Failed.", t);
+ }
+ }
+ });
+ }
+ logger.info("Start Login Bench with 5 Concurrent.");
+
+ // CreateItem (5 Concurrent)
+ for (int i = 0; i < 5; i++) {
+ executorService.submit(() -> {
+ while (true) {
+ try {
+ long sku = ThreadLocalRandom.current().nextLong();
+ shopService.createItem(sku, "Test Item", "Desc", 100);
+ } catch (Throwable t) {
+ logger.error("Running CreateItem Bench Failed.", t);
+ }
+ }
+ });
+ }
+ logger.info("Start CreateItem Bench with 5 Concurrent.");
+
+ // SubmitOrder (50 Concurrent)
+ for (int i = 0; i < 5; i++) {
+ executorService.submit(() -> {
+ while (true) {
+ try {
+ long sku = ThreadLocalRandom.current().nextLong();
+ shopService.submitOrder(sku, 50, "Test Item", "Desc",
"Mike");
+ } catch (Throwable t) {
+ logger.error("Running SubmitOrder Bench Failed.", t);
+ }
+ }
+ });
+ }
+ logger.info("Start SubmitOrder Bench with 5 Concurrent.");
+
+ logger.info("All Bench Client started.");
+ }
+}
diff --git
a/10-task/dubbo-samples-shop/dubbo-samples-shop-frontend/src/main/java/org/apache/dubbo/samples/frontend/FrontEndApplication.java
b/10-task/dubbo-samples-shop/dubbo-samples-shop-frontend/src/main/java/org/apache/dubbo/samples/frontend/FrontEndApplication.java
new file mode 100644
index 00000000..f6e80ec8
--- /dev/null
+++
b/10-task/dubbo-samples-shop/dubbo-samples-shop-frontend/src/main/java/org/apache/dubbo/samples/frontend/FrontEndApplication.java
@@ -0,0 +1,32 @@
+/*
+ * 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.frontend;
+
+import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@EnableDubbo
+@SpringBootApplication
+public class FrontEndApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(FrontEndApplication.class, args);
+ }
+
+}
diff --git
a/10-task/dubbo-samples-shop/dubbo-samples-shop-frontend/src/main/java/org/apache/dubbo/samples/frontend/ShopServiceImpl.java
b/10-task/dubbo-samples-shop/dubbo-samples-shop-frontend/src/main/java/org/apache/dubbo/samples/frontend/ShopServiceImpl.java
new file mode 100644
index 00000000..b13f47b8
--- /dev/null
+++
b/10-task/dubbo-samples-shop/dubbo-samples-shop-frontend/src/main/java/org/apache/dubbo/samples/frontend/ShopServiceImpl.java
@@ -0,0 +1,76 @@
+/*
+ * 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.frontend;
+
+import org.apache.dubbo.config.annotation.DubboReference;
+import org.apache.dubbo.config.annotation.DubboService;
+import org.apache.dubbo.samples.DetailService;
+import org.apache.dubbo.samples.Item;
+import org.apache.dubbo.samples.Order;
+import org.apache.dubbo.samples.OrderService;
+import org.apache.dubbo.samples.ShopService;
+import org.apache.dubbo.samples.User;
+import org.apache.dubbo.samples.UserService;
+
+@DubboService
+public class ShopServiceImpl implements ShopService {
+ @DubboReference
+ private UserService userService;
+
+ @DubboReference
+ private OrderService orderService;
+
+ @DubboReference
+ private DetailService detailService;
+
+ @Override
+ public boolean register(String username, String password, String realName,
String mail, String phone) {
+ User user = new User();
+ user.setUsername(username);
+ user.setPassword(password);
+ user.setRealName(realName);
+ user.setMail(mail);
+ user.setPhone(phone);
+ return userService.register(user);
+ }
+
+ @Override
+ public boolean login(String username, String password) {
+ return userService.login(username, password) != null;
+ }
+
+ @Override
+ public boolean createItem(long sku, String itemName, String description,
int stock) {
+ Item item = new Item();
+ item.setSku(sku);
+ item.setItemName(itemName);
+ item.setDescription(description);
+ item.setStock(stock);
+ return detailService.createItem(item);
+ }
+
+ @Override
+ public boolean submitOrder(long sku, int count, String address, String
phone, String receiver) {
+ Order order = new Order();
+ order.setSku(sku);
+ order.setCount(count);
+ order.setAddress(address);
+ order.setPhone(phone);
+ order.setReceiver(receiver);
+ return orderService.submitOrder(order);
+ }
+}
diff --git
a/10-task/dubbo-samples-shop/dubbo-samples-shop-frontend/src/main/resources/application.properties
b/10-task/dubbo-samples-shop/dubbo-samples-shop-frontend/src/main/resources/application.properties
new file mode 100644
index 00000000..e27205be
--- /dev/null
+++
b/10-task/dubbo-samples-shop/dubbo-samples-shop-frontend/src/main/resources/application.properties
@@ -0,0 +1,30 @@
+# 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.
+
+# Specify the application name of Dubbo
+dubbo.application.name=shop-frontend
+
+# Specify the QoS port
+dubbo.application.qos-port=20991
+
+# Enable token verification for each invocation
+dubbo.provider.token=true
+
+# Specify the registry address
+# dubbo.registry.address=nacos://localhost:8848?username=nacos&password=nacos
+dubbo.registry.address=nacos://${nacos.address:localhost}:8848?username=nacos&password=nacos
+
+# Specify the port of Dubbo protocol
+dubbo.protocol.port=20881
\ No newline at end of file
diff --git a/10-task/dubbo-samples-shop/pom.xml
b/10-task/dubbo-samples-shop/dubbo-samples-shop-order-api/pom.xml
similarity index 72%
copy from 10-task/dubbo-samples-shop/pom.xml
copy to 10-task/dubbo-samples-shop/dubbo-samples-shop-order-api/pom.xml
index fa1ff0be..0cba03e0 100644
--- a/10-task/dubbo-samples-shop/pom.xml
+++ b/10-task/dubbo-samples-shop/dubbo-samples-shop-order-api/pom.xml
@@ -18,15 +18,19 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.apache</groupId>
+ <artifactId>apache</artifactId>
+ <version>23</version>
+ <relativePath/>
+ </parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-samples-shop</artifactId>
- <packaging>pom</packaging>
- <version>1.0-SNAPSHOT</version>
-
- <name>Shop Task</name>
- <description>Dubbo Samples Shop Task</description>
+ <groupId>org.apache.dubbo.samples</groupId>
+ <artifactId>dubbo-samples-shop-order-api</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <name>Dubbo Task - Shop - Order's API</name>
+ <description>Dubbo Task - Shop - Order's API</description>
</project>
\ No newline at end of file
diff --git
a/10-task/dubbo-samples-shop/dubbo-samples-shop-order-api/src/main/java/org/apache/dubbo/samples/Order.java
b/10-task/dubbo-samples-shop/dubbo-samples-shop-order-api/src/main/java/org/apache/dubbo/samples/Order.java
new file mode 100644
index 00000000..0dd43989
--- /dev/null
+++
b/10-task/dubbo-samples-shop/dubbo-samples-shop-order-api/src/main/java/org/apache/dubbo/samples/Order.java
@@ -0,0 +1,68 @@
+/*
+ * 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;
+
+import java.io.Serializable;
+
+public class Order implements Serializable {
+ private long sku;
+ private int count;
+
+ private String address;
+ private String phone;
+ private String receiver;
+
+ public long getSku() {
+ return sku;
+ }
+
+ public void setSku(long sku) {
+ this.sku = sku;
+ }
+
+ public int getCount() {
+ return count;
+ }
+
+ public void setCount(int count) {
+ this.count = count;
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public String getPhone() {
+ return phone;
+ }
+
+ public void setPhone(String phone) {
+ this.phone = phone;
+ }
+
+ public String getReceiver() {
+ return receiver;
+ }
+
+ public void setReceiver(String receiver) {
+ this.receiver = receiver;
+ }
+}
diff --git
a/10-task/dubbo-samples-shop/dubbo-samples-shop-order-api/src/main/java/org/apache/dubbo/samples/OrderService.java
b/10-task/dubbo-samples-shop/dubbo-samples-shop-order-api/src/main/java/org/apache/dubbo/samples/OrderService.java
new file mode 100644
index 00000000..f1a6eb91
--- /dev/null
+++
b/10-task/dubbo-samples-shop/dubbo-samples-shop-order-api/src/main/java/org/apache/dubbo/samples/OrderService.java
@@ -0,0 +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;
+
+public interface OrderService {
+
+ boolean submitOrder(Order order);
+}
diff --git a/10-task/dubbo-samples-shop/dubbo-samples-shop-order-v1/pom.xml
b/10-task/dubbo-samples-shop/dubbo-samples-shop-order-v1/pom.xml
new file mode 100644
index 00000000..fec0f5a7
--- /dev/null
+++ b/10-task/dubbo-samples-shop/dubbo-samples-shop-order-v1/pom.xml
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
https://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-parent</artifactId>
+ <version>3.0.0</version>
+ <relativePath/> <!-- lookup parent from repository -->
+ </parent>
+
+ <groupId>org.apache.dubbo.samples</groupId>
+ <artifactId>dubbo-samples-shop-order-v1</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+
+ <name>Dubbo Task - Shop - Order V1</name>
+ <description>Dubbo Task - Shop - Order - Version 1</description>
+
+ <properties>
+ <java.version>17</java.version>
+ <dubbo.version>3.2.0-beta.2</dubbo.version>
+ <nacos.version>2.2.0</nacos.version>
+ </properties>
+
+ <dependencies>
+ <!-- common api -->
+ <dependency>
+ <groupId>org.apache.dubbo.samples</groupId>
+ <artifactId>dubbo-samples-shop-order-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- registry dependency -->
+ <dependency>
+ <groupId>com.alibaba.nacos</groupId>
+ <artifactId>nacos-client</artifactId>
+ <version>${nacos.version}</version>
+ </dependency>
+
+ <!-- dubbo dependency-->
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-spring-boot-starter</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.graalvm.buildtools</groupId>
+ <artifactId>native-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>com.google.cloud.tools</groupId>
+ <artifactId>jib-maven-plugin</artifactId>
+ <version>3.2.1</version>
+ <configuration>
+ <to>
+
<image>apache/dubbo-demo:dubbo-samples-shop-order_v1_0.0.1</image>
+ </to>
+ <container>
+ <jvmFlags>
+
<jvmFlag>-Dnacos.address=nacos.dubbo-system.svc</jvmFlag>
+ </jvmFlags>
+ <ports>
+ <port>20882</port>
+ <port>20992</port>
+ </ports>
+ </container>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git
a/10-task/dubbo-samples-shop/dubbo-samples-shop-order-v1/src/main/java/org/apache/dubbo/samples/order/OrderApplicationV1.java
b/10-task/dubbo-samples-shop/dubbo-samples-shop-order-v1/src/main/java/org/apache/dubbo/samples/order/OrderApplicationV1.java
new file mode 100644
index 00000000..1628e734
--- /dev/null
+++
b/10-task/dubbo-samples-shop/dubbo-samples-shop-order-v1/src/main/java/org/apache/dubbo/samples/order/OrderApplicationV1.java
@@ -0,0 +1,32 @@
+/*
+ * 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.order;
+
+import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@EnableDubbo
+@SpringBootApplication
+public class OrderApplicationV1 {
+
+ public static void main(String[] args) {
+ SpringApplication.run(OrderApplicationV1.class, args);
+ }
+
+}
diff --git
a/10-task/dubbo-samples-shop/dubbo-samples-shop-order-v1/src/main/java/org/apache/dubbo/samples/order/OrderServiceImpl.java
b/10-task/dubbo-samples-shop/dubbo-samples-shop-order-v1/src/main/java/org/apache/dubbo/samples/order/OrderServiceImpl.java
new file mode 100644
index 00000000..b363fe8c
--- /dev/null
+++
b/10-task/dubbo-samples-shop/dubbo-samples-shop-order-v1/src/main/java/org/apache/dubbo/samples/order/OrderServiceImpl.java
@@ -0,0 +1,40 @@
+/*
+ * 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.order;
+
+import org.apache.dubbo.config.annotation.DubboService;
+import org.apache.dubbo.samples.Order;
+import org.apache.dubbo.samples.OrderService;
+
+import java.util.concurrent.ThreadLocalRandom;
+
+@DubboService
+public class OrderServiceImpl implements OrderService {
+ @Override
+ public boolean submitOrder(Order order) {
+ try {
+ // Do something that consumes resources
+ for (int i = 0; i < 1000; i++) {
+ Math.pow(ThreadLocalRandom.current().nextDouble(10),
ThreadLocalRandom.current().nextDouble(5));
+ }
+ Thread.sleep(ThreadLocalRandom.current().nextInt(200));
+ } catch (InterruptedException ignore) {
+ Thread.currentThread().interrupt();
+ }
+ return true;
+ }
+}
diff --git
a/10-task/dubbo-samples-shop/dubbo-samples-shop-order-v1/src/main/resources/application.properties
b/10-task/dubbo-samples-shop/dubbo-samples-shop-order-v1/src/main/resources/application.properties
new file mode 100644
index 00000000..693c5176
--- /dev/null
+++
b/10-task/dubbo-samples-shop/dubbo-samples-shop-order-v1/src/main/resources/application.properties
@@ -0,0 +1,30 @@
+# 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.
+
+# Specify the application name of Dubbo
+dubbo.application.name=shop-order
+
+# Specify the QoS port
+dubbo.application.qos-port=20992
+
+# Enable token verification for each invocation
+dubbo.provider.token=true
+
+# Specify the registry address
+# dubbo.registry.address=nacos://localhost:8848?username=nacos&password=nacos
+dubbo.registry.address=nacos://${nacos.address:localhost}:8848?username=nacos&password=nacos
+
+# Specify the port of Dubbo protocol
+dubbo.protocol.port=20882
\ No newline at end of file
diff --git a/10-task/dubbo-samples-shop/dubbo-samples-shop-order-v2/pom.xml
b/10-task/dubbo-samples-shop/dubbo-samples-shop-order-v2/pom.xml
new file mode 100644
index 00000000..19b6b1fb
--- /dev/null
+++ b/10-task/dubbo-samples-shop/dubbo-samples-shop-order-v2/pom.xml
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
https://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-parent</artifactId>
+ <version>3.0.0</version>
+ <relativePath/> <!-- lookup parent from repository -->
+ </parent>
+
+ <groupId>org.apache.dubbo.samples</groupId>
+ <artifactId>dubbo-samples-shop-order-v2</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+
+ <name>Dubbo Task - Shop - Order V2</name>
+ <description>Dubbo Task - Shop - Order - Version 2</description>
+
+ <properties>
+ <java.version>17</java.version>
+ <dubbo.version>3.2.0-beta.2</dubbo.version>
+ <nacos.version>2.2.0</nacos.version>
+ </properties>
+
+ <dependencies>
+ <!-- common api -->
+ <dependency>
+ <groupId>org.apache.dubbo.samples</groupId>
+ <artifactId>dubbo-samples-shop-order-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo.samples</groupId>
+ <artifactId>dubbo-samples-shop-detail-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- registry dependency -->
+ <dependency>
+ <groupId>com.alibaba.nacos</groupId>
+ <artifactId>nacos-client</artifactId>
+ <version>${nacos.version}</version>
+ </dependency>
+
+ <!-- dubbo dependency-->
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-spring-boot-starter</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.graalvm.buildtools</groupId>
+ <artifactId>native-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>com.google.cloud.tools</groupId>
+ <artifactId>jib-maven-plugin</artifactId>
+ <version>3.2.1</version>
+ <configuration>
+ <to>
+
<image>apache/dubbo-demo:dubbo-samples-shop-order_v2_0.0.1</image>
+ </to>
+ <container>
+ <jvmFlags>
+
<jvmFlag>-Dnacos.address=nacos.dubbo-system.svc</jvmFlag>
+ </jvmFlags>
+ <ports>
+ <port>20883</port>
+ <port>20993</port>
+ </ports>
+ </container>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git
a/10-task/dubbo-samples-shop/dubbo-samples-shop-order-v2/src/main/java/org/apache/dubbo/samples/order/OrderApplicationV2.java
b/10-task/dubbo-samples-shop/dubbo-samples-shop-order-v2/src/main/java/org/apache/dubbo/samples/order/OrderApplicationV2.java
new file mode 100644
index 00000000..3e3c273e
--- /dev/null
+++
b/10-task/dubbo-samples-shop/dubbo-samples-shop-order-v2/src/main/java/org/apache/dubbo/samples/order/OrderApplicationV2.java
@@ -0,0 +1,32 @@
+/*
+ * 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.order;
+
+import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@EnableDubbo
+@SpringBootApplication
+public class OrderApplicationV2 {
+
+ public static void main(String[] args) {
+ SpringApplication.run(OrderApplicationV2.class, args);
+ }
+
+}
diff --git
a/10-task/dubbo-samples-shop/dubbo-samples-shop-order-v2/src/main/java/org/apache/dubbo/samples/order/OrderServiceImpl.java
b/10-task/dubbo-samples-shop/dubbo-samples-shop-order-v2/src/main/java/org/apache/dubbo/samples/order/OrderServiceImpl.java
new file mode 100644
index 00000000..24ca75a8
--- /dev/null
+++
b/10-task/dubbo-samples-shop/dubbo-samples-shop-order-v2/src/main/java/org/apache/dubbo/samples/order/OrderServiceImpl.java
@@ -0,0 +1,45 @@
+/*
+ * 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.order;
+
+import org.apache.dubbo.config.annotation.DubboReference;
+import org.apache.dubbo.config.annotation.DubboService;
+import org.apache.dubbo.samples.DetailService;
+import org.apache.dubbo.samples.Order;
+import org.apache.dubbo.samples.OrderService;
+
+import java.util.concurrent.ThreadLocalRandom;
+
+@DubboService
+public class OrderServiceImpl implements OrderService {
+ @DubboReference
+ private DetailService detailService;
+
+ @Override
+ public boolean submitOrder(Order order) {
+ try {
+ // Do something that consumes resources
+ for (int i = 0; i < 1000; i++) {
+ Math.pow(ThreadLocalRandom.current().nextDouble(10),
ThreadLocalRandom.current().nextDouble(5));
+ }
+ Thread.sleep(ThreadLocalRandom.current().nextInt(200));
+ } catch (InterruptedException ignore) {
+ Thread.currentThread().interrupt();
+ }
+ return detailService.deductStock(order.getSku(), order.getCount());
+ }
+}
diff --git
a/10-task/dubbo-samples-shop/dubbo-samples-shop-order-v2/src/main/resources/application.properties
b/10-task/dubbo-samples-shop/dubbo-samples-shop-order-v2/src/main/resources/application.properties
new file mode 100644
index 00000000..0988c9a8
--- /dev/null
+++
b/10-task/dubbo-samples-shop/dubbo-samples-shop-order-v2/src/main/resources/application.properties
@@ -0,0 +1,30 @@
+# 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.
+
+# Specify the application name of Dubbo
+dubbo.application.name=shop-order
+
+# Specify the QoS port
+dubbo.application.qos-port=20993
+
+# Enable token verification for each invocation
+dubbo.provider.token=true
+
+# Specify the registry address
+# dubbo.registry.address=nacos://localhost:8848?username=nacos&password=nacos
+dubbo.registry.address=nacos://${nacos.address:localhost}:8848?username=nacos&password=nacos
+
+# Specify the port of Dubbo protocol
+dubbo.protocol.port=20883
\ No newline at end of file
diff --git a/10-task/dubbo-samples-shop/pom.xml
b/10-task/dubbo-samples-shop/dubbo-samples-shop-user-api/pom.xml
similarity index 72%
copy from 10-task/dubbo-samples-shop/pom.xml
copy to 10-task/dubbo-samples-shop/dubbo-samples-shop-user-api/pom.xml
index fa1ff0be..feffe902 100644
--- a/10-task/dubbo-samples-shop/pom.xml
+++ b/10-task/dubbo-samples-shop/dubbo-samples-shop-user-api/pom.xml
@@ -18,15 +18,19 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.apache</groupId>
+ <artifactId>apache</artifactId>
+ <version>23</version>
+ <relativePath/>
+ </parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-samples-shop</artifactId>
- <packaging>pom</packaging>
- <version>1.0-SNAPSHOT</version>
-
- <name>Shop Task</name>
- <description>Dubbo Samples Shop Task</description>
+ <groupId>org.apache.dubbo.samples</groupId>
+ <artifactId>dubbo-samples-shop-user-api</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <name>Dubbo Task - Shop - User's API</name>
+ <description>Dubbo Task - Shop - User's API</description>
</project>
\ No newline at end of file
diff --git
a/10-task/dubbo-samples-shop/dubbo-samples-shop-user-api/src/main/java/org/apache/dubbo/samples/User.java
b/10-task/dubbo-samples-shop/dubbo-samples-shop-user-api/src/main/java/org/apache/dubbo/samples/User.java
new file mode 100644
index 00000000..500c84f3
--- /dev/null
+++
b/10-task/dubbo-samples-shop/dubbo-samples-shop-user-api/src/main/java/org/apache/dubbo/samples/User.java
@@ -0,0 +1,67 @@
+/*
+ * 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;
+
+import java.io.Serializable;
+
+public class User implements Serializable {
+ private String username;
+ private String password;
+ private String realName;
+ private String mail;
+ private String phone;
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public String getRealName() {
+ return realName;
+ }
+
+ public void setRealName(String realName) {
+ this.realName = realName;
+ }
+
+ public String getMail() {
+ return mail;
+ }
+
+ public void setMail(String mail) {
+ this.mail = mail;
+ }
+
+ public String getPhone() {
+ return phone;
+ }
+
+ public void setPhone(String phone) {
+ this.phone = phone;
+ }
+}
diff --git
a/10-task/dubbo-samples-shop/dubbo-samples-shop-user-api/src/main/java/org/apache/dubbo/samples/UserService.java
b/10-task/dubbo-samples-shop/dubbo-samples-shop-user-api/src/main/java/org/apache/dubbo/samples/UserService.java
new file mode 100644
index 00000000..489e6e44
--- /dev/null
+++
b/10-task/dubbo-samples-shop/dubbo-samples-shop-user-api/src/main/java/org/apache/dubbo/samples/UserService.java
@@ -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.
+ */
+package org.apache.dubbo.samples;
+
+public interface UserService {
+
+ boolean register(User user);
+
+ User login(String username, String password);
+}
diff --git a/10-task/dubbo-samples-shop/dubbo-samples-shop-user/pom.xml
b/10-task/dubbo-samples-shop/dubbo-samples-shop-user/pom.xml
new file mode 100644
index 00000000..18737450
--- /dev/null
+++ b/10-task/dubbo-samples-shop/dubbo-samples-shop-user/pom.xml
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
https://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-parent</artifactId>
+ <version>3.0.0</version>
+ <relativePath/> <!-- lookup parent from repository -->
+ </parent>
+
+ <groupId>org.apache.dubbo.samples</groupId>
+ <artifactId>dubbo-samples-shop-user</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+
+ <name>Dubbo Task - Shop - User</name>
+ <description>Dubbo Task - Shop - User</description>
+
+ <properties>
+ <java.version>17</java.version>
+ <dubbo.version>3.2.0-beta.2</dubbo.version>
+ <nacos.version>2.2.0</nacos.version>
+ </properties>
+
+ <dependencies>
+ <!-- common api -->
+ <dependency>
+ <groupId>org.apache.dubbo.samples</groupId>
+ <artifactId>dubbo-samples-shop-user-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- registry dependency -->
+ <dependency>
+ <groupId>com.alibaba.nacos</groupId>
+ <artifactId>nacos-client</artifactId>
+ <version>${nacos.version}</version>
+ </dependency>
+
+ <!-- dubbo dependency-->
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-spring-boot-starter</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.graalvm.buildtools</groupId>
+ <artifactId>native-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>com.google.cloud.tools</groupId>
+ <artifactId>jib-maven-plugin</artifactId>
+ <version>3.2.1</version>
+ <configuration>
+ <to>
+
<image>apache/dubbo-demo:dubbo-samples-shop-user_0.0.1</image>
+ </to>
+ <container>
+ <jvmFlags>
+
<jvmFlag>-Dnacos.address=nacos.dubbo-system.svc</jvmFlag>
+ </jvmFlags>
+ <ports>
+ <port>20884</port>
+ <port>20994</port>
+ </ports>
+ </container>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git
a/10-task/dubbo-samples-shop/dubbo-samples-shop-user/src/main/java/org/apache/dubbo/samples/user/UserApplication.java
b/10-task/dubbo-samples-shop/dubbo-samples-shop-user/src/main/java/org/apache/dubbo/samples/user/UserApplication.java
new file mode 100644
index 00000000..36c34e71
--- /dev/null
+++
b/10-task/dubbo-samples-shop/dubbo-samples-shop-user/src/main/java/org/apache/dubbo/samples/user/UserApplication.java
@@ -0,0 +1,32 @@
+/*
+ * 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.user;
+
+import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@EnableDubbo
+@SpringBootApplication
+public class UserApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(UserApplication.class, args);
+ }
+
+}
diff --git
a/10-task/dubbo-samples-shop/dubbo-samples-shop-user/src/main/java/org/apache/dubbo/samples/user/UserServiceImpl.java
b/10-task/dubbo-samples-shop/dubbo-samples-shop-user/src/main/java/org/apache/dubbo/samples/user/UserServiceImpl.java
new file mode 100644
index 00000000..9ff8c4e1
--- /dev/null
+++
b/10-task/dubbo-samples-shop/dubbo-samples-shop-user/src/main/java/org/apache/dubbo/samples/user/UserServiceImpl.java
@@ -0,0 +1,60 @@
+/*
+ * 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.user;
+
+import org.apache.dubbo.config.annotation.DubboService;
+import org.apache.dubbo.samples.User;
+import org.apache.dubbo.samples.UserService;
+
+import java.util.concurrent.ThreadLocalRandom;
+
+@DubboService
+public class UserServiceImpl implements UserService {
+ @Override
+ public boolean register(User user) {
+ try {
+ // Do something that consumes resources
+ for (int i = 0; i < 1000; i++) {
+ Math.pow(ThreadLocalRandom.current().nextDouble(10),
ThreadLocalRandom.current().nextDouble(5));
+ }
+ Thread.sleep(ThreadLocalRandom.current().nextInt(100));
+ } catch (InterruptedException ignore) {
+ Thread.currentThread().interrupt();
+ }
+ return true;
+ }
+
+ @Override
+ public User login(String username, String password) {
+ try {
+ // Do something that consumes resources
+ for (int i = 0; i < 200; i++) {
+ Math.pow(ThreadLocalRandom.current().nextDouble(10),
ThreadLocalRandom.current().nextDouble(5));
+ }
+ Thread.sleep(ThreadLocalRandom.current().nextInt(50));
+ } catch (InterruptedException ignore) {
+ Thread.currentThread().interrupt();
+ }
+ User user = new User();
+ user.setUsername(username);
+ user.setPassword(password);
+ user.setPhone("13912345678");
+ user.setMail("[email protected]");
+ user.setRealName("Dubbo Test");
+ return user;
+ }
+}
diff --git
a/10-task/dubbo-samples-shop/dubbo-samples-shop-user/src/main/resources/application.properties
b/10-task/dubbo-samples-shop/dubbo-samples-shop-user/src/main/resources/application.properties
new file mode 100644
index 00000000..5974fbd7
--- /dev/null
+++
b/10-task/dubbo-samples-shop/dubbo-samples-shop-user/src/main/resources/application.properties
@@ -0,0 +1,30 @@
+# 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.
+
+# Specify the application name of Dubbo
+dubbo.application.name=shop-user
+
+# Specify the QoS port
+dubbo.application.qos-port=20994
+
+# Enable token verification for each invocation
+dubbo.provider.token=true
+
+# Specify the registry address
+# dubbo.registry.address=nacos://localhost:8848?username=nacos&password=nacos
+dubbo.registry.address=nacos://${nacos.address:localhost}:8848?username=nacos&password=nacos
+
+# Specify the port of Dubbo protocol
+dubbo.protocol.port=20884
\ No newline at end of file
diff --git a/10-task/dubbo-samples-shop/pom.xml
b/10-task/dubbo-samples-shop/pom.xml
index fa1ff0be..e03045bd 100644
--- a/10-task/dubbo-samples-shop/pom.xml
+++ b/10-task/dubbo-samples-shop/pom.xml
@@ -25,8 +25,18 @@
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
- <name>Shop Task</name>
- <description>Dubbo Samples Shop Task</description>
-
+ <name>RPC Task - Shop</name>
+ <description>Dubbo Samples RPC Task - Shop</description>
+ <modules>
+ <module>dubbo-samples-shop-detail</module>
+ <module>dubbo-samples-shop-detail-api</module>
+ <module>dubbo-samples-shop-frontend</module>
+ <module>dubbo-samples-shop-frontend-api</module>
+ <module>dubbo-samples-shop-order-v1</module>
+ <module>dubbo-samples-shop-order-v2</module>
+ <module>dubbo-samples-shop-order-api</module>
+ <module>dubbo-samples-shop-user</module>
+ <module>dubbo-samples-shop-user-api</module>
+ </modules>
</project>
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]