diff --git a/spring-cloud-alibaba-examples/pom.xml b/spring-cloud-alibaba-examples/pom.xml
index e2c2fc14b..dedc52d43 100644
--- a/spring-cloud-alibaba-examples/pom.xml
+++ b/spring-cloud-alibaba-examples/pom.xml
@@ -32,8 +32,7 @@
seata-example/business-service
seata-example/order-service
seata-example/seata-server
- seata-example/storage-service-api
- seata-example/storage-service-provider
+ seata-example/storage-service
seata-example/account-service
rocketmq-example/rocketmq-consume-example
rocketmq-example/rocketmq-produce-example
diff --git a/spring-cloud-alibaba-examples/seata-example/account-service/src/main/resources/application.yml b/spring-cloud-alibaba-examples/seata-example/account-service/src/main/resources/application.yml
index af7932cd6..d5715769d 100644
--- a/spring-cloud-alibaba-examples/seata-example/account-service/src/main/resources/application.yml
+++ b/spring-cloud-alibaba-examples/seata-example/account-service/src/main/resources/application.yml
@@ -56,8 +56,3 @@ seata:
namespace: a3f588d3-7be9-43d3-af7c-1e7919cf8af6
username: "nacos"
password: "nacos"
-dubbo:
- registry:
- address: spring-cloud://localhost
- cloud:
- subscribed-services:
diff --git a/spring-cloud-alibaba-examples/seata-example/business-service/pom.xml b/spring-cloud-alibaba-examples/seata-example/business-service/pom.xml
index 50a189b2a..066bd8c2f 100644
--- a/spring-cloud-alibaba-examples/seata-example/business-service/pom.xml
+++ b/spring-cloud-alibaba-examples/seata-example/business-service/pom.xml
@@ -14,11 +14,6 @@
jar
-
-
- com.alibaba.cloud
- spring-cloud-starter-dubbo
-
com.alibaba.cloud
spring-cloud-starter-alibaba-seata
@@ -55,12 +50,5 @@
org.springframework
spring-tx
-
- com.alibaba.cloud
- storage-service-api
- 2.2.8-SNAPSHOT
- compile
-
-
diff --git a/spring-cloud-alibaba-examples/seata-example/business-service/src/main/java/com/alibaba/cloud/examples/BusinessApplication.java b/spring-cloud-alibaba-examples/seata-example/business-service/src/main/java/com/alibaba/cloud/examples/BusinessApplication.java
index bdabf5042..e708c009f 100644
--- a/spring-cloud-alibaba-examples/seata-example/business-service/src/main/java/com/alibaba/cloud/examples/BusinessApplication.java
+++ b/spring-cloud-alibaba-examples/seata-example/business-service/src/main/java/com/alibaba/cloud/examples/BusinessApplication.java
@@ -33,7 +33,7 @@ import org.springframework.web.client.RestTemplate;
*/
@SpringBootApplication
@EnableFeignClients
-@EnableDiscoveryClient(autoRegister = true)
+@EnableDiscoveryClient(autoRegister = false)
public class BusinessApplication {
public static void main(String[] args) {
diff --git a/spring-cloud-alibaba-examples/seata-example/business-service/src/main/java/com/alibaba/cloud/examples/HomeController.java b/spring-cloud-alibaba-examples/seata-example/business-service/src/main/java/com/alibaba/cloud/examples/HomeController.java
index 6d0a7e9c6..ec93cd4d4 100644
--- a/spring-cloud-alibaba-examples/seata-example/business-service/src/main/java/com/alibaba/cloud/examples/HomeController.java
+++ b/spring-cloud-alibaba-examples/seata-example/business-service/src/main/java/com/alibaba/cloud/examples/HomeController.java
@@ -18,9 +18,7 @@ package com.alibaba.cloud.examples;
import com.alibaba.cloud.examples.BusinessApplication.OrderService;
import com.alibaba.cloud.examples.BusinessApplication.StorageService;
-import com.alibaba.cloud.examples.api.StorageDubboService;
import io.seata.spring.annotation.GlobalTransactional;
-import org.apache.dubbo.config.annotation.DubboReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -58,9 +56,6 @@ public class HomeController {
private final StorageService storageService;
- @DubboReference
- private StorageDubboService storageDubboService;
-
public HomeController(RestTemplate restTemplate, OrderService orderService,
StorageService storageService) {
this.restTemplate = restTemplate;
@@ -127,24 +122,4 @@ public class HomeController {
}
- @GlobalTransactional(timeoutMills = 300000, name = "spring-cloud-demo-tx")
- @GetMapping(value = "/seata/dubbo", produces = "application/json")
- public String dubbo() {
-
- String result = storageDubboService.updateStorage(COMMODITY_CODE, ORDER_COUNT);
-
- if (!SUCCESS.equals(result)) {
- throw new RuntimeException();
- }
-
- result = orderService.order(USER_ID, COMMODITY_CODE, ORDER_COUNT);
-
- if (!SUCCESS.equals(result)) {
- throw new RuntimeException();
- }
-
- return SUCCESS;
-
- }
-
}
diff --git a/spring-cloud-alibaba-examples/seata-example/business-service/src/main/resources/application.yml b/spring-cloud-alibaba-examples/seata-example/business-service/src/main/resources/application.yml
index cc8617b6d..b87b06e9c 100644
--- a/spring-cloud-alibaba-examples/seata-example/business-service/src/main/resources/application.yml
+++ b/spring-cloud-alibaba-examples/seata-example/business-service/src/main/resources/application.yml
@@ -35,22 +35,13 @@ seata:
namespace: a3f588d3-7be9-43d3-af7c-1e7919cf8af6
username: "nacos"
password: "nacos"
-dubbo:
- registry:
- address: spring-cloud://localhost
- protocol:
- name: dubbo
- port: -1
- provider:
- telnet: ls,ps,cd,pwd,trace,count,invoke,select,status,log,help,clear,exit,shutdown
- cloud:
- subscribed-services: storage-service
+
feign:
client:
config:
default:
- connectTimeout:10000
- readTimeout:10000
+ connectTimeout: 10000
+ readTimeout: 10000
logging:
level:
io:
diff --git a/spring-cloud-alibaba-examples/seata-example/readme-zh.md b/spring-cloud-alibaba-examples/seata-example/readme-zh.md
index ba4007d86..217fcae33 100644
--- a/spring-cloud-alibaba-examples/seata-example/readme-zh.md
+++ b/spring-cloud-alibaba-examples/seata-example/readme-zh.md
@@ -202,14 +202,13 @@ sh seata-server.sh -p 8091 -m file
分别运行 `account-server`、`order-service`、`storage-service` 和 `business-service` 这三个应用的 Main 函数,启动示例。
-启动示例后,通过 HTTP 的 GET 方法访问如下 URL,可以分别验证在 `business-service` 中 通过 RestTemplate 和 FeignClient 及Dubbo调用其他服务的场景。
+启动示例后,通过 HTTP 的 GET 方法访问如下 URL,可以分别验证在 `business-service` 中 通过 RestTemplate 和 FeignClient 调用其他服务的场景。
```$xslt
http://127.0.0.1:18081/seata/feign
http://127.0.0.1:18081/seata/rest
-http://127.0.0.1:18081/seata/dubbo
```
## 如何验证分布式事务成功?
diff --git a/spring-cloud-alibaba-examples/seata-example/storage-service-api/pom.xml b/spring-cloud-alibaba-examples/seata-example/storage-service-api/pom.xml
deleted file mode 100644
index d11f0c2d1..000000000
--- a/spring-cloud-alibaba-examples/seata-example/storage-service-api/pom.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
- spring-cloud-alibaba-examples
- com.alibaba.cloud
- ${revision}
- ../../pom.xml
-
- 4.0.0
-
- com.alibaba.cloud
- storage-service-api
- ${revision}
-
-
- org.apache.dubbo
- dubbo
-
-
- Spring Cloud Alibaba Seata Examples
-
-
-
-
diff --git a/spring-cloud-alibaba-examples/seata-example/storage-service-api/src/main/java/com/alibaba/cloud/examples/api/StorageDubboService.java b/spring-cloud-alibaba-examples/seata-example/storage-service-api/src/main/java/com/alibaba/cloud/examples/api/StorageDubboService.java
deleted file mode 100644
index acddc42a8..000000000
--- a/spring-cloud-alibaba-examples/seata-example/storage-service-api/src/main/java/com/alibaba/cloud/examples/api/StorageDubboService.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright 2013-2018 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://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 com.alibaba.cloud.examples.api;
-
-/**
- * @author zhangqian9158@gmail.com
- */
-
-public interface StorageDubboService {
-
- String updateStorage(String commodityCode, int count);
-
-}
diff --git a/spring-cloud-alibaba-examples/seata-example/storage-service-provider/pom.xml b/spring-cloud-alibaba-examples/seata-example/storage-service-provider/pom.xml
deleted file mode 100644
index 12b1b4601..000000000
--- a/spring-cloud-alibaba-examples/seata-example/storage-service-provider/pom.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-
-
-
- spring-cloud-alibaba-examples
- com.alibaba.cloud
- ${revision}
- ../../pom.xml
-
- 4.0.0
- storage-service-provider
- Spring Cloud Starter Alibaba Seata Example - Storage Service
- jar
-
-
-
- com.alibaba.cloud
- spring-cloud-starter-alibaba-seata
-
-
- com.alibaba.cloud
- spring-cloud-starter-alibaba-nacos-discovery
-
-
-
- com.alibaba.cloud
- spring-cloud-starter-dubbo
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
- org.springframework.boot
- spring-boot-starter-actuator
-
-
- org.springframework.boot
- spring-boot-starter-jdbc
-
-
- com.alibaba
- druid-spring-boot-starter
- 1.1.10
-
-
- mysql
- mysql-connector-java
-
-
- log4j
- log4j
- 1.2.17
-
-
- com.alibaba.cloud
- storage-service-api
- 2.2.8-SNAPSHOT
- compile
-
-
-
diff --git a/spring-cloud-alibaba-examples/seata-example/storage-service-provider/src/main/java/com/alibaba/cloud/examples/StorageApplication.java b/spring-cloud-alibaba-examples/seata-example/storage-service-provider/src/main/java/com/alibaba/cloud/examples/StorageApplication.java
deleted file mode 100644
index 445336541..000000000
--- a/spring-cloud-alibaba-examples/seata-example/storage-service-provider/src/main/java/com/alibaba/cloud/examples/StorageApplication.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2013-2018 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://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 com.alibaba.cloud.examples;
-
-import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-/**
- * @author xiaojing
- */
-@SpringBootApplication
-@EnableDubbo
-public class StorageApplication {
-
- public static void main(String[] args) {
-
- SpringApplication.run(StorageApplication.class, args);
- }
-
-}
diff --git a/spring-cloud-alibaba-examples/seata-example/storage-service-provider/src/main/java/com/alibaba/cloud/examples/api/impl/StorageDubboServiceImpl.java b/spring-cloud-alibaba-examples/seata-example/storage-service-provider/src/main/java/com/alibaba/cloud/examples/api/impl/StorageDubboServiceImpl.java
deleted file mode 100644
index 8336fd85c..000000000
--- a/spring-cloud-alibaba-examples/seata-example/storage-service-provider/src/main/java/com/alibaba/cloud/examples/api/impl/StorageDubboServiceImpl.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 2013-2018 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://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 com.alibaba.cloud.examples.api.impl;
-
-import com.alibaba.cloud.examples.api.StorageDubboService;
-import io.seata.core.context.RootContext;
-import org.apache.dubbo.config.annotation.DubboService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * @author ZHANGQIAN
- */
-
-@DubboService
-public class StorageDubboServiceImpl implements StorageDubboService {
-
- private static final Logger LOGGER = LoggerFactory
- .getLogger(StorageDubboServiceImpl.class);
-
- private static final String SUCCESS = "SUCCESS";
-
- private static final String FAIL = "FAIL";
-
- private final JdbcTemplate jdbcTemplate;
-
- public StorageDubboServiceImpl(JdbcTemplate jdbcTemplate) {
- this.jdbcTemplate = jdbcTemplate;
- }
-
- @Override
- @Transactional
- public String updateStorage(String commodityCode, int count) {
- LOGGER.info("Dubbo Storage Service Begin ... xid: " + RootContext.getXID());
- int result = jdbcTemplate.update(
- "update storage_tbl set count = count - ? where commodity_code = ?",
- new Object[] { count, commodityCode });
- LOGGER.info("Storage Service End ... ");
- if (result == 1) {
- return SUCCESS;
- }
- return FAIL;
- }
-
-}
diff --git a/spring-cloud-alibaba-examples/seata-example/storage-service-provider/src/main/java/com/alibaba/cloud/examples/config/DatabaseConfiguration.java b/spring-cloud-alibaba-examples/seata-example/storage-service-provider/src/main/java/com/alibaba/cloud/examples/config/DatabaseConfiguration.java
deleted file mode 100644
index 2ba77c4f4..000000000
--- a/spring-cloud-alibaba-examples/seata-example/storage-service-provider/src/main/java/com/alibaba/cloud/examples/config/DatabaseConfiguration.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2013-2018 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://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 com.alibaba.cloud.examples.config;
-
-import javax.sql.DataSource;
-
-import com.alibaba.druid.pool.DruidDataSource;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Primary;
-import org.springframework.jdbc.core.JdbcTemplate;
-
-/**
- * @author xiaojing
- */
-@Configuration
-public class DatabaseConfiguration {
-
- @Bean
- @Primary
- @ConfigurationProperties("spring.datasource")
- public DataSource storageDataSource() {
- return new DruidDataSource();
- }
-
- @Bean
- public JdbcTemplate jdbcTemplate(DataSource dataSource) {
-
- JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
-
- jdbcTemplate.update("delete from storage_tbl where commodity_code = 'C00321'");
- jdbcTemplate.update(
- "insert into storage_tbl(commodity_code, count) values ('C00321', 100)");
-
- return jdbcTemplate;
-
- }
-
-}
diff --git a/spring-cloud-alibaba-examples/seata-example/storage-service-provider/src/main/java/com/alibaba/cloud/examples/controller/StorageController.java b/spring-cloud-alibaba-examples/seata-example/storage-service-provider/src/main/java/com/alibaba/cloud/examples/controller/StorageController.java
deleted file mode 100644
index 6e37d5ca0..000000000
--- a/spring-cloud-alibaba-examples/seata-example/storage-service-provider/src/main/java/com/alibaba/cloud/examples/controller/StorageController.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2013-2018 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://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 com.alibaba.cloud.examples.controller;
-
-import io.seata.core.context.RootContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * @author xiaojing
- */
-@RestController
-public class StorageController {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(StorageController.class);
-
- private static final String SUCCESS = "SUCCESS";
-
- private static final String FAIL = "FAIL";
-
- private final JdbcTemplate jdbcTemplate;
-
- public StorageController(JdbcTemplate jdbcTemplate) {
- this.jdbcTemplate = jdbcTemplate;
- }
-
- @GetMapping(value = "/storage/{commodityCode}/{count}", produces = "application/json")
- public String echo(@PathVariable String commodityCode, @PathVariable int count) {
- LOGGER.info("Storage Service Begin ... xid: " + RootContext.getXID());
- int result = jdbcTemplate.update(
- "update storage_tbl set count = count - ? where commodity_code = ?",
- new Object[] { count, commodityCode });
- LOGGER.info("Storage Service End ... ");
- if (result == 1) {
- return SUCCESS;
- }
- return FAIL;
- }
-
-}
diff --git a/spring-cloud-alibaba-examples/seata-example/storage-service-provider/src/main/resources/application.yml b/spring-cloud-alibaba-examples/seata-example/storage-service-provider/src/main/resources/application.yml
deleted file mode 100644
index b3193cb1c..000000000
--- a/spring-cloud-alibaba-examples/seata-example/storage-service-provider/src/main/resources/application.yml
+++ /dev/null
@@ -1,68 +0,0 @@
-base:
- config:
- mdb:
- hostname: 127.0.0.1
- dbname: seata
- port: 3306
- username: root
- password: 123456
-
-server:
- port: 18082
-
-spring:
- cloud:
- nacos:
- discovery:
- server-addr: 127.0.0.1:8848
- application:
- name: storage-service
- main:
- allow-bean-definition-overriding: true
- datasource:
- name: storageDataSource
- type: com.alibaba.druid.pool.DruidDataSource
- driver-class-name: com.mysql.cj.jdbc.Driver
- url: jdbc:mysql://${base.config.mdb.hostname}:${base.config.mdb.port}/${base.config.mdb.dbname}?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&zeroDateTimeBehavior=convertToNull
- # jdbc_url: jdbc:mysql://${base.config.mdb.hostname}:${base.config.mdb.port}/${base.config.mdb.dbname}?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&zeroDateTimeBehavior=convertToNull
- username: ${base.config.mdb.username}
- password: ${base.config.mdb.password}
- druid:
- max-active: 20
- min-idle: 2
- initial-size: 2
-
-seata:
- enabled: true
- application-id: ${spring.application.name}
-
- tx-service-group: ${spring.application.name}-tx-group
- config:
- type: nacos
-
- nacos:
- namespace: a3f588d3-7be9-43d3-af7c-1e7919cf8af6
- serverAddr: 127.0.0.1:8848
-
- group: SEATA_GROUP
- dataId: "seata.properties"
- username: "nacos"
- password: "nacos"
- registry:
- type: nacos
- nacos:
- application: seata-server
- server-addr: 127.0.0.1:8848
- group: SEATA_GROUP
- namespace: a3f588d3-7be9-43d3-af7c-1e7919cf8af6
- username: "nacos"
- password: "nacos"
-dubbo:
- registry:
- address: spring-cloud://localhost
- protocol: dubbo
- port: -1
- cloud:
- subscribed-services: null
- provider:
- telnet: ls,ps,cd,pwd,trace,count,invoke,select,status,log,help,clear,exit,shutdown