Skip to content

Commit

Permalink
add config-man test by ipman
Browse files Browse the repository at this point in the history
  • Loading branch information
ipipman committed May 5, 2024
1 parent 594bb7d commit 6eaf86c
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 5 deletions.
6 changes: 5 additions & 1 deletion demo.http
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ GET http://localhost:8088/api/?id=101
### 用于测试探活
GET http://localhost:8081/ports?ports=8082

### 用于测试Apollo配置更新
### 用于测试Apollo配置中心的更新
GET http://localhost:8081/metas

### 测试config-man配置中心, 作者:ipman
GET http://localhost:8081/demo-config

### 获取用户信息
POST http://192.168.31.232:9081/rpcman
Content-Type: application/json
Expand All @@ -29,3 +32,4 @@ Content-Type: application/json
"methodSign": "findById@2_int_java.lang.String",
"args": [200, "ipman"]
}

4 changes: 2 additions & 2 deletions rpcman-demo-consumer/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ server:
rpcman:
#providers: http://localhost:8080,http://localhost:8081,http://localhost:8082
zk:
enabled: false
enabled: true
zkServer: localhost:2181
zkRoot: rpcman

Expand Down Expand Up @@ -39,7 +39,7 @@ apollo:

# 作者手写的注册中心:https://github.com/ipipman/registry-man
registry-ipman:
enabled: true
enabled: false
servers: http://localhost:8484

logging:
Expand Down
6 changes: 6 additions & 0 deletions rpcman-demo-provider/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.github.ipipman</groupId>
<artifactId>config-client</artifactId>
<version>0.0.1</version>
</dependency>

</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,36 @@
@Import({ProviderConfig.class, RegistryCenterConfig.class})
@EnableApolloConfig
@Slf4j
//@EnableIpManConfig
public class RpcmanDemoProviderApplication {

// @Bean
// ApolloChangedListener apolloChangedListener() {
// return new ApolloChangedListener();
// }


public static void main(String[] args) {
SpringApplication.run(RpcmanDemoProviderApplication.class, args);
}

@Autowired
private UserService userService;


// ---------- 测试config-man配置中心, 作者:ipman ---------
// @Autowired
// private DemoConfig demoConfig;
//
// @GetMapping("/demo-config")
// public String demo() {
// return "ipman.demo.a = " + demoConfig.getA() + ", \n" +
// "ipman.demo.b = " + demoConfig.getB() + ", \n" +
// "ipman.demo.c = " + demoConfig.getC() + ", \n";
// }
//
// ---------- 测试config-man配置中心, 作者:ipman ---------

@RequestMapping("/ports")
public RpcResponse<String> ports(@RequestParam("ports") String ports) {
userService.setTimeoutPorts(ports);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package cn.ipman.rpc.demo.provider.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
* 测试config-man配置中心, 作者:ipman
*
* @Author IpMan
* @Date 2024/5/3 21:24
*/
//@Data
//@Configuration
//@ConfigurationProperties(prefix = "ipman")
//public class DemoConfig {
//
// private String a;
// private String b;
// private String c;
//
//}
4 changes: 2 additions & 2 deletions rpcman-demo-provider/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ server:

rpcman:
zk:
enabled: false
enabled: true
zkServer: localhost:2181
zkRoot: rpcman

Expand Down Expand Up @@ -38,7 +38,7 @@ apollo:

# 作者手写的注册中心:https://github.com/ipipman/registry-man
registry-ipman:
enabled: true
enabled: false
servers: http://localhost:8484

logging:
Expand Down

0 comments on commit 6eaf86c

Please sign in to comment.