Giter Club home page Giter Club logo

go-chassis's Introduction

Go-chassis

Build Status Coverage Status Go-Chassis is a Software Development Kit(SDK) for rapid development of microservices in GoLang, providing service-discovery, fault-tolerance, circuit breaker, load balancing, monitoring, hot-reconfiguration features

Go-chassis is based on Go-Micro A pluggable RPC framework, and did some enhancements.

Features

  • Pluggable registry: Support Service center and file based registry by default
  • Dynamic Configuration framework: you are able to develop a service which has hot-reconfiguration feature easily
  • Pluggable Protocol: You can custom your own protocol,by default support http and highway(RPC)
  • Circuit breaker: Protect your service in runtime or on-demand
  • Routing management: Able to route to different service based on weight and match rule to achieve Canary Release easily
  • Load balancing: Add custom strategy and filter
  • Rate limiting: Both client side and server side rate limiting
  • Pluggable Cipher: Able to custom your own cipher for AKSK and TLS certs
  • Handler Chain: Able to add your own code during service calling for client and server side
  • Metrics: Able to expose Prometheus metric API automatically and sink metrics to CSE Dashboard
  • Tracing: Integrate with Zipkin and namedpipe to sink tracing data
  • Logger: You can custom your own writer to sink log, by default support file and stdout
  • Hot-reconfiguraion: A lot of configuration can be reload in runtime, like loadbalancing, circuit breaker, rate limiting

Quick Start

You can see more informations in gitbook https://go.huaweicse.com/

Write a http service provider

Step 1: Define your Schema and your business logic.

//API
func (s *HelloServer) SayHello(b *restful.Context) {
	b.Write([]byte("Hello : Welcome to Go-Chassis."))
}
//Specify URL pattern
func (s *HelloServer) URLPatterns() []restful.Route {
	return []restful.Route{
		{http.MethodGet, "/sayhello", "SayHello"},
	}
}

Step 2: Register your Schema to go-chassis

chassis.RegisterSchema("rest", &HelloServer{},server.WithSchemaID("HelloServer"))

Step 3: Start the Chassis as a Server

chassis.Init()
chassis.Run()

Write a Http Consumer

Step 1: Initialize your Chassis

chassis.Init()

Step 2: Use Rest Invoker to call the provider

restInvoker := core.NewRestInvoker()
req, _ := rest.NewRequest("GET", "cse://"+providerName+"/sayhello")
resp1, err := restInvoker.ContextDo(context.TODO(), req)

Examples

You can check examples here

Communication Protocols

Go-Chassis supports two types of communication protocol.

  1. Rest - REST is an approach that leverages the HTTP protocol for communication.
  2. Highway - This is a high performance communication protocol originally developed by Huawei.

go-chassis's People

Contributors

tianxiaoliang avatar humingcheng avatar asifdxtreme avatar wangkirin avatar thandayuthapani avatar willemjiang avatar ninotia avatar ninokop avatar heppu avatar zenlint avatar gauthamiv avatar savitaashture avatar zqheng avatar

Watchers

 avatar  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.