Giter VIP home page Giter VIP logo

saluki's Introduction

概述

saluki是以Grpc作为底层,提供一套高性能、易于使用的分布式远程服务调用(RPC)框架

功能

  • 服务注册及发现,提供集群环境的服务发现及治理能力
  • 服务路由,基于javascript路由规则配置及host的路由规则配置
  • 熔断机及隔离,基于hystrix来进行的熔断、隔离
  • 简化开发方式,对于Grpc原生stub方式进行封装,提供了使用interface和java Bean作为服务契约的方式
  • 与spring-boot进行集成,提供了autoconfig的方式

详细说明

  • saluki-plugin提供的插件可以在grpc插件基础上生成interface及java bean
  • saluki-serializer提供了将protobuf与java bean两者对象互相转换
  • saluki-registry提供了服务注册,可以在此扩展,目前仅支持consul

Compile

   mvn install -Dmaven.test.skip=true
   

Quick Start

  • 首先在proto文件工程配置grpc提供的gradle货maven插件生成stub
<build>
  <extensions>
    <extension>
      <groupId>kr.motd.maven</groupId>
      <artifactId>os-maven-plugin</artifactId>
      <version>1.4.1.Final</version>
    </extension>
  </extensions>
  <plugins>
    <plugin>
      <groupId>org.xolstice.maven.plugins</groupId>
      <artifactId>protobuf-maven-plugin</artifactId>
      <version>0.5.0</version>
      <configuration>
        <protocArtifact>com.google.protobuf:protoc:3.0.2:exe:${os.detected.classifier}</protocArtifact>
        <pluginId>grpc-java</pluginId>
        <pluginArtifact>io.grpc:protoc-gen-grpc-java:1.2.0:exe:${os.detected.classifier}</pluginArtifact>
      </configuration>
      <executions>
        <execution>
          <goals>
            <goal>compile</goal>
            <goal>compile-custom</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

  • 再次添加saluki提供的gradle或maven插件根据protoc文件生成interface及pojo模型
<dependency>
	<groupId>com.quancheng.saluki</groupId>
	<artifactId>saluki-core</artifactId>
	<version>1.5.3-SNAPSHOT</version>
	<scope>provided</scope>
</dependency>

<plugin>
	<groupId>com.quancheng.saluki</groupId>
	<artifactId>saluki-maven-plugin</artifactId>
	<version>1.5.3-SNAPSHOT</version>
	<configuration>
		<protoPath>src/main/proto</protoPath>
		<buildPath>target/generated-sources/protobuf/java</buildPath>
	</configuration>
	<executions>
		<execution>
			<goals>
				<goal>proto2java</goal>
			</goals>
		</execution>
	</executions>
</plugin>

  • 应用上两步生成的artifactId,添加spring-boot-saluki依赖
<dependency>
	<groupId>com.quancheng.saluki</groupId>
	<artifactId>spring-boot-starter-saluki</artifactId>
	<version>1.5.3-SNAPSHOT</version>
</dependency>
<dependency>
	<groupId>com.quancheng.saluki</groupId>
	<artifactId>spring-boot-starter-saluki-monitor</artifactId>
	<version>1.5.3-SNAPSHOT</version>
</dependency>
  • 启动spring boot main,并访问localhost:8080/doc,可进行服务测试 login

saluki's People

Contributors

shiming avatar linking12 avatar jiaoge avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.