All Projects → FollowmeTech → fm.consulinterop

FollowmeTech / fm.consulinterop

Licence: MIT license
a lib for build micro-service

Programming Languages

C#
18002 projects
powershell
5483 projects

Projects that are alternatives of or similar to fm.consulinterop

Javaspringbootsamples
SpringBoot、Dubbo、SpringCloud的各种集成例子:Atomikos、gRPC、Thrift、Seata、ShardingSphere、Dubbo、Hmily、Nacos、Consul、Ribbon、Jedis、Lettuce、Redisson等框架
Stars: ✭ 399 (+1109.09%)
Mutual labels:  consul, grpc
Hyperf
🚀 A coroutine framework that focuses on hyperspeed and flexibility. Building microservice or middleware with ease.
Stars: ✭ 4,206 (+12645.45%)
Mutual labels:  consul, grpc
Surging
Surging is a micro-service engine that provides a lightweight, high-performance, modular RPC request pipeline. The service engine supports http, TCP, WS,Grpc, Thrift,Mqtt, UDP, and DNS protocols. It uses ZooKeeper and Consul as a registry, and integrates it. Hash, random, polling, Fair Polling as a load balancing algorithm, built-in service gove…
Stars: ✭ 3,088 (+9257.58%)
Mutual labels:  consul, grpc
Core Grpc
C# Grpc驱动封装,基于Consul实现服务注册服务发现,支持dotnetcore / framework,可快速实现基于Grpc的微服务,内部有完整案例,包含服务端Server 客户端 Client,core+grpc, netcore+grpc, dotnetcore+grpc
Stars: ✭ 209 (+533.33%)
Mutual labels:  consul, grpc
Abp.grpc
基于 ABP 框架开发的 Grpc 模块,支持 Consul 服务发现与服务注册。Grpc module developed based on ABP framework supports early service discovery and service registration.
Stars: ✭ 134 (+306.06%)
Mutual labels:  consul, grpc
Familybucket
集合.net core、ocelot、consul、netty、rpc、eventbus、configserver、tracing、sqlsugar、vue-admin、基础管理平台等构建的微服务一条龙应用
Stars: ✭ 629 (+1806.06%)
Mutual labels:  consul, grpc
Go Project Sample
Introduce the best practice experience of Go project with a complete project example.通过一个完整的项目示例介绍Go语言项目的最佳实践经验.
Stars: ✭ 344 (+942.42%)
Mutual labels:  consul, grpc
Go Micro Services
HTTP up front, Protobufs in the rear
Stars: ✭ 853 (+2484.85%)
Mutual labels:  consul, grpc
Ketchup
ketchup (番茄酱) 是一个基于dotnet core的微服务框架。
Stars: ✭ 170 (+415.15%)
Mutual labels:  consul, grpc
Sitko.Core
Sitko.Core is a set of libraries to help build .NET Core applications fast
Stars: ✭ 46 (+39.39%)
Mutual labels:  consul, grpc
protoc-gen-grpc-gateway-ts
protoc-gen-grpc-gateway-ts is a Typescript client generator for the grpc-gateway project. It generates idiomatic Typescript clients that connect the web frontend and golang backend fronted by grpc-gateway.
Stars: ✭ 68 (+106.06%)
Mutual labels:  grpc
sisyphus
Sisyphus is the way how we provide backend services.
Stars: ✭ 59 (+78.79%)
Mutual labels:  grpc
n0stack
A simple cloud provider using gRPC
Stars: ✭ 51 (+54.55%)
Mutual labels:  grpc
run-aspnet-grpc
Using gRPC in Microservices for Building a high-performance Interservice Communication with .Net 5. See gRPC Microservices and Step by Step Implementation on .NET Course w/ discount->
Stars: ✭ 82 (+148.48%)
Mutual labels:  grpc
mrcnn serving ready
🛠 Mask R-CNN Keras to Tensorflow and TFX models + Serving models using TFX GRPC & RESTAPI
Stars: ✭ 96 (+190.91%)
Mutual labels:  grpc
grpc-getting-started
Guide to get started with gRPC in Cisco IOS XR
Stars: ✭ 32 (-3.03%)
Mutual labels:  grpc
agrpc
Async GRPC with C++20 coroutine support
Stars: ✭ 53 (+60.61%)
Mutual labels:  grpc
terraform-google-nomad
📗 Terraform Module for Nomad clusters with Consul on GCP
Stars: ✭ 63 (+90.91%)
Mutual labels:  consul
grpc-jwt-spring-boot-starter
Spring boot starter for gRPC framework with JWT authorization
Stars: ✭ 24 (-27.27%)
Mutual labels:  grpc
Consul.ServiceDiscovery.Demo
This demo shows how to implement simple containerized (Docker) microservice architecture with gateway, load balancer (Ocelot) and automatic service discovery (Consul).
Stars: ✭ 24 (-27.27%)
Mutual labels:  consul

FM.ConsulInterop -a lib for simple build micro service

解决了什么问题

依赖的技术栈

组件交互图

功能

  • 简化grpc-srv注册到consul的交互方式 (简单的配置文件/一个扩展方法)
  • 简化grpc-client 消费grpc-srv的交互方式 (简单的配置文件/proxy模式)
  • 客户端定时自动发现srv,并自动负载请求到srv
  • 客户端中间件(认证/log/timeout..)

let's getting start

如何启动:

simples代码

  1. 下载consul, 启动consul命令 (consul agent -dev)
  2. 修改samples/下面的appsettings配置文件设置相关的consul地址,和srv-监听地址
  3. 启动srv ,启动client
客户端和服务端的配置文件详解
{
  "consul": {
    "service": {  ##给srv用的节点
      "ServiceName": "followme.srv.demo.x",  ##注册到consul中的srv-name
      "ConsulAddress": "http://localhost:8500", ##consul服务地址
      "ServiceAddress": "192.168.*.*:0",  ## 服务启动的IP/Port ,可以填写网段信息,端口为0表示auto-choose
      "ConsulIntegration": "true", ##是否需要把服务信息注册到consul中
      "ConsulTags": "v-1.0.0.1", ##tag ,和go-micro通讯必须要注册tag值
      "TCPInterval": 10  ##consul health check ,这里使用的是TTL模式
    },
    "remotes": {
      "demo": {  #####这里是给客户端使用的节点
        "name": "demo.x",  ####准备遗弃的配置!
        "ServiceName": "followme.srv.demo.x", ####客户端需要消费的服务名(通过这个名字来找到相应的服务提供的地址)
        "FreshInterval": 10000,  #### 客户端需要定时的刷新服务列表,时间毫秒
        "ConsulAddress": "http://localhost:8500", ### consul的地址
        "ConsulIntegration": "true", ### 客户端是否需要从consul获取服务地址
        "ServiceAddress": "" ### 当ConsulIntegration=false的时候, 这里的地址可以配置服务的具体ip:port方式
      }
    }
	}
}

srv启动代码解析

var srvConfig = conf. GetSection("consul").GetSection("service").
Get<ConsulLocalServiceConfig>();
new Server
{
     Services = { FM.Demo.HelloSrv.BindService(new HelloSrvImp()) },
}.StartAndRegisterService(srvConfig).Wait();

//获取配置文件中配置的service节点
//通过使用扩展方法[StartAndRegisterService]来启动grpc-服务
//服务启动之后,查看consulUI中的相关界面信息,发现服务已经注册成功!

client消费srv代码解析

//通过配置文件获取client需要消费的那个srv组(因为srv可以同时启动多个)
var clientConfig = conf.GetSection("consul").GetSection("remotes").GetSection("demo").
                Get<ConsulRemoteServiceConfig>();

//FM.Demo.HelloSrv.HelloSrvClient 是grpc subclass(通过protoc工具生成)
//ClientAgent是封装了所有客户端调用的类
//负责做负载, 自动发现新的服务, 踢掉不能用的服务..
//通过ClientAgent来初始化clientProxy
var client =new ClientAgent<FM.Demo.HelloSrv.HelloSrvClient>(clientConfig);
//Hi是FM.Demo.HelloSrv.HelloSrvClient提供的元方法
client.Proxy.Hi(new FM.Demo.HiRequest());

了解内部log

可以通过如下的代码来查看内部的log细节

FM.ConsulInterop.InnerLogger.ConsulLog += (s, c) =>Console.WriteLine(c.Content);

如何贡献

  • issue
  • merge request

license

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].