YRPC is a highly scalable, high performance, Java RPC framework.
- Transparent and High Performance Remote Service Call
- Support multiple service routing and load balancing strategies
- Support for Zookeeper Center Integration
- Supporting multiple protocols
- Support synchronization, one-way and other invocation methods
Compilation requires JDK 8 and above, Maven 3.2.5 and above.
Operation requirements JDK 8 and above.
<dependency>
<groupId>cn.yukonga</groupId>
<artifactId>yrpc-spring-boot-starter</artifactId>
<version>1.1.RELEASE</version>
</dependency>
yrpc:
zookeeper:
address: 193.112.100.103:2181
rootPath: /yRpc
sessionTimeOut: 10000
netty:
port: 8989
host: 127.0.0.1
@SpringBootApplication
@EnableYRpc
public class YrpcConsumerApplication {
public static void main(String[] args) {
SpringApplication.run(YrpcConsumerApplication.class, args);
}
}
public interface TestService {
String say();
}
@RemoteService(TestService.class)
public class TestServiceImpl implements TestService {
@Override
public String say() {
return "zzz";
}
}
Pass through@RemoteService(TestService.class)
Designated as a service provider, where Annotated value
is the interface to the implementation,isProxyTargetClass
select proxy mode for use。
@RemoteReference
TestService testService;
@RequestMapping("/index")
public String say() {
return testService.say();
}
It can be injected through @RemoteReference
.