1
0
mirror of https://gitee.com/mirrors/Spring-Cloud-Alibaba.git synced 2021-06-26 13:25:11 +08:00

sync & commit in finchley

This commit is contained in:
fangjian0423
2019-10-30 13:10:10 +08:00
parent 6be45914c8
commit 15465b5612
436 changed files with 7099 additions and 3202 deletions

View File

@@ -3,8 +3,8 @@
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">
<parent>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-examples</artifactId>
<groupId>com.alibaba.cloud</groupId>
<version>2.0.1.BUILD-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@@ -17,14 +17,13 @@ package com.alibaba.cloud.examples;
import java.util.Random;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import io.seata.core.context.RootContext;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author xiaojing
@@ -45,7 +44,7 @@ public class AccountController {
this.random = new Random();
}
@RequestMapping(value = "/account", method = RequestMethod.POST, produces = "application/json")
@PostMapping(value = "/account", produces = "application/json")
public String account(String userId, int money) {
LOGGER.info("Account Service ... xid: " + RootContext.getXID());

View File

@@ -17,16 +17,16 @@ package com.alibaba.cloud.examples;
import java.sql.SQLException;
import com.alibaba.druid.pool.DruidDataSource;
import io.seata.rm.datasource.DataSourceProxy;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.jdbc.core.JdbcTemplate;
import com.alibaba.druid.pool.DruidDataSource;
import io.seata.rm.datasource.DataSourceProxy;
/**
* @author xiaojing
*/

View File

@@ -4,7 +4,7 @@ transport {
#NIO NATIVE
server = "NIO"
#enable heartbeat
heartbeat = true
heartbeat = false
#thread factory for netty
thread-factory {
boss-thread-prefix = "NettyBoss"
@@ -28,7 +28,7 @@ transport {
}
service {
#vgroup->rgroup
vgroup_mapping.account-service-fescar-service-group = "default"
vgroup_mapping.account-service-seata-service-group = "default"
#only support single node
default.grouplist = "127.0.0.1:8091"
#degrade current not support
@@ -46,17 +46,22 @@ client {
retry.times = 30
}
report.retry.count = 5
tm.commit.retry.count = 1
tm.rollback.retry.count = 1
}
transaction {
undo.data.validation = true
undo.log.serialization = "jackson"
undo.log.save.days = 7
#schedule delete expired undo_log in milliseconds
undo.log.delete.period = 86400000
undo.log.table = "undo_log"
}
## metrics settings
metrics {
enabled = false
registry-type = "compact"
# multi exporters use comma divided
exporter-list = "prometheus"
exporter-prometheus-port = 9898
support {
## spring
spring {
# auto proxy the DataSource bean
datasource.autoproxy = false
}
}

View File

@@ -4,7 +4,7 @@ registry {
nacos {
serverAddr = "localhost"
namespace = "public"
namespace = ""
cluster = "default"
}
eureka {
@@ -50,8 +50,7 @@ config {
nacos {
serverAddr = "localhost"
namespace = "public"
cluster = "default"
namespace = ""
}
consul {
serverAddr = "127.0.0.1:8500"

View File

@@ -16,8 +16,13 @@
package com.alibaba.cloud.examples;
import com.alibaba.cloud.examples.BusinessApplication.OrderService;
import com.alibaba.cloud.examples.BusinessApplication.StorageService;
import io.seata.spring.annotation.GlobalTransactional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
@@ -29,11 +34,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import com.alibaba.cloud.examples.BusinessApplication.OrderService;
import com.alibaba.cloud.examples.BusinessApplication.StorageService;
import io.seata.spring.annotation.GlobalTransactional;
/**
* @author xiaojing
*/

View File

@@ -4,7 +4,7 @@ transport {
#NIO NATIVE
server = "NIO"
#enable heartbeat
heartbeat = true
heartbeat = false
#thread factory for netty
thread-factory {
boss-thread-prefix = "NettyBoss"
@@ -28,7 +28,7 @@ transport {
}
service {
#vgroup->rgroup
vgroup_mapping.business-service-fescar-service-group = "default"
vgroup_mapping.business-service-seata-service-group = "default"
#only support single node
default.grouplist = "127.0.0.1:8091"
#degrade current not support
@@ -46,17 +46,22 @@ client {
retry.times = 30
}
report.retry.count = 5
tm.commit.retry.count = 1
tm.rollback.retry.count = 1
}
transaction {
undo.data.validation = true
undo.log.serialization = "jackson"
undo.log.save.days = 7
#schedule delete expired undo_log in milliseconds
undo.log.delete.period = 86400000
undo.log.table = "undo_log"
}
## metrics settings
metrics {
enabled = false
registry-type = "compact"
# multi exporters use comma divided
exporter-list = "prometheus"
exporter-prometheus-port = 9898
support {
## spring
spring {
# auto proxy the DataSource bean
datasource.autoproxy = false
}
}

View File

@@ -4,7 +4,7 @@ registry {
nacos {
serverAddr = "localhost"
namespace = "public"
namespace = ""
cluster = "default"
}
eureka {
@@ -50,8 +50,7 @@ config {
nacos {
serverAddr = "localhost"
namespace = "public"
cluster = "default"
namespace = ""
}
consul {
serverAddr = "127.0.0.1:8500"

View File

@@ -17,16 +17,16 @@ package com.alibaba.cloud.examples;
import java.sql.SQLException;
import com.alibaba.druid.pool.DruidDataSource;
import io.seata.rm.datasource.DataSourceProxy;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.jdbc.core.JdbcTemplate;
import com.alibaba.druid.pool.DruidDataSource;
import io.seata.rm.datasource.DataSourceProxy;
/**
* @author xiaojing
*/

View File

@@ -21,8 +21,10 @@ import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Random;
import io.seata.core.context.RootContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
@@ -38,8 +40,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import io.seata.core.context.RootContext;
/**
* @author xiaojing
*/

View File

@@ -4,7 +4,7 @@ transport {
#NIO NATIVE
server = "NIO"
#enable heartbeat
heartbeat = true
heartbeat = false
#thread factory for netty
thread-factory {
boss-thread-prefix = "NettyBoss"
@@ -28,7 +28,7 @@ transport {
}
service {
#vgroup->rgroup
vgroup_mapping.order-service-fescar-service-group = "default"
vgroup_mapping.order-service-seata-service-group = "default"
#only support single node
default.grouplist = "127.0.0.1:8091"
#degrade current not support
@@ -46,17 +46,22 @@ client {
retry.times = 30
}
report.retry.count = 5
tm.commit.retry.count = 1
tm.rollback.retry.count = 1
}
transaction {
undo.data.validation = true
undo.log.serialization = "jackson"
undo.log.save.days = 7
#schedule delete expired undo_log in milliseconds
undo.log.delete.period = 86400000
undo.log.table = "undo_log"
}
## metrics settings
metrics {
enabled = false
registry-type = "compact"
# multi exporters use comma divided
exporter-list = "prometheus"
exporter-prometheus-port = 9898
support {
## spring
spring {
# auto proxy the DataSource bean
datasource.autoproxy = false
}
}

View File

@@ -4,7 +4,7 @@ registry {
nacos {
serverAddr = "localhost"
namespace = "public"
namespace = ""
cluster = "default"
}
eureka {
@@ -50,8 +50,7 @@ config {
nacos {
serverAddr = "localhost"
namespace = "public"
cluster = "default"
namespace = ""
}
consul {
serverAddr = "127.0.0.1:8500"

View File

@@ -99,12 +99,16 @@ CREATE TABLE `account_tbl` (
点击这个页面 [https://github.com/seata/seata/releases](https://github.com/seata/seata/releases),下载最新版本的 Seata Server 端.
进入解压之后的 bin 目录,执行如下命令来启动
进入解压之后的 bin 目录,执行如下命令来启动, 所有启动参数为可选项。
```$shell
sh seata-server.sh -p $LISTEN_PORT -m $MODE(file or db)
sh seata-server.sh -p $LISTEN_PORT -m $MODE(file or db) -h $HOST -e $ENV
```
-p seata-server 监听服务端口号
-m 存储模式可选值file、db。file 用于单点模式db用于ha模式当使用db存储模式需要修改配置中store配置节点的数据库配置同时在数据库中初始化[global_table、branch_table和
lock_table](https://github.com/seata/seata/blob/develop/server/src/main/resources/db_store.sql)
-h 用于解决seata-server和业务侧跨网络问题其配置的host值直接显示到注册中心的服务可用地址host当跨网络时这里需要配置为公网IP或NATIP若都在同一局域网则无需配置
-e 用于解决多环境配置中心隔离问题
在这个示例中,采用如下命令来启动 Seata Server
```$shell

View File

@@ -18,16 +18,16 @@ package com.alibaba.cloud.examples;
import java.sql.SQLException;
import com.alibaba.druid.pool.DruidDataSource;
import io.seata.rm.datasource.DataSourceProxy;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.jdbc.core.JdbcTemplate;
import com.alibaba.druid.pool.DruidDataSource;
import io.seata.rm.datasource.DataSourceProxy;
/**
* @author xiaojing
*/

View File

@@ -16,16 +16,16 @@
package com.alibaba.cloud.examples;
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.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import io.seata.core.context.RootContext;
/**
* @author xiaojing
*/

View File

@@ -4,7 +4,7 @@ transport {
#NIO NATIVE
server = "NIO"
#enable heartbeat
heartbeat = true
heartbeat = false
#thread factory for netty
thread-factory {
boss-thread-prefix = "NettyBoss"
@@ -28,7 +28,7 @@ transport {
}
service {
#vgroup->rgroup
vgroup_mapping.storage-service-fescar-service-group = "default"
vgroup_mapping.storage-service-seata-service-group = "default"
#only support single node
default.grouplist = "127.0.0.1:8091"
#degrade current not support
@@ -46,17 +46,22 @@ client {
retry.times = 30
}
report.retry.count = 5
tm.commit.retry.count = 1
tm.rollback.retry.count = 1
}
transaction {
undo.data.validation = true
undo.log.serialization = "jackson"
undo.log.save.days = 7
#schedule delete expired undo_log in milliseconds
undo.log.delete.period = 86400000
undo.log.table = "undo_log"
}
## metrics settings
metrics {
enabled = false
registry-type = "compact"
# multi exporters use comma divided
exporter-list = "prometheus"
exporter-prometheus-port = 9898
support {
## spring
spring {
# auto proxy the DataSource bean
datasource.autoproxy = false
}
}

View File

@@ -4,7 +4,7 @@ registry {
nacos {
serverAddr = "localhost"
namespace = "public"
namespace = ""
cluster = "default"
}
eureka {
@@ -50,8 +50,7 @@ config {
nacos {
serverAddr = "localhost"
namespace = "public"
cluster = "default"
namespace = ""
}
consul {
serverAddr = "127.0.0.1:8500"