Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
<modelVersion>4.0.0</modelVersion>

<groupId>io.github.forezp</groupId>
<artifactId>local-rpc-lient</artifactId>
<artifactId>local-rpc-client</artifactId>
<version>1.0.6</version>
<packaging>jar</packaging>

<name>local-rpc-lient</name>
<name>local-rpc-client</name>
<description>Demo project for Spring Boot</description>

<parent>
Expand All @@ -30,19 +29,16 @@
<groupId>io.github.forezp</groupId>
<artifactId>boot-netty-rpc-core</artifactId>
<version>${netty.rpc.core}</version>

</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.forezp.localrpclient.client.IGreeting;
import io.github.forezp.netty.rpc.core.annotation.EnableNettyRpc;
import io.github.forezp.netty.rpc.core.common.dto.RespDTO;

import io.github.forezp.netty.rpc.core.monitor.trace.MonitorMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
Expand All @@ -20,22 +19,20 @@
public class LocalRpcLientApplication {

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


@Autowired
IGreeting greeting;

@GetMapping("/test")
public RespDTO test() throws Exception {

// IGreeting invoker = (IGreeting) Invoker.invoke( IGreeting.class );
// Object result = invoker.sayHello( "sww" );

Object object = greeting.sayHello( "hi" );

return RespDTO.success( object );
//调用服务端sayHello()方法
Object object = greeting.sayHello("zhangsan");
return RespDTO.success(object);
}

@PostMapping("/postmsg")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
public interface IGreeting {

String sayHello(String name);

}
31 changes: 31 additions & 0 deletions examples/local-rpc-client/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
server:
port: 7002

netty:
clients:
-
name: server
host: localhost
port: 6001
-
name: server
host: localhost
port: 6001


spring:
application:
name: client


monitor:
mail:
enable:
ssl: false
host: smtp.163.com
password: yourpassword
username: miles02
from: [email protected]
to: [email protected]
cc: [email protected] #抄送
bcc: [email protected] #密送
21 changes: 0 additions & 21 deletions examples/local-rpc-lient/src/main/resources/application.yml

This file was deleted.

7 changes: 0 additions & 7 deletions examples/local-rpc-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<artifactId>local-rpc-server</artifactId>
<version>1.0.5</version>
<packaging>jar</packaging>

<name>local-rpc-server</name>
<description>Demo project for Spring Boot</description>

Expand All @@ -34,7 +33,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
Expand All @@ -44,15 +42,10 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>


<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>



</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@


import io.github.forezp.netty.rpc.core.annotation.EnableNettyRpc;
import io.github.forezp.netty.rpc.core.monitor.warm.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
Expand All @@ -19,9 +17,8 @@ public static void main(String[] args) {
SpringApplication.run( LocalRpcServerApplication.class, args );
}



@GetMapping("/test")
public void test() {
public String test() {
return "server : test";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@
**/
@Service
public class Greeting implements IGreeting {

@Override
public String sayHello(String name) {
return "hi "+name;
System.out.println("server: Client message received {"+name+"}");
return "hi " + name;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
public interface IGreeting {

String sayHello(String name);

}
35 changes: 18 additions & 17 deletions examples/local-rpc-server/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
server:
port: 7001

netty.server.name: server
netty.server.port: 6001
netty:
server:
name: server
port: 6001


spring:
application:
name: server

redis:
host: localhost
port: 6379
# password: ee
#password: ee
database: 1
pool:
max-active: 8
Expand All @@ -20,19 +22,18 @@ spring:
min-idle: 0
timeout: 0


monitor:
#type: redis
type: http
url: http://localhost:7002/postmsg

#monitor:
# type: redis

monitor.mail.enable: false
monitor.mail.host: smtp.163.com
monitor.mail.username: miles02
monitor.mail.password: yourpassword
monitor.mail.enable.ssl:
monitor.mail.from: [email protected]
monitor.mail.to: [email protected]
monitor.mail.cc: [email protected]
monitor.mail.bcc: [email protected]
mail:
enable:
ssl: false
host: smtp.163.com
password: yourpassword
username: miles02
from: [email protected]
to: [email protected]
cc: [email protected] #抄送
bcc: [email protected] #密送
6 changes: 1 addition & 5 deletions examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@
<packaging>pom</packaging>

<modules>

<module>example-rpc-lib</module>
<module>example-eureka-server</module>
<module>example-rpc-server</module>
<module>example-rpc-client</module>
<module>local-rpc-lient</module>
<module>local-rpc-client</module>
<module>local-rpc-server</module>
</modules>

Expand All @@ -35,14 +34,12 @@
<scope>import</scope>
</dependency>


<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${spring-boot.version}</version>
</dependency>


<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
Expand All @@ -67,7 +64,6 @@
<scope>test</scope>
<version>${spring-boot.version}</version>
</dependency>

</dependencies>
</dependencyManagement>

Expand Down