GithubHelp home page GithubHelp logo

davidmr001 / go-chassis Goto Github PK

View Code? Open in Web Editor NEW

This project forked from go-chassis/go-chassis

0.0 1.0 0.0 475 KB

Go-Chassis is a Software Development Kit(SDK) for rapid development of microservices in Go

License: Apache License 2.0

Go 99.56% Shell 0.44%

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

Inspired by Go-Micro A pluggable RPC framework for distributed systems development.

Go-chassis is not a enhancement based on it, but did something more

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
  • Load balancing: You can 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.cn/

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

asifdxtreme avatar humingcheng avatar ninotia avatar thandayuthapani avatar tianxiaoliang avatar wangkirin avatar zenlint avatar

Watchers

 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.