mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
sync to edgware before graduation
This commit is contained in:
parent
f19c83a7a9
commit
e0c0a9f1c3
@ -1,6 +1,6 @@
|
||||
# Spring Cloud Alibaba
|
||||
|
||||
[](https://circleci.com/gh/spring-cloud-incubator/spring-cloud-alibaba/tree/master)
|
||||
[](https://circleci.com/gh/alibaba/spring-cloud-alibaba/tree/master)
|
||||
[](https://search.maven.org/search?q=g:org.springframework.cloud%20AND%20a:spring-cloud-alibaba-dependencies)
|
||||
[](https://codecov.io/gh/spring-cloud-incubator/spring-cloud-alibaba)
|
||||
[](https://www.apache.org/licenses/LICENSE-2.0.html)
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Spring Cloud Alibaba
|
||||
|
||||
[](https://circleci.com/gh/spring-cloud-incubator/spring-cloud-alibaba/tree/master)
|
||||
[](https://circleci.com/gh/alibaba/spring-cloud-alibaba/tree/master)
|
||||
[](https://search.maven.org/search?q=g:org.springframework.cloud%20AND%20a:spring-cloud-alibaba-dependencies)
|
||||
[](https://codecov.io/gh/spring-cloud-incubator/spring-cloud-alibaba)
|
||||
[](https://www.apache.org/licenses/LICENSE-2.0.html)
|
||||
|
@ -19,7 +19,7 @@
|
||||
<properties>
|
||||
<sentinel.version>1.6.2</sentinel.version>
|
||||
<oss.version>3.1.0</oss.version>
|
||||
<seata.version>0.5.1</seata.version>
|
||||
<seata.version>0.7.1</seata.version>
|
||||
<nacos.version>1.1.1</nacos.version>
|
||||
<acm.version>1.0.9</acm.version>
|
||||
<ans.version>1.0.1</ans.version>
|
||||
@ -193,7 +193,7 @@
|
||||
<!--Alibaba Seata-->
|
||||
<dependency>
|
||||
<groupId>io.seata</groupId>
|
||||
<artifactId>seata-spring</artifactId>
|
||||
<artifactId>seata-all</artifactId>
|
||||
<version>${seata.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
@ -3,3 +3,4 @@ spring.application.name=acm-local
|
||||
server.port=18089
|
||||
spring.cloud.alicloud.acm.server-list=127.0.0.1
|
||||
spring.cloud.alicloud.acm.server-port=8080
|
||||
management.security.enabled=false
|
@ -19,16 +19,12 @@ transport {
|
||||
#auto default pin or 8
|
||||
worker-thread-size = 8
|
||||
}
|
||||
}
|
||||
store {
|
||||
# branch session size , if exceeded first try compress lockkey, still exceeded throws exceptions
|
||||
max-branch-session-size = 16384
|
||||
# globe session size , if exceeded throws exceptions
|
||||
max-global-session-size = 512
|
||||
# file buffer size , if exceeded allocate new buffer
|
||||
file-write-buffer-cache-size = 16384
|
||||
# when recover batch read size
|
||||
session.reload.read_size = 100
|
||||
shutdown {
|
||||
# when destroy server, wait seconds
|
||||
wait = 3
|
||||
}
|
||||
serialization = "seata"
|
||||
compressor = "none"
|
||||
}
|
||||
service {
|
||||
#vgroup->rgroup
|
||||
@ -39,6 +35,9 @@ service {
|
||||
enableDegrade = false
|
||||
#disable
|
||||
disable = false
|
||||
#unit ms,s,m,h,d represents milliseconds, seconds, minutes, hours, days, default permanent
|
||||
max.commit.retry.timeout = "-1"
|
||||
max.rollback.retry.timeout = "-1"
|
||||
}
|
||||
client {
|
||||
async.commit.buffer.limit = 10000
|
||||
@ -46,4 +45,18 @@ client {
|
||||
retry.internal = 10
|
||||
retry.times = 30
|
||||
}
|
||||
report.retry.count = 5
|
||||
}
|
||||
transaction {
|
||||
undo.data.validation = true
|
||||
undo.log.serialization = "jackson"
|
||||
}
|
||||
|
||||
## metrics settings
|
||||
metrics {
|
||||
enabled = false
|
||||
registry-type = "compact"
|
||||
# multi exporters use comma divided
|
||||
exporter-list = "prometheus"
|
||||
exporter-prometheus-port = 9898
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
registry {
|
||||
# file 、nacos 、eureka、redis、zk、consul
|
||||
# file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
|
||||
type = "file"
|
||||
|
||||
nacos {
|
||||
@ -8,7 +8,7 @@ registry {
|
||||
cluster = "default"
|
||||
}
|
||||
eureka {
|
||||
serviceUrl = "http://localhost:1001/eureka"
|
||||
serviceUrl = "http://localhost:8761/eureka"
|
||||
application = "default"
|
||||
weight = "1"
|
||||
}
|
||||
@ -26,13 +26,26 @@ registry {
|
||||
cluster = "default"
|
||||
serverAddr = "127.0.0.1:8500"
|
||||
}
|
||||
etcd3 {
|
||||
cluster = "default"
|
||||
serverAddr = "http://localhost:2379"
|
||||
}
|
||||
sofa {
|
||||
serverAddr = "127.0.0.1:9603"
|
||||
application = "default"
|
||||
region = "DEFAULT_ZONE"
|
||||
datacenter = "DefaultDataCenter"
|
||||
cluster = "default"
|
||||
group = "SEATA_GROUP"
|
||||
addressWaitTime = "3000"
|
||||
}
|
||||
file {
|
||||
name = "file.conf"
|
||||
}
|
||||
}
|
||||
|
||||
config {
|
||||
# file、nacos 、apollo、zk
|
||||
# file、nacos 、apollo、zk、consul、etcd3
|
||||
type = "file"
|
||||
|
||||
nacos {
|
||||
@ -40,8 +53,11 @@ config {
|
||||
namespace = "public"
|
||||
cluster = "default"
|
||||
}
|
||||
consul {
|
||||
serverAddr = "127.0.0.1:8500"
|
||||
}
|
||||
apollo {
|
||||
app.id = "fescar-server"
|
||||
app.id = "seata-server"
|
||||
apollo.meta = "http://192.168.1.204:8801"
|
||||
}
|
||||
zk {
|
||||
@ -49,6 +65,9 @@ config {
|
||||
session.timeout = 6000
|
||||
connect.timeout = 2000
|
||||
}
|
||||
etcd3 {
|
||||
serverAddr = "http://localhost:2379"
|
||||
}
|
||||
file {
|
||||
name = "file.conf"
|
||||
}
|
||||
|
@ -19,36 +19,12 @@ transport {
|
||||
#auto default pin or 8
|
||||
worker-thread-size = 8
|
||||
}
|
||||
}
|
||||
## transaction log store
|
||||
store {
|
||||
## store mode: file、db
|
||||
mode = "file"
|
||||
|
||||
## file store
|
||||
file {
|
||||
dir = "sessionStore"
|
||||
|
||||
# branch session size , if exceeded first try compress lockkey, still exceeded throws exceptions
|
||||
max-branch-session-size = 16384
|
||||
# globe session size , if exceeded throws exceptions
|
||||
max-global-session-size = 512
|
||||
# file buffer size , if exceeded allocate new buffer
|
||||
file-write-buffer-cache-size = 16384
|
||||
# when recover batch read size
|
||||
session.reload.read_size = 100
|
||||
# async, sync
|
||||
flush-disk-mode = async
|
||||
shutdown {
|
||||
# when destroy server, wait seconds
|
||||
wait = 3
|
||||
}
|
||||
|
||||
## database store
|
||||
db {
|
||||
driver_class = ""
|
||||
url = ""
|
||||
user = ""
|
||||
password = ""
|
||||
}
|
||||
|
||||
serialization = "seata"
|
||||
compressor = "none"
|
||||
}
|
||||
service {
|
||||
#vgroup->rgroup
|
||||
@ -59,6 +35,9 @@ service {
|
||||
enableDegrade = false
|
||||
#disable
|
||||
disable = false
|
||||
#unit ms,s,m,h,d represents milliseconds, seconds, minutes, hours, days, default permanent
|
||||
max.commit.retry.timeout = "-1"
|
||||
max.rollback.retry.timeout = "-1"
|
||||
}
|
||||
client {
|
||||
async.commit.buffer.limit = 10000
|
||||
@ -66,4 +45,18 @@ client {
|
||||
retry.internal = 10
|
||||
retry.times = 30
|
||||
}
|
||||
report.retry.count = 5
|
||||
}
|
||||
transaction {
|
||||
undo.data.validation = true
|
||||
undo.log.serialization = "jackson"
|
||||
}
|
||||
|
||||
## metrics settings
|
||||
metrics {
|
||||
enabled = false
|
||||
registry-type = "compact"
|
||||
# multi exporters use comma divided
|
||||
exporter-list = "prometheus"
|
||||
exporter-prometheus-port = 9898
|
||||
}
|
@ -8,7 +8,7 @@ registry {
|
||||
cluster = "default"
|
||||
}
|
||||
eureka {
|
||||
serviceUrl = "http://localhost:1001/eureka"
|
||||
serviceUrl = "http://localhost:8761/eureka"
|
||||
application = "default"
|
||||
weight = "1"
|
||||
}
|
||||
@ -45,7 +45,7 @@ registry {
|
||||
}
|
||||
|
||||
config {
|
||||
# file、nacos 、apollo、zk
|
||||
# file、nacos 、apollo、zk、consul、etcd3
|
||||
type = "file"
|
||||
|
||||
nacos {
|
||||
@ -53,6 +53,9 @@ config {
|
||||
namespace = "public"
|
||||
cluster = "default"
|
||||
}
|
||||
consul {
|
||||
serverAddr = "127.0.0.1:8500"
|
||||
}
|
||||
apollo {
|
||||
app.id = "seata-server"
|
||||
apollo.meta = "http://192.168.1.204:8801"
|
||||
@ -62,6 +65,9 @@ config {
|
||||
session.timeout = 6000
|
||||
connect.timeout = 2000
|
||||
}
|
||||
etcd3 {
|
||||
serverAddr = "http://localhost:2379"
|
||||
}
|
||||
file {
|
||||
name = "file.conf"
|
||||
}
|
||||
|
@ -19,36 +19,12 @@ transport {
|
||||
#auto default pin or 8
|
||||
worker-thread-size = 8
|
||||
}
|
||||
}
|
||||
## transaction log store
|
||||
store {
|
||||
## store mode: file、db
|
||||
mode = "file"
|
||||
|
||||
## file store
|
||||
file {
|
||||
dir = "sessionStore"
|
||||
|
||||
# branch session size , if exceeded first try compress lockkey, still exceeded throws exceptions
|
||||
max-branch-session-size = 16384
|
||||
# globe session size , if exceeded throws exceptions
|
||||
max-global-session-size = 512
|
||||
# file buffer size , if exceeded allocate new buffer
|
||||
file-write-buffer-cache-size = 16384
|
||||
# when recover batch read size
|
||||
session.reload.read_size = 100
|
||||
# async, sync
|
||||
flush-disk-mode = async
|
||||
shutdown {
|
||||
# when destroy server, wait seconds
|
||||
wait = 3
|
||||
}
|
||||
|
||||
## database store
|
||||
db {
|
||||
driver_class = ""
|
||||
url = ""
|
||||
user = ""
|
||||
password = ""
|
||||
}
|
||||
|
||||
serialization = "seata"
|
||||
compressor = "none"
|
||||
}
|
||||
service {
|
||||
#vgroup->rgroup
|
||||
@ -59,6 +35,9 @@ service {
|
||||
enableDegrade = false
|
||||
#disable
|
||||
disable = false
|
||||
#unit ms,s,m,h,d represents milliseconds, seconds, minutes, hours, days, default permanent
|
||||
max.commit.retry.timeout = "-1"
|
||||
max.rollback.retry.timeout = "-1"
|
||||
}
|
||||
client {
|
||||
async.commit.buffer.limit = 10000
|
||||
@ -66,4 +45,18 @@ client {
|
||||
retry.internal = 10
|
||||
retry.times = 30
|
||||
}
|
||||
report.retry.count = 5
|
||||
}
|
||||
transaction {
|
||||
undo.data.validation = true
|
||||
undo.log.serialization = "jackson"
|
||||
}
|
||||
|
||||
## metrics settings
|
||||
metrics {
|
||||
enabled = false
|
||||
registry-type = "compact"
|
||||
# multi exporters use comma divided
|
||||
exporter-list = "prometheus"
|
||||
exporter-prometheus-port = 9898
|
||||
}
|
@ -8,7 +8,7 @@ registry {
|
||||
cluster = "default"
|
||||
}
|
||||
eureka {
|
||||
serviceUrl = "http://localhost:1001/eureka"
|
||||
serviceUrl = "http://localhost:8761/eureka"
|
||||
application = "default"
|
||||
weight = "1"
|
||||
}
|
||||
@ -45,7 +45,7 @@ registry {
|
||||
}
|
||||
|
||||
config {
|
||||
# file、nacos 、apollo、zk
|
||||
# file、nacos 、apollo、zk、consul、etcd3
|
||||
type = "file"
|
||||
|
||||
nacos {
|
||||
@ -53,6 +53,9 @@ config {
|
||||
namespace = "public"
|
||||
cluster = "default"
|
||||
}
|
||||
consul {
|
||||
serverAddr = "127.0.0.1:8500"
|
||||
}
|
||||
apollo {
|
||||
app.id = "seata-server"
|
||||
apollo.meta = "http://192.168.1.204:8801"
|
||||
@ -62,6 +65,9 @@ config {
|
||||
session.timeout = 6000
|
||||
connect.timeout = 2000
|
||||
}
|
||||
etcd3 {
|
||||
serverAddr = "http://localhost:2379"
|
||||
}
|
||||
file {
|
||||
name = "file.conf"
|
||||
}
|
||||
|
@ -50,6 +50,7 @@ CREATE TABLE `undo_log` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`branch_id` bigint(20) NOT NULL,
|
||||
`xid` varchar(100) NOT NULL,
|
||||
`context` varchar(128) NOT NULL,
|
||||
`rollback_info` longblob NOT NULL,
|
||||
`log_status` int(11) NOT NULL,
|
||||
`log_created` datetime NOT NULL,
|
||||
@ -101,13 +102,13 @@ CREATE TABLE `account_tbl` (
|
||||
进入解压之后的 bin 目录,执行如下命令来启动
|
||||
|
||||
```$shell
|
||||
sh seata-server.sh $LISTEN_PORT $MODE(file or db)
|
||||
sh seata-server.sh -p $LISTEN_PORT -m $MODE(file or db)
|
||||
```
|
||||
|
||||
在这个示例中,采用如下命令来启动 Seata Server
|
||||
|
||||
```$shell
|
||||
sh seata-server.sh 8091 file
|
||||
sh seata-server.sh -p 8091 -m file
|
||||
```
|
||||
|
||||
**注意** 如果你修改了endpoint且注册中心使用默认file类型,那么记得需要在各个示例工程中的 `file.conf` 文件中,修改 grouplist 的值(当registry.conf 中registry.type 或 config.type 为file 时会读取内部的file节点中的文件名,若type不为file将直接从配置类型的对应元数据的注册配置中心读取数据),推荐大家使用 nacos 作为配置注册中心。
|
||||
|
@ -19,36 +19,12 @@ transport {
|
||||
#auto default pin or 8
|
||||
worker-thread-size = 8
|
||||
}
|
||||
}
|
||||
## transaction log store
|
||||
store {
|
||||
## store mode: file、db
|
||||
mode = "file"
|
||||
|
||||
## file store
|
||||
file {
|
||||
dir = "sessionStore"
|
||||
|
||||
# branch session size , if exceeded first try compress lockkey, still exceeded throws exceptions
|
||||
max-branch-session-size = 16384
|
||||
# globe session size , if exceeded throws exceptions
|
||||
max-global-session-size = 512
|
||||
# file buffer size , if exceeded allocate new buffer
|
||||
file-write-buffer-cache-size = 16384
|
||||
# when recover batch read size
|
||||
session.reload.read_size = 100
|
||||
# async, sync
|
||||
flush-disk-mode = async
|
||||
shutdown {
|
||||
# when destroy server, wait seconds
|
||||
wait = 3
|
||||
}
|
||||
|
||||
## database store
|
||||
db {
|
||||
driver_class = ""
|
||||
url = ""
|
||||
user = ""
|
||||
password = ""
|
||||
}
|
||||
|
||||
serialization = "seata"
|
||||
compressor = "none"
|
||||
}
|
||||
service {
|
||||
#vgroup->rgroup
|
||||
@ -59,6 +35,9 @@ service {
|
||||
enableDegrade = false
|
||||
#disable
|
||||
disable = false
|
||||
#unit ms,s,m,h,d represents milliseconds, seconds, minutes, hours, days, default permanent
|
||||
max.commit.retry.timeout = "-1"
|
||||
max.rollback.retry.timeout = "-1"
|
||||
}
|
||||
client {
|
||||
async.commit.buffer.limit = 10000
|
||||
@ -66,4 +45,18 @@ client {
|
||||
retry.internal = 10
|
||||
retry.times = 30
|
||||
}
|
||||
report.retry.count = 5
|
||||
}
|
||||
transaction {
|
||||
undo.data.validation = true
|
||||
undo.log.serialization = "jackson"
|
||||
}
|
||||
|
||||
## metrics settings
|
||||
metrics {
|
||||
enabled = false
|
||||
registry-type = "compact"
|
||||
# multi exporters use comma divided
|
||||
exporter-list = "prometheus"
|
||||
exporter-prometheus-port = 9898
|
||||
}
|
@ -8,7 +8,7 @@ registry {
|
||||
cluster = "default"
|
||||
}
|
||||
eureka {
|
||||
serviceUrl = "http://localhost:1001/eureka"
|
||||
serviceUrl = "http://localhost:8761/eureka"
|
||||
application = "default"
|
||||
weight = "1"
|
||||
}
|
||||
@ -45,7 +45,7 @@ registry {
|
||||
}
|
||||
|
||||
config {
|
||||
# file、nacos 、apollo、zk
|
||||
# file、nacos 、apollo、zk、consul、etcd3
|
||||
type = "file"
|
||||
|
||||
nacos {
|
||||
@ -53,6 +53,9 @@ config {
|
||||
namespace = "public"
|
||||
cluster = "default"
|
||||
}
|
||||
consul {
|
||||
serverAddr = "127.0.0.1:8500"
|
||||
}
|
||||
apollo {
|
||||
app.id = "seata-server"
|
||||
apollo.meta = "http://192.168.1.204:8801"
|
||||
@ -62,6 +65,9 @@ config {
|
||||
session.timeout = 6000
|
||||
connect.timeout = 2000
|
||||
}
|
||||
etcd3 {
|
||||
serverAddr = "http://localhost:2379"
|
||||
}
|
||||
file {
|
||||
name = "file.conf"
|
||||
}
|
||||
|
@ -155,6 +155,21 @@ public class NacosDiscoveryProperties {
|
||||
*/
|
||||
private String secretKey;
|
||||
|
||||
/**
|
||||
* Heart beat interval. Time unit: second.
|
||||
*/
|
||||
private Integer heartBeatInterval;
|
||||
|
||||
/**
|
||||
* Heart beat timeout. Time unit: second.
|
||||
*/
|
||||
private Integer heartBeatTimeout;
|
||||
|
||||
/**
|
||||
* Ip delete timeout. Time unit: second.
|
||||
*/
|
||||
private Integer ipDeleteTimeout;
|
||||
|
||||
@Autowired
|
||||
private InetUtils inetUtils;
|
||||
|
||||
@ -339,6 +354,30 @@ public class NacosDiscoveryProperties {
|
||||
this.secretKey = secretKey;
|
||||
}
|
||||
|
||||
public Integer getHeartBeatInterval() {
|
||||
return heartBeatInterval;
|
||||
}
|
||||
|
||||
public void setHeartBeatInterval(Integer heartBeatInterval) {
|
||||
this.heartBeatInterval = heartBeatInterval;
|
||||
}
|
||||
|
||||
public Integer getHeartBeatTimeout() {
|
||||
return heartBeatTimeout;
|
||||
}
|
||||
|
||||
public void setHeartBeatTimeout(Integer heartBeatTimeout) {
|
||||
this.heartBeatTimeout = heartBeatTimeout;
|
||||
}
|
||||
|
||||
public Integer getIpDeleteTimeout() {
|
||||
return ipDeleteTimeout;
|
||||
}
|
||||
|
||||
public void setIpDeleteTimeout(Integer ipDeleteTimeout) {
|
||||
this.ipDeleteTimeout = ipDeleteTimeout;
|
||||
}
|
||||
|
||||
public String getNamingLoadCacheAtStart() {
|
||||
return namingLoadCacheAtStart;
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
import com.alibaba.cloud.nacos.NacosDiscoveryProperties;
|
||||
import com.alibaba.nacos.api.naming.NamingService;
|
||||
import com.alibaba.nacos.api.naming.PreservedMetadataKeys;
|
||||
|
||||
/**
|
||||
* @author xiaojing
|
||||
@ -53,11 +54,10 @@ public class NacosRegistration implements Registration, ServiceInstance {
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
|
||||
Map<String, String> metadata = nacosDiscoveryProperties.getMetadata();
|
||||
Environment env = context.getEnvironment();
|
||||
Integer managementPort = ManagementServerPortUtils.getPort(context);
|
||||
if (null != managementPort) {
|
||||
Map<String, String> metadata = nacosDiscoveryProperties.getMetadata();
|
||||
metadata.put(MANAGEMENT_PORT, managementPort.toString());
|
||||
String contextPath = env.getProperty("management.context-path");
|
||||
String address = env.getProperty("management.address");
|
||||
@ -68,6 +68,19 @@ public class NacosRegistration implements Registration, ServiceInstance {
|
||||
metadata.put(MANAGEMENT_ADDRESS, address);
|
||||
}
|
||||
}
|
||||
|
||||
if (null != nacosDiscoveryProperties.getHeartBeatInterval()) {
|
||||
metadata.put(PreservedMetadataKeys.HEART_BEAT_INTERVAL,
|
||||
nacosDiscoveryProperties.getHeartBeatInterval().toString());
|
||||
}
|
||||
if (null != nacosDiscoveryProperties.getHeartBeatTimeout()) {
|
||||
metadata.put(PreservedMetadataKeys.HEART_BEAT_TIMEOUT,
|
||||
nacosDiscoveryProperties.getHeartBeatTimeout().toString());
|
||||
}
|
||||
if (null != nacosDiscoveryProperties.getIpDeleteTimeout()) {
|
||||
metadata.put(PreservedMetadataKeys.IP_DELETE_TIMEOUT,
|
||||
nacosDiscoveryProperties.getIpDeleteTimeout().toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
<dependency>
|
||||
<groupId>io.seata</groupId>
|
||||
<artifactId>seata-spring</artifactId>
|
||||
<artifactId>seata-all</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@ -93,45 +93,51 @@ public class SentinelInvocationHandler implements InvocationHandler {
|
||||
MethodMetadata methodMetadata = SentinelContractHolder.metadataMap
|
||||
.get(hardCodedTarget.type().getName()
|
||||
+ Feign.configKey(hardCodedTarget.type(), method));
|
||||
// resource default is HttpMethod:protocol://url
|
||||
String resourceName = methodMetadata.template().method().toUpperCase() + ":"
|
||||
+ hardCodedTarget.url() + methodMetadata.template().url();
|
||||
Entry entry = null;
|
||||
try {
|
||||
ContextUtil.enter(resourceName);
|
||||
entry = SphU.entry(resourceName, EntryType.OUT, 1, args);
|
||||
if (methodMetadata == null) {
|
||||
result = methodHandler.invoke(args);
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
// fallback handle
|
||||
if (!BlockException.isBlockException(ex)) {
|
||||
Tracer.trace(ex);
|
||||
else {
|
||||
// resource default is HttpMethod:protocol://url
|
||||
String resourceName = methodMetadata.template().method().toUpperCase()
|
||||
+ ":" + hardCodedTarget.url() + methodMetadata.template().url();
|
||||
Entry entry = null;
|
||||
try {
|
||||
ContextUtil.enter(resourceName);
|
||||
entry = SphU.entry(resourceName, EntryType.OUT, 1, args);
|
||||
result = methodHandler.invoke(args);
|
||||
}
|
||||
if (fallbackFactory != null) {
|
||||
try {
|
||||
Object fallbackResult = fallbackMethodMap.get(method)
|
||||
.invoke(fallbackFactory.create(ex), args);
|
||||
return fallbackResult;
|
||||
catch (Throwable ex) {
|
||||
// fallback handle
|
||||
if (!BlockException.isBlockException(ex)) {
|
||||
Tracer.trace(ex);
|
||||
}
|
||||
catch (IllegalAccessException e) {
|
||||
// shouldn't happen as method is public due to being an interface
|
||||
throw new AssertionError(e);
|
||||
if (fallbackFactory != null) {
|
||||
try {
|
||||
Object fallbackResult = fallbackMethodMap.get(method)
|
||||
.invoke(fallbackFactory.create(ex), args);
|
||||
return fallbackResult;
|
||||
}
|
||||
catch (IllegalAccessException e) {
|
||||
// shouldn't happen as method is public due to being an
|
||||
// interface
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
catch (InvocationTargetException e) {
|
||||
throw new AssertionError(e.getCause());
|
||||
}
|
||||
}
|
||||
catch (InvocationTargetException e) {
|
||||
throw new AssertionError(e.getCause());
|
||||
else {
|
||||
// throw exception if fallbackFactory is null
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// throw exception if fallbackFactory is null
|
||||
throw ex;
|
||||
finally {
|
||||
if (entry != null) {
|
||||
entry.exit(1, args);
|
||||
}
|
||||
ContextUtil.exit();
|
||||
}
|
||||
}
|
||||
finally {
|
||||
if (entry != null) {
|
||||
entry.exit(1, args);
|
||||
}
|
||||
ContextUtil.exit();
|
||||
}
|
||||
}
|
||||
else {
|
||||
// other target type using default strategy
|
||||
|
@ -18,6 +18,7 @@ package com.alibaba.alicloud.acm;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.cloud.context.refresh.ContextRefresher;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
@ -37,6 +38,7 @@ import com.taobao.diamond.client.Diamond;
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnClass({ Diamond.class })
|
||||
@ConditionalOnProperty(name = "spring.cloud.alicloud.acm.enabled", matchIfMissing = true)
|
||||
public class AcmAutoConfiguration implements ApplicationContextAware {
|
||||
|
||||
private ApplicationContext applicationContext;
|
||||
|
@ -17,6 +17,7 @@
|
||||
package com.alibaba.alicloud.acm.bootstrap;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.cloud.bootstrap.config.PropertySourceLocator;
|
||||
import org.springframework.core.env.CompositePropertySource;
|
||||
import org.springframework.core.env.Environment;
|
||||
@ -28,6 +29,7 @@ import com.alibaba.alicloud.context.acm.AcmIntegrationProperties;
|
||||
* @author juven.xuxb
|
||||
* @author xiaolongzuo
|
||||
*/
|
||||
@ConditionalOnProperty(name = "spring.cloud.alicloud.acm.enabled", matchIfMissing = true)
|
||||
public class AcmPropertySourceLocator implements PropertySourceLocator {
|
||||
|
||||
private static final String DIAMOND_PROPERTY_SOURCE_NAME = "diamond";
|
||||
|
@ -19,6 +19,7 @@ package com.alibaba.alicloud.acm.endpoint;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
@ -31,6 +32,7 @@ import com.alibaba.alicloud.context.acm.AcmProperties;
|
||||
*/
|
||||
@ConditionalOnWebApplication
|
||||
@ConditionalOnClass(name = "org.springframework.boot.actuate.endpoint.AbstractEndpoint")
|
||||
@ConditionalOnProperty(name = "spring.cloud.alicloud.acm.enabled", matchIfMissing = true)
|
||||
public class AcmEndpointAutoConfiguration {
|
||||
|
||||
@Autowired
|
||||
|
@ -4,6 +4,12 @@
|
||||
"name": "spring.application.group",
|
||||
"type": "java.lang.String",
|
||||
"description": "spring application group."
|
||||
},
|
||||
{
|
||||
"name": "spring.cloud.alicloud.acm.enabled",
|
||||
"type": "java.lang.Boolean",
|
||||
"defaultValue": true,
|
||||
"description": "enable acm or not."
|
||||
}
|
||||
]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user