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

Compare commits

..

28 Commits

Author SHA1 Message Date
buildmaster c7c645a86c Update SNAPSHOT to 0.2.2.RELEASE 2019-04-19 16:09:09 +00:00
fangjian0423 a63a85cae2 change version from 2.0.0.BUILD-SNAPSHOT to 0.2.2.BUILD-SNAPSHOT 2019-04-19 14:26:30 +08:00
fangjian0423 698425e045 update sentinel version to 1.5.2 in finchley 2019-04-17 19:20:55 +08:00
fangjian0423 eef0e92dd3 sync dubbo example in finchley 2019-04-17 17:31:47 +08:00
fangjian0423 7a7cc68c38 sync dubbo in finchley 2019-04-17 17:05:31 +08:00
fangjian0423 3156964300 update zk consul version 2019-04-17 16:39:05 +08:00
fangjian0423 c98fa4e1f7 sync dubbo in finchley 2019-04-17 14:37:29 +08:00
fangjian0423 ade58496fc sync code with dubbo version in finchley. 2019-04-17 11:13:22 +08:00
flystar32 7d636e364f Merge branch 'finchley' of github.com:spring-cloud-incubator/spring-cloud-alibaba into finchley 2019-04-16 23:11:08 +08:00
flystar32 a74d071f9c rename fescar to seata 2019-04-16 23:06:48 +08:00
fangjian0423 8a5dea005f update sentinel version to 1.5.1 in finchley 2019-04-16 15:30:17 +08:00
flystar32 c05d74c095 sync code from master branch 2019-04-11 16:32:58 +08:00
flystar32 b120c13033 sync code from master 2019-04-03 20:06:26 +08:00
flystar32 04c3d4b3e1 Merge branches 'finchley' and 'finchley' of github.com:spring-cloud-incubator/spring-cloud-alibaba into finchley 2019-04-03 15:30:13 +08:00
flystar32 8e30e6151f update nacos version to 1.0.0-RC3 2019-04-03 15:18:50 +08:00
fangjian0423 2ae97ecb4f Merge remote-tracking branch 'upstream/finchley' into finchley 2019-03-29 10:40:38 +08:00
fangjian0423 fb26da1d2c Add default name-server for rmq binder in finchley branch 2019-03-29 10:40:11 +08:00
flystar32 b061109d3d merge endpoint and endpoint configuration 2019-03-28 19:37:41 +08:00
亦盏 404516de43 sync code 2019-03-27 17:46:11 +08:00
fangjian0423 fb3f70d475 fix bug of sentinel feign in finchley branch 2019-03-26 20:26:39 +08:00
fangjian0423 893ca15bdd update sentinel test case 2019-03-26 17:03:06 +08:00
fangjian0423 b15f22d325 optimize circuitbreaker in resttemplate in finchley branch 2019-03-26 16:51:31 +08:00
fangjian0423 9ab99e29e3 sync rocketmq-binder, rocketmq-bus in finchley branch 2019-03-25 15:21:08 +08:00
fangjian0423 c44cdfe721 merge finchley branch 2019-03-25 11:46:29 +08:00
xiaojing 4b4ebad24d update fescar version to 0.4.0 2019-03-20 19:05:25 +08:00
xiaojing e78c12edbf update nacos client version to 1.0.0-RC2 2019-03-19 16:35:22 +08:00
flystar32 1f9eed436b change version to 2.0.0.BUILD-SNAPSHOT 2019-03-18 20:38:00 +08:00
flystar32 6fbd092780 add a new branch to support spring cloud finchley. need to update rocketmq-binder and dubbo module. 2019-03-18 20:30:59 +08:00
95 changed files with 221 additions and 1167 deletions
-5
View File
@@ -1,5 +0,0 @@
coverage:
status:
project: off
patch: off
+7 -18
View File
@@ -8,13 +8,13 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-build</artifactId>
<version>2.1.3.RELEASE</version>
<version>2.0.5.RELEASE</version>
<relativePath/>
</parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
<packaging>pom</packaging>
<name>Spring Cloud Alibaba</name>
@@ -70,11 +70,11 @@
<properties>
<!-- Dependency Versions -->
<spring-cloud-commons.version>2.1.1.RELEASE</spring-cloud-commons.version>
<spring-cloud-netflix.version>2.1.1.RELEASE</spring-cloud-netflix.version>
<spring-cloud-openfeign.version>2.1.1.RELEASE</spring-cloud-openfeign.version>
<spring-cloud-bus.version>2.1.1.RELEASE</spring-cloud-bus.version>
<spring-cloud-gateway.version>2.1.1.RELEASE</spring-cloud-gateway.version>
<spring-cloud-commons.version>2.0.3.RELEASE</spring-cloud-commons.version>
<spring-cloud-netflix.version>2.0.3.RELEASE</spring-cloud-netflix.version>
<spring-cloud-openfeign.version>2.0.3.RELEASE</spring-cloud-openfeign.version>
<spring-cloud-bus.version>2.0.1.RELEASE</spring-cloud-bus.version>
<spring-cloud-gateway.version>2.0.3.RELEASE</spring-cloud-gateway.version>
<junit.version>4.12</junit.version>
<javax-servlet-api>3.0</javax-servlet-api>
@@ -86,7 +86,6 @@
<maven-deploy-plugin.version>2.8.2</maven-deploy-plugin.version>
<maven-surefire-plugin.version>2.21.0</maven-surefire-plugin.version>
<gmavenplus-plugin.version>1.6</gmavenplus-plugin.version>
<jacoco.version>0.8.3</jacoco.version>
</properties>
<modules>
@@ -111,7 +110,6 @@
<module>spring-cloud-alicloud-ans</module>
<module>spring-cloud-alicloud-schedulerx</module>
<module>spring-cloud-alicloud-sms</module>
<module>spring-cloud-alibaba-coverage</module>
</modules>
<dependencyManagement>
@@ -184,15 +182,6 @@
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
-101
View File
@@ -1,101 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<parent>
<artifactId>spring-cloud-alibaba</artifactId>
<groupId>org.springframework.cloud</groupId>
<version>0.9.0.RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>spring-cloud-alibaba-coverage</artifactId>
<name>Spring Cloud Alibaba Coverage</name>
<properties>
<spring.cloud.alibaba.version>0.9.0.BUILD-SNAPSHOT</spring.cloud.alibaba.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba-dubbo</artifactId>
<version>${spring.cloud.alibaba.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba-nacos-config</artifactId>
<version>${spring.cloud.alibaba.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba-nacos-discovery</artifactId>
<version>${spring.cloud.alibaba.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba-sentinel</artifactId>
<version>${spring.cloud.alibaba.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba-sentinel-datasource</artifactId>
<version>${spring.cloud.alibaba.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alicloud-acm</artifactId>
<version>${spring.cloud.alibaba.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alicloud-ans</artifactId>
<version>${spring.cloud.alibaba.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alicloud-context</artifactId>
<version>${spring.cloud.alibaba.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-rocketmq</artifactId>
<version>${spring.cloud.alibaba.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba-seata</artifactId>
<version>${spring.cloud.alibaba.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<id>report-aggregate</id>
<phase>test</phase>
<goals>
<goal>report-aggregate</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/../target/site/jacoco</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>${maven-deploy-plugin.version}</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>
+2 -2
View File
@@ -6,12 +6,12 @@
<parent>
<artifactId>spring-cloud-dependencies-parent</artifactId>
<groupId>org.springframework.cloud</groupId>
<version>2.1.3.RELEASE</version>
<version>2.0.5.RELEASE</version>
<relativePath/>
</parent>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
<packaging>pom</packaging>
<name>Spring Cloud Alibaba Dependencies</name>
<description>Spring Cloud Alibaba Dependencies</description>
+1 -1
View File
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>
+3 -27
View File
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -15,8 +15,8 @@
<properties>
<dubbo.version>2.7.1</dubbo.version>
<spring-cloud-zookeeper.version>2.1.1.RELEASE</spring-cloud-zookeeper.version>
<spring-cloud-consul.version>2.1.1.RELEASE</spring-cloud-consul.version>
<spring-cloud-zookeeper.version>2.0.1.RELEASE</spring-cloud-zookeeper.version>
<spring-cloud-consul.version>2.0.2.RELEASE</spring-cloud-consul.version>
<curator.version>4.0.1</curator.version>
</properties>
@@ -235,28 +235,4 @@
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
@@ -93,4 +93,4 @@ public class IntrospectiveDubboMetadataService implements DubboMetadataService {
private DubboServiceMetadataRepository getRepository() {
return dubboServiceMetadataRepository.getIfAvailable();
}
}
}
@@ -5,7 +5,7 @@
<parent>
<artifactId>spring-cloud-alibaba-examples</artifactId>
<groupId>org.springframework.cloud</groupId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -5,7 +5,7 @@
<parent>
<artifactId>spring-cloud-alibaba-examples</artifactId>
<groupId>org.springframework.cloud</groupId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -29,12 +29,4 @@
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
@@ -5,7 +5,7 @@
<parent>
<artifactId>spring-cloud-alibaba-examples</artifactId>
<groupId>org.springframework.cloud</groupId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -25,12 +25,4 @@
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
@@ -5,7 +5,7 @@
<parent>
<artifactId>spring-cloud-alibaba-examples</artifactId>
<groupId>org.springframework.cloud</groupId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba-examples</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -1,26 +1,17 @@
package org.springframework.cloud.alibaba.cloud.examples;
import java.io.IOException;
import java.io.StringReader;
import java.util.Properties;
import java.util.concurrent.Executor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.alibaba.nacos.NacosConfigProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.nacos.api.config.listener.Listener;
/**
* @author xiaojing, Jianwei Mao
* @author xiaojing
*/
@SpringBootApplication
public class Application {
@@ -36,47 +27,13 @@ class SampleRunner implements ApplicationRunner {
@Value("${user.name}")
String userName;
@Value("${user.age:25}")
@Value("${user.age}")
int userAge;
@Autowired
private NacosConfigProperties nacosConfigProperties;
@Override
public void run(ApplicationArguments args) throws Exception {
System.out.println(
String.format("Initial username=%s, userAge=%d", userName, userAge));
nacosConfigProperties.configServiceInstance().addListener(
"nacos-config-example.properties", "DEFAULT_GROUP", new Listener() {
/**
* Callback with latest config data.
*
* For example, config data in Nacos is:
*
* user.name=Nacos user.age=25
*
* @param configInfo latest config data for specific dataId in Nacos
* server
*/
@Override
public void receiveConfigInfo(String configInfo) {
Properties properties = new Properties();
try {
properties.load(new StringReader(configInfo));
}
catch (IOException e) {
e.printStackTrace();
}
System.out.println("config changed: " + properties);
}
@Override
public Executor getExecutor() {
return null;
}
});
System.out.println(userName);
System.out.println(userAge);
}
}
@@ -87,8 +44,7 @@ class SampleController {
@Value("${user.name}")
String userName;
@Value("${user.age:25}")
@Value("${user.age}")
int age;
@RequestMapping("/user")
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>nacos-discovery-example</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -19,8 +19,8 @@ public class TestController {
@Autowired
private RestTemplate restTemplate;
@Autowired
private RestTemplate restTemplate1;
@Autowired
private RestTemplate restTemplate1;
@Autowired
private EchoService echoService;
@@ -28,20 +28,20 @@ public class TestController {
@Autowired
private DiscoveryClient discoveryClient;
// @PostConstruct
// public void init() {
// restTemplate1.setErrorHandler(new ResponseErrorHandler() {
// @Override
// public boolean hasError(ClientHttpResponse response) throws IOException {
// return false;
// }
//
// @Override
// public void handleError(ClientHttpResponse response) throws IOException {
// System.err.println("handle error");
// }
// });
// }
// @PostConstruct
// public void init() {
// restTemplate1.setErrorHandler(new ResponseErrorHandler() {
// @Override
// public boolean hasError(ClientHttpResponse response) throws IOException {
// return false;
// }
//
// @Override
// public void handleError(ClientHttpResponse response) throws IOException {
// System.err.println("handle error");
// }
// });
// }
@RequestMapping(value = "/echo-rest/{str}", method = RequestMethod.GET)
public String rest(@PathVariable String str) {
@@ -49,20 +49,20 @@ public class TestController {
String.class);
}
@RequestMapping(value = "/index", method = RequestMethod.GET)
public String index() {
return restTemplate1.getForObject("http://service-provider", String.class);
}
@RequestMapping(value = "/index", method = RequestMethod.GET)
public String index() {
return restTemplate1.getForObject("http://service-provider", String.class);
}
@RequestMapping(value = "/test", method = RequestMethod.GET)
public String test() {
return restTemplate1.getForObject("http://service-provider/test", String.class);
}
@RequestMapping(value = "/test", method = RequestMethod.GET)
public String test() {
return restTemplate1.getForObject("http://service-provider/test", String.class);
}
@RequestMapping(value = "/sleep", method = RequestMethod.GET)
public String sleep() {
return restTemplate1.getForObject("http://service-provider/sleep", String.class);
}
@RequestMapping(value = "/sleep", method = RequestMethod.GET)
public String sleep() {
return restTemplate1.getForObject("http://service-provider/sleep", String.class);
}
@RequestMapping(value = "/notFound-feign", method = RequestMethod.GET)
public String notFound() {
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>nacos-discovery-example</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -25,26 +25,25 @@ public class ProviderApplication {
@RestController
class EchoController {
@RequestMapping(value = "/", method = RequestMethod.GET)
public ResponseEntity index() {
return new ResponseEntity("index error", HttpStatus.INTERNAL_SERVER_ERROR);
}
@RequestMapping(value = "/", method = RequestMethod.GET)
public ResponseEntity index() {
return new ResponseEntity("index error", HttpStatus.INTERNAL_SERVER_ERROR);
}
@RequestMapping(value = "/test", method = RequestMethod.GET)
public ResponseEntity test() {
return new ResponseEntity("error", HttpStatus.INTERNAL_SERVER_ERROR);
}
@RequestMapping(value = "/test", method = RequestMethod.GET)
public ResponseEntity test() {
return new ResponseEntity("error", HttpStatus.INTERNAL_SERVER_ERROR);
}
@RequestMapping(value = "/sleep", method = RequestMethod.GET)
public String sleep() {
try {
Thread.sleep(1000L);
}
catch (InterruptedException e) {
e.printStackTrace();
}
return "ok";
}
@RequestMapping(value = "/sleep", method = RequestMethod.GET)
public String sleep() {
try {
Thread.sleep(1000L);
} catch (InterruptedException e) {
e.printStackTrace();
}
return "ok";
}
@RequestMapping(value = "/echo/{string}", method = RequestMethod.GET)
public String echo(@PathVariable String string) {
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba-examples</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -70,7 +70,7 @@
### 验证
#### 查询服务
在浏览器输入此地址 `http://127.0.0.1:8848/nacos/v1/ns/catalog/instances?serviceName=service-provider&clusterName=DEFAULT&pageSize=10&pageNo=1&namespaceId=`,并点击跳转,可以看到服务节点已经成功注册到 Nacos Server。
在浏览器输入此地址 `http://127.0.0.1:8848/nacos/v1/ns/instances?serviceName=service-provider`,并点击跳转,可以看到服务节点已经成功注册到 Nacos Server。
![查询服务](https://cdn.nlark.com/lark/0/2018/png/54319/1536986288092-5cf96af9-9a26-466b-85f6-39ad1d92dfdc.png)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>nacos-gateway-example</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>nacos-gateway-example</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba-examples</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba-examples</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>
+1 -1
View File
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba-examples</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba-examples</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -5,7 +5,7 @@
<parent>
<artifactId>spring-cloud-alibaba-examples</artifactId>
<groupId>org.springframework.cloud</groupId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -5,7 +5,7 @@
<parent>
<artifactId>spring-cloud-alibaba-examples</artifactId>
<groupId>org.springframework.cloud</groupId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -20,26 +20,17 @@ transport {
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
}
service {
#vgroup->rgroup
vgroup_mapping.account-service-fescar-service-group = "default"
vgroup_mapping.account-service-fescar-service-group = "localRgroup"
#only support single node
default.grouplist = "127.0.0.1:8091"
localRgroup.grouplist = "127.0.0.1:8091"
#degrade current not support
enableDegrade = false
#disable
disable = false
}
client {
async.commit.buffer.limit = 10000
lock {
@@ -1,5 +1,5 @@
registry {
# file 、nacos 、eureka、redis、zk、consul
# file 、nacos 、redis
type = "file"
nacos {
@@ -7,32 +7,17 @@ registry {
namespace = "public"
cluster = "default"
}
eureka {
serviceUrl = "http://localhost:1001/eureka"
application = "default"
weight = "1"
}
redis {
serverAddr = "localhost:6379"
db = "0"
}
zk {
cluster = "default"
serverAddr = "127.0.0.1:2181"
session.timeout = 6000
connect.timeout = 2000
}
consul {
cluster = "default"
serverAddr = "127.0.0.1:8500"
}
file {
name = "file.conf"
}
}
config {
# filenacos apollo、zk
# file nacos apollo
type = "file"
nacos {
@@ -44,12 +29,7 @@ config {
app.id = "fescar-server"
apollo.meta = "http://192.168.1.204:8801"
}
zk {
serverAddr = "127.0.0.1:2181"
session.timeout = 6000
connect.timeout = 2000
}
file {
name = "file.conf"
}
}
}
@@ -5,7 +5,7 @@
<parent>
<artifactId>spring-cloud-alibaba-examples</artifactId>
<groupId>org.springframework.cloud</groupId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -20,26 +20,17 @@ transport {
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
}
service {
#vgroup->rgroup
vgroup_mapping.business-service-fescar-service-group = "default"
vgroup_mapping.business-service-fescar-service-group = "localRgroup"
#only support single node
default.grouplist = "127.0.0.1:8091"
localRgroup.grouplist = "127.0.0.1:8091"
#degrade current not support
enableDegrade = false
#disable
disable = false
}
client {
async.commit.buffer.limit = 10000
lock {
@@ -1,5 +1,5 @@
registry {
# file 、nacos 、eureka、redis、zk、consul
# file 、nacos 、redis
type = "file"
nacos {
@@ -7,32 +7,17 @@ registry {
namespace = "public"
cluster = "default"
}
eureka {
serviceUrl = "http://localhost:1001/eureka"
application = "default"
weight = "1"
}
redis {
serverAddr = "localhost:6379"
db = "0"
}
zk {
cluster = "default"
serverAddr = "127.0.0.1:2181"
session.timeout = 6000
connect.timeout = 2000
}
consul {
cluster = "default"
serverAddr = "127.0.0.1:8500"
}
file {
name = "file.conf"
}
}
config {
# filenacos apollo、zk
# file nacos apollo
type = "file"
nacos {
@@ -44,12 +29,7 @@ config {
app.id = "fescar-server"
apollo.meta = "http://192.168.1.204:8801"
}
zk {
serverAddr = "127.0.0.1:2181"
session.timeout = 6000
connect.timeout = 2000
}
file {
name = "file.conf"
}
}
}
@@ -5,7 +5,7 @@
<parent>
<artifactId>spring-cloud-alibaba-examples</artifactId>
<groupId>org.springframework.cloud</groupId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -20,26 +20,17 @@ transport {
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
}
service {
#vgroup->rgroup
vgroup_mapping.order-service-fescar-service-group = "default"
vgroup_mapping.order-service-fescar-service-group = "localRgroup"
#only support single node
default.grouplist = "127.0.0.1:8091"
localRgroup.grouplist = "127.0.0.1:8091"
#degrade current not support
enableDegrade = false
#disable
disable = false
}
client {
async.commit.buffer.limit = 10000
lock {
@@ -1,5 +1,5 @@
registry {
# file 、nacos 、eureka、redis、zk、consul
# file 、nacos 、redis
type = "file"
nacos {
@@ -7,32 +7,17 @@ registry {
namespace = "public"
cluster = "default"
}
eureka {
serviceUrl = "http://localhost:1001/eureka"
application = "default"
weight = "1"
}
redis {
serverAddr = "localhost:6379"
db = "0"
}
zk {
cluster = "default"
serverAddr = "127.0.0.1:2181"
session.timeout = 6000
connect.timeout = 2000
}
consul {
cluster = "default"
serverAddr = "127.0.0.1:8500"
}
file {
name = "file.conf"
}
}
config {
# filenacos apollo、zk
# file nacos apollo
type = "file"
nacos {
@@ -44,12 +29,7 @@ config {
app.id = "fescar-server"
apollo.meta = "http://192.168.1.204:8801"
}
zk {
serverAddr = "127.0.0.1:2181"
session.timeout = 6000
connect.timeout = 2000
}
file {
name = "file.conf"
}
}
}
@@ -5,7 +5,7 @@
<parent>
<artifactId>spring-cloud-alibaba-examples</artifactId>
<groupId>org.springframework.cloud</groupId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -20,26 +20,17 @@ transport {
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
}
service {
#vgroup->rgroup
vgroup_mapping.storage-service-fescar-service-group = "default"
vgroup_mapping.storage-service-fescar-service-group = "localRgroup"
#only support single node
default.grouplist = "127.0.0.1:8091"
localRgroup.grouplist = "127.0.0.1:8091"
#degrade current not support
enableDegrade = false
#disable
disable = false
}
client {
async.commit.buffer.limit = 10000
lock {
@@ -1,5 +1,5 @@
registry {
# file 、nacos 、eureka、redis、zk、consul
# file 、nacos 、redis
type = "file"
nacos {
@@ -7,32 +7,17 @@ registry {
namespace = "public"
cluster = "default"
}
eureka {
serviceUrl = "http://localhost:1001/eureka"
application = "default"
weight = "1"
}
redis {
serverAddr = "localhost:6379"
db = "0"
}
zk {
cluster = "default"
serverAddr = "127.0.0.1:2181"
session.timeout = 6000
connect.timeout = 2000
}
consul {
cluster = "default"
serverAddr = "127.0.0.1:8500"
}
file {
name = "file.conf"
}
}
config {
# filenacos apollo、zk
# file nacos apollo
type = "file"
nacos {
@@ -44,12 +29,7 @@ config {
app.id = "fescar-server"
apollo.meta = "http://192.168.1.204:8801"
}
zk {
serverAddr = "127.0.0.1:2181"
session.timeout = 6000
connect.timeout = 2000
}
file {
name = "file.conf"
}
}
}
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba-examples</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba-examples</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba-examples</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba-examples</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -10,7 +10,7 @@
<parent>
<artifactId>spring-cloud-alibaba-examples</artifactId>
<groupId>org.springframework.cloud</groupId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
<relativePath>../pom.xml</relativePath>
</parent>
@@ -5,7 +5,7 @@
<parent>
<artifactId>spring-cloud-alibaba-examples</artifactId>
<groupId>org.springframework.cloud</groupId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -20,13 +20,12 @@
<module>spring-cloud-dubbo-provider-sample</module>
<module>spring-cloud-dubbo-consumer-sample</module>
<module>spring-cloud-dubbo-provider-web-sample</module>
<module>spring-cloud-dubbo-servlet-gateway-sample</module>
</modules>
<properties>
<dubbo.version>2.7.0</dubbo.version>
<spring-cloud-zookeeper.version>2.1.1.RELEASE</spring-cloud-zookeeper.version>
<spring-cloud-consul.version>2.1.1.RELEASE</spring-cloud-consul.version>
<spring-cloud-zookeeper.version>2.0.1.RELEASE</spring-cloud-zookeeper.version>
<spring-cloud-consul.version>2.0.2.RELEASE</spring-cloud-consul.version>
<curator.version>4.0.1</curator.version>
</properties>
@@ -5,7 +5,7 @@
<parent>
<artifactId>spring-cloud-alibaba-dubbo-examples</artifactId>
<groupId>org.springframework.cloud</groupId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -5,7 +5,7 @@
<parent>
<artifactId>spring-cloud-alibaba-dubbo-examples</artifactId>
<groupId>org.springframework.cloud</groupId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -5,7 +5,7 @@
<parent>
<artifactId>spring-cloud-alibaba-dubbo-examples</artifactId>
<groupId>org.springframework.cloud</groupId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -16,7 +16,7 @@ feign:
enabled: true
server:
port: 8080
port: 8888
management:
endpoints:
@@ -5,7 +5,7 @@
<parent>
<artifactId>spring-cloud-alibaba-dubbo-examples</artifactId>
<groupId>org.springframework.cloud</groupId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -1,47 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>
<artifactId>spring-cloud-alibaba-dubbo-examples</artifactId>
<groupId>org.springframework.cloud</groupId>
<version>0.9.0.RELEASE</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dubbo-servlet-gateway-sample</artifactId>
<name>Spring Cloud Dubbo Servlet Gateway Sample</name>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Sample API -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dubbo-sample-api</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Spring Cloud Open Feign -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
@@ -1,23 +0,0 @@
package org.springframework.cloud.alibaba.dubbo.bootstrap;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
/**
* Dubbo Spring Cloud Servlet Gateway Bootstrap
*/
@EnableDiscoveryClient
@EnableAutoConfiguration
@EnableFeignClients
@ServletComponentScan(basePackages = "org.springframework.cloud.alibaba.dubbo.gateway")
public class DubboSpringCloudServletGatewayBootstrap {
public static void main(String[] args) {
new SpringApplicationBuilder(DubboSpringCloudServletGatewayBootstrap.class)
.properties("spring.profiles.active=nacos")
.run(args);
}
}
@@ -1,181 +0,0 @@
package org.springframework.cloud.alibaba.dubbo.gateway;
import org.apache.dubbo.rpc.service.GenericException;
import org.apache.dubbo.rpc.service.GenericService;
import org.springframework.cloud.alibaba.dubbo.http.MutableHttpServerRequest;
import org.springframework.cloud.alibaba.dubbo.metadata.DubboRestServiceMetadata;
import org.springframework.cloud.alibaba.dubbo.metadata.RequestMetadata;
import org.springframework.cloud.alibaba.dubbo.metadata.RestMethodMetadata;
import org.springframework.cloud.alibaba.dubbo.metadata.repository.DubboServiceMetadataRepository;
import org.springframework.cloud.alibaba.dubbo.service.DubboGenericServiceExecutionContext;
import org.springframework.cloud.alibaba.dubbo.service.DubboGenericServiceExecutionContextFactory;
import org.springframework.cloud.alibaba.dubbo.service.DubboGenericServiceFactory;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpRequest;
import org.springframework.util.AntPathMatcher;
import org.springframework.util.PathMatcher;
import org.springframework.util.StreamUtils;
import org.springframework.web.servlet.HttpServletBean;
import org.springframework.web.util.UriComponents;
import javax.servlet.ServletException;
import javax.servlet.ServletInputStream;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import static org.apache.commons.lang3.StringUtils.substringAfter;
import static org.apache.commons.lang3.StringUtils.substringBetween;
import static org.springframework.web.util.UriComponentsBuilder.fromUriString;
@WebServlet(urlPatterns = "/dsc/*")
public class DubboGatewayServlet extends HttpServletBean {
private final DubboServiceMetadataRepository repository;
private final DubboGenericServiceFactory serviceFactory;
private final DubboGenericServiceExecutionContextFactory contextFactory;
private final PathMatcher pathMatcher = new AntPathMatcher();
private final Map<String, Object> dubboTranslatedAttributes = new HashMap<>();
public DubboGatewayServlet(DubboServiceMetadataRepository repository,
DubboGenericServiceFactory serviceFactory,
DubboGenericServiceExecutionContextFactory contextFactory) {
this.repository = repository;
this.serviceFactory = serviceFactory;
this.contextFactory = contextFactory;
dubboTranslatedAttributes.put("protocol", "dubbo");
dubboTranslatedAttributes.put("cluster", "failover");
}
private String resolveServiceName(HttpServletRequest request) {
// /g/{app-name}/{rest-path}
String requestURI = request.getRequestURI();
// /g/
String servletPath = request.getServletPath();
String part = substringAfter(requestURI, servletPath);
String serviceName = substringBetween(part, "/", "/");
return serviceName;
}
public void service(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
String serviceName = resolveServiceName(request);
String restPath = substringAfter(request.getRequestURI(), serviceName);
// 初始化 serviceName 的 REST 请求元数据
repository.initialize(serviceName);
// 将 HttpServletRequest 转化为 RequestMetadata
RequestMetadata clientMetadata = buildRequestMetadata(request, restPath);
DubboRestServiceMetadata dubboRestServiceMetadata = repository.get(serviceName, clientMetadata);
if (dubboRestServiceMetadata == null) {
// if DubboServiceMetadata is not found, executes next
throw new ServletException("DubboServiceMetadata can't be found!");
}
RestMethodMetadata dubboRestMethodMetadata = dubboRestServiceMetadata.getRestMethodMetadata();
GenericService genericService = serviceFactory.create(dubboRestServiceMetadata, dubboTranslatedAttributes);
// TODO: Get the Request Body from HttpServletRequest
byte[] body = getRequestBody(request);
MutableHttpServerRequest httpServerRequest = new MutableHttpServerRequest(new HttpRequestAdapter(request), body);
DubboGenericServiceExecutionContext context = contextFactory.create(dubboRestMethodMetadata, httpServerRequest);
Object result = null;
GenericException exception = null;
try {
result = genericService.$invoke(context.getMethodName(), context.getParameterTypes(), context.getParameters());
} catch (GenericException e) {
exception = e;
}
response.getWriter().println(result);
}
private byte[] getRequestBody(HttpServletRequest request) throws IOException {
ServletInputStream inputStream = request.getInputStream();
return StreamUtils.copyToByteArray(inputStream);
}
private static class HttpRequestAdapter implements HttpRequest {
private final HttpServletRequest request;
private HttpRequestAdapter(HttpServletRequest request) {
this.request = request;
}
@Override
public String getMethodValue() {
return request.getMethod();
}
@Override
public URI getURI() {
try {
return new URI(request.getRequestURL().toString() + "?" + request.getQueryString());
} catch (URISyntaxException e) {
e.printStackTrace();
}
throw new RuntimeException();
}
@Override
public HttpHeaders getHeaders() {
return new HttpHeaders();
}
}
private RequestMetadata buildRequestMetadata(HttpServletRequest request, String restPath) {
UriComponents uriComponents = fromUriString(request.getRequestURI()).build(true);
RequestMetadata requestMetadata = new RequestMetadata();
requestMetadata.setPath(restPath);
requestMetadata.setMethod(request.getMethod());
requestMetadata.setParams(getParams(request));
requestMetadata.setHeaders(getHeaders(request));
return requestMetadata;
}
private Map<String, List<String>> getHeaders(HttpServletRequest request) {
Map<String, List<String>> map = new LinkedHashMap<>();
Enumeration<String> headerNames = request.getHeaderNames();
while (headerNames.hasMoreElements()) {
String headerName = headerNames.nextElement();
Enumeration<String> headerValues = request.getHeaders(headerName);
map.put(headerName, Collections.list(headerValues));
}
return map;
}
private Map<String, List<String>> getParams(HttpServletRequest request) {
Map<String, List<String>> map = new LinkedHashMap<>();
for (Map.Entry<String, String[]> entry : request.getParameterMap().entrySet()) {
map.put(entry.getKey(), Arrays.asList(entry.getValue()));
}
return map;
}
}
@@ -1,12 +0,0 @@
dubbo:
registry:
# The Spring Cloud Dubbo's registry extension
address: spring-cloud://localhost
# The traditional Dubbo's registry
# address: zookeeper://127.0.0.1:2181
server:
port: 0
provider:
application:
name: spring-cloud-alibaba-dubbo-web-provider
@@ -1,70 +0,0 @@
spring:
application:
name: spring-cloud-alibaba-dubbo-servlet-gateway
main:
allow-bean-definition-overriding: true
# default disable all
cloud:
nacos:
discovery:
enabled: false
register-enabled: false
zookeeper:
enabled: false
consul:
enabled: false
eureka:
client:
enabled: false
ribbon:
nacos:
enabled: false
---
spring:
profiles: nacos
cloud:
nacos:
discovery:
enabled: true
register-enabled: true
server-addr: 127.0.0.1:8848
ribbon:
nacos:
enabled: true
---
spring:
profiles: eureka
eureka:
client:
enabled: true
service-url:
defaultZone: http://127.0.0.1:8761/eureka/
---
spring:
profiles: zookeeper
cloud:
zookeeper:
enabled: true
connect-string: 127.0.0.1:2181
---
spring:
profiles: consul
cloud:
consul:
enabled: true
host: 127.0.0.1
port: 8500
@@ -5,7 +5,7 @@
<parent>
<artifactId>spring-cloud-alibaba-examples</artifactId>
<groupId>org.springframework.cloud</groupId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -61,28 +61,4 @@
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
+1 -25
View File
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -96,28 +96,4 @@
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
+1 -25
View File
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -82,28 +82,4 @@
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
+1 -25
View File
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -102,28 +102,4 @@
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -98,29 +98,4 @@
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
+1 -1
View File
@@ -5,7 +5,7 @@
<parent>
<artifactId>spring-cloud-alibaba</artifactId>
<groupId>org.springframework.cloud</groupId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>
+1 -25
View File
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -144,28 +144,4 @@
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
@@ -95,7 +95,7 @@ public class SentinelInvocationHandler implements InvocationHandler {
+ Feign.configKey(method.getDeclaringClass(), method));
// resource default is HttpMethod:protocol://url
String resourceName = methodMetadata.template().method().toUpperCase() + ":"
+ hardCodedTarget.url() + methodMetadata.template().path();
+ hardCodedTarget.url() + methodMetadata.template().url();
Entry entry = null;
try {
ContextUtil.enter(resourceName);
@@ -107,7 +107,6 @@ public class SentinelAutoConfigurationTests {
private int port;
private String flowUrl = "http://localhost:" + port + "/flow";
private String degradeUrl = "http://localhost:" + port + "/degrade";
@Before
@@ -249,15 +248,14 @@ public class SentinelAutoConfigurationTests {
restTemplate.getInterceptors().size());
assertEquals("RestTemplateWithBlockClass interceptors size was wrong", 1,
restTemplateWithBlockClass.getInterceptors().size());
ResponseEntity responseEntityBlock = restTemplateWithBlockClass
.getForEntity(flowUrl, String.class);
ResponseEntity responseEntityBlock = restTemplateWithBlockClass.getForEntity(flowUrl,
String.class);
assertEquals("RestTemplateWithBlockClass Sentinel Block Message was wrong",
"Oops", responseEntityBlock.getBody());
assertEquals(
"RestTemplateWithBlockClass Sentinel Block Http Status Code was wrong",
HttpStatus.OK, responseEntityBlock.getStatusCode());
ResponseEntity responseEntityRaw = restTemplate.getForEntity(flowUrl,
String.class);
ResponseEntity responseEntityRaw = restTemplate.getForEntity(flowUrl, String.class);
assertEquals("RestTemplate Sentinel Block Message was wrong",
"RestTemplate request block by sentinel", responseEntityRaw.getBody());
assertEquals("RestTemplate Sentinel Block Http Status Code was wrong",
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba-test</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>
+1 -1
View File
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba-test</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>
+1 -25
View File
@@ -7,7 +7,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
</parent>
<artifactId>spring-cloud-alicloud-acm</artifactId>
@@ -83,29 +83,5 @@
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
+1 -25
View File
@@ -5,7 +5,7 @@
<parent>
<artifactId>spring-cloud-alibaba</artifactId>
<groupId>org.springframework.cloud</groupId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -118,28 +118,4 @@
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
+2 -26
View File
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -119,7 +119,7 @@
<version>2.0.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
@@ -128,28 +128,4 @@
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
+1 -26
View File
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -60,29 +60,4 @@
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
+1 -25
View File
@@ -5,7 +5,7 @@
<parent>
<artifactId>spring-cloud-alibaba</artifactId>
<groupId>org.springframework.cloud</groupId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>spring-cloud-alicloud-schedulerx</artifactId>
@@ -50,28 +50,4 @@
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
+1 -25
View File
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -75,29 +75,5 @@
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
+1 -1
View File
@@ -4,7 +4,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>spring-cloud-starter-alibaba</artifactId>
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
</parent>
<artifactId>spring-cloud-starter-alibaba-nacos-config-server</artifactId>
<name>Spring Cloud Starter Alibaba Nacos Config Server</name>
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
</parent>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
<name>Spring Cloud Starter Alibaba Nacos Config</name>
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
</parent>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
<name>Spring Cloud Starter Alibaba Nacos Discovery</name>
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
</parent>
<artifactId>spring-cloud-starter-alibaba-seata</artifactId>
<name>Spring Cloud Starter Alibaba Seata</name>
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
</parent>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
<name>Spring Cloud Starter Alibaba Sentinel</name>
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>spring-cloud-starter-stream-rocketmq</artifactId>
+1 -1
View File
@@ -4,7 +4,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
</parent>
<artifactId>spring-cloud-starter-alicloud</artifactId>
<packaging>pom</packaging>
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-alicloud</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
</parent>
<artifactId>spring-cloud-starter-alicloud-acm</artifactId>
<name>Spring Cloud Starter Alibaba Cloud ACM</name>
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-alicloud</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
</parent>
<artifactId>spring-cloud-starter-alicloud-ans</artifactId>
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-alicloud</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
</parent>
<artifactId>spring-cloud-starter-alicloud-oss</artifactId>
<name>Spring Cloud Starter Alibaba Cloud OSS</name>
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-alicloud</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
</parent>
<artifactId>spring-cloud-starter-alicloud-schedulerx</artifactId>
<name>Spring Cloud Starter Alibaba Cloud SchedulerX</name>
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-alicloud</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
</parent>
<artifactId>spring-cloud-starter-alicloud-sms</artifactId>
<name>Spring Cloud Starter Alibaba Cloud SMS</name>
+1 -25
View File
@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba</artifactId>
<version>0.9.0.RELEASE</version>
<version>0.2.2.RELEASE</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -64,29 +64,5 @@
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
@@ -27,7 +27,6 @@ import org.apache.rocketmq.spring.autoconfigure.RocketMQProperties;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.apache.rocketmq.spring.support.RocketMQUtil;
import org.springframework.cloud.stream.binder.AbstractMessageChannelBinder;
import org.springframework.cloud.stream.binder.BinderSpecificPropertiesProvider;
import org.springframework.cloud.stream.binder.ExtendedConsumerProperties;
import org.springframework.cloud.stream.binder.ExtendedProducerProperties;
import org.springframework.cloud.stream.binder.ExtendedPropertiesBinder;
@@ -57,8 +56,7 @@ public class RocketMQMessageChannelBinder extends
implements
ExtendedPropertiesBinder<MessageChannel, RocketMQConsumerProperties, RocketMQProducerProperties> {
private RocketMQExtendedBindingProperties extendedBindingProperties = new RocketMQExtendedBindingProperties();
private final RocketMQExtendedBindingProperties extendedBindingProperties;
private final RocketMQBinderConfigurationProperties rocketBinderConfigurationProperties;
private final RocketMQProperties rocketMQProperties;
private final InstrumentationManager instrumentationManager;
@@ -71,10 +69,10 @@ public class RocketMQMessageChannelBinder extends
RocketMQProperties rocketMQProperties,
InstrumentationManager instrumentationManager) {
super(null, provisioningProvider);
this.extendedBindingProperties = extendedBindingProperties;
this.rocketBinderConfigurationProperties = rocketBinderConfigurationProperties;
this.rocketMQProperties = rocketMQProperties;
this.instrumentationManager = instrumentationManager;
this.extendedBindingProperties = extendedBindingProperties;
}
@Override
@@ -83,7 +81,7 @@ public class RocketMQMessageChannelBinder extends
MessageChannel errorChannel) throws Exception {
if (producerProperties.getExtension().getEnabled()) {
// if producerGroup is empty, using destination
// if producerGroup is empty, using destination
String extendedProducerGroup = producerProperties.getExtension().getGroup();
String producerGroup = StringUtils.isEmpty(extendedProducerGroup)
? destination.getName()
@@ -220,19 +218,4 @@ public class RocketMQMessageChannelBinder extends
return topicInUse;
}
@Override
public String getDefaultsPrefix() {
return extendedBindingProperties.getDefaultsPrefix();
}
@Override
public Class<? extends BinderSpecificPropertiesProvider> getExtendedPropertiesEntryClass() {
return extendedBindingProperties.getExtendedPropertiesEntryClass();
}
public void setExtendedBindingProperties(
RocketMQExtendedBindingProperties extendedBindingProperties) {
this.extendedBindingProperties = extendedBindingProperties;
}
}
@@ -68,7 +68,6 @@ public class RocketMQBinderAutoConfiguration {
provisioningProvider, extendedBindingProperties,
rocketBinderConfigurationProperties, rocketMQProperties,
instrumentationManager);
binder.setExtendedBindingProperties(extendedBindingProperties);
return binder;
}
@@ -67,9 +67,9 @@ public class RocketMQComponent4BinderAutoConfiguration {
else {
producer = new DefaultMQProducer(RocketMQBinderConstants.DEFAULT_GROUP);
}
if(StringUtils.isEmpty(configNameServer)) {
configNameServer = RocketMQBinderConstants.DEFAULT_NAME_SERVER;
}
if (StringUtils.isEmpty(configNameServer)) {
configNameServer = RocketMQBinderConstants.DEFAULT_NAME_SERVER;
}
producer.setNamesrvAddr(configNameServer);
return producer;
}
@@ -16,19 +16,16 @@
package org.springframework.cloud.stream.binder.rocketmq.properties;
import org.springframework.cloud.stream.binder.BinderSpecificPropertiesProvider;
/**
* @author Timur Valiev
* @author <a href="mailto:fangjian0423@gmail.com">Jim</a>
*/
public class RocketMQBindingProperties implements BinderSpecificPropertiesProvider {
public class RocketMQBindingProperties {
private RocketMQConsumerProperties consumer = new RocketMQConsumerProperties();
private RocketMQProducerProperties producer = new RocketMQProducerProperties();
@Override
public RocketMQConsumerProperties getConsumer() {
return consumer;
}
@@ -37,7 +34,6 @@ public class RocketMQBindingProperties implements BinderSpecificPropertiesProvid
this.consumer = consumer;
}
@Override
public RocketMQProducerProperties getProducer() {
return producer;
}
@@ -16,27 +16,71 @@
package org.springframework.cloud.stream.binder.rocketmq.properties;
import java.util.HashMap;
import java.util.Map;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.stream.binder.AbstractExtendedBindingProperties;
import org.springframework.cloud.stream.binder.BinderSpecificPropertiesProvider;
import org.springframework.cloud.stream.binder.ExtendedBindingProperties;
/**
* @author Timur Valiev
* @author <a href="mailto:fangjian0423@gmail.com">Jim</a>
*/
@ConfigurationProperties("spring.cloud.stream.rocketmq")
public class RocketMQExtendedBindingProperties extends
AbstractExtendedBindingProperties<RocketMQConsumerProperties, RocketMQProducerProperties, RocketMQBindingProperties> {
public class RocketMQExtendedBindingProperties implements
ExtendedBindingProperties<RocketMQConsumerProperties, RocketMQProducerProperties> {
private static final String DEFAULTS_PREFIX = "spring.cloud.stream.rocketmq.default";
private Map<String, RocketMQBindingProperties> bindings = new HashMap<>();
@Override
public String getDefaultsPrefix() {
return DEFAULTS_PREFIX;
public Map<String, RocketMQBindingProperties> getBindings() {
return this.bindings;
}
public void setBindings(Map<String, RocketMQBindingProperties> bindings) {
this.bindings = bindings;
}
@Override
public Class<? extends BinderSpecificPropertiesProvider> getExtendedPropertiesEntryClass() {
return RocketMQBindingProperties.class;
public synchronized RocketMQConsumerProperties getExtendedConsumerProperties(
String channelName) {
if (bindings.containsKey(channelName)) {
if (bindings.get(channelName).getConsumer() != null) {
return bindings.get(channelName).getConsumer();
}
else {
RocketMQConsumerProperties properties = new RocketMQConsumerProperties();
this.bindings.get(channelName).setConsumer(properties);
return properties;
}
}
else {
RocketMQConsumerProperties properties = new RocketMQConsumerProperties();
RocketMQBindingProperties rbp = new RocketMQBindingProperties();
rbp.setConsumer(properties);
bindings.put(channelName, rbp);
return properties;
}
}
@Override
public synchronized RocketMQProducerProperties getExtendedProducerProperties(
String channelName) {
if (bindings.containsKey(channelName)) {
if (bindings.get(channelName).getProducer() != null) {
return bindings.get(channelName).getProducer();
}
else {
RocketMQProducerProperties properties = new RocketMQProducerProperties();
this.bindings.get(channelName).setProducer(properties);
return properties;
}
}
else {
RocketMQProducerProperties properties = new RocketMQProducerProperties();
RocketMQBindingProperties rbp = new RocketMQBindingProperties();
rbp.setProducer(properties);
bindings.put(channelName, rbp);
return properties;
}
}
}