Skip to content

Latest commit

 

History

History
93 lines (71 loc) · 2.52 KB

README.MD

File metadata and controls

93 lines (71 loc) · 2.52 KB

YRPC

中文文档

YRPC is a highly scalable, high performance, Java RPC framework.

Functional

  • 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

Required

Compilation requires JDK 8 and above, Maven 3.2.5 and above.

Operation requirements JDK 8 and above.

Quick start

Dependence

    <dependency>
        <groupId>cn.yukonga</groupId>
        <artifactId>yrpc-spring-boot-starter</artifactId>
        <version>1.1.RELEASE</version>
    </dependency>

Configure port registry address

    yrpc:
      zookeeper:
        address: 193.112.100.103:2181
        rootPath: /yRpc
        sessionTimeOut: 10000
      netty:
        port: 8989
        host: 127.0.0.1

Enable automatic config

@SpringBootApplication
@EnableYRpc
public class YrpcConsumerApplication {

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

Defined Service Interface

    public interface TestService {
       String say();
    }

Provider Service Implement

    @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 valueis the interface to the implementation,isProxyTargetClass select proxy mode for use。

Consumer service

    @RemoteReference
    TestService testService;

    @RequestMapping("/index")
    public String say() {
        return testService.say();
    }

It can be injected through @RemoteReference.