Surging is a micro-service engine that provides a lightweight, high-performance, modular RPC request pipeline. support Event-based Asynchronous Pattern and rea
Surging is a micro-service engine that provides a lightweight, high-performance, modular RPC request pipeline. support Event-based Asynchronous Pattern and rea
英文名:surging
中文名:滔滔
中文名来自周星驰的经典台词
我对阁下的景仰犹如滔滔江水,连绵不绝,犹如黄河泛滥,一发而不可收拾,而取名英文的含义也希望此框架能流行起来,也能像《.net core surging》这句英文语句含义一样,.net core技术风起云涌,冲击整个软件生态系统。
微服务应该是可以自由组合拆分,对于每个业务都是独立的,针对于业务模块的 CRUD 可以注册为服务,而每个服务都是高度自治的,从开发,部署都是独立,而每个服务只做单一功能,利用领域驱动设计去更好的拆分成粒度更小的模块
微服务是针对业务的松耦合,也是粒度最小的功能业务模块,针对于行业解决方案,集成相应的service host,而针对于业务需要一些中间件来辅助,比如缓存中间件,eventbus中间件(消息中间件),数据储存中间件,而各个服务又可以互相通过rpc进行可靠性通信。
引擎是微服务的容器,而docker 是服务引擎的容器,而利用k8s或rancher可以针对docker集群化管理,可以服务编排弹性扩容,熟知工具,让工具物尽其用。
1.简化的服务调用,通过服务规则的指定,就可以做到服务之间的远程调用,无需其它方式的侵入
2.服务自动注册与发现,不需要配置服务提供方地址,注册中心基于ServiceId 或者RoutePath查询服务提供者的地址和元数据,并且能够平滑添加或删除服务提供者。
3.软负载均衡及容错机制,通过surging内部负载算法和容错规则的设定,从而达到内部调用的负载和容错
4.分布式缓存中间件:通过哈希一致性算法来实现负载,并且有健康检查能够平滑的把不健康的服务从列表中删除
6.容器化持续集成与持续交付 :通过构建一体化Devops平台,实现项目的自动化构建、部署、测试和发布,从而提高生产环境的可靠性、稳定性、弹性和安全性。
docker hub : docker pull serviceengine/surging:版本号
nuget:Install-Package surging -Version 版本号
…{
"ConnectionString": "${Register_Conn}|127.0.0.1:8500", // ${环境变量名} |默认值,
"SessionTimeout": "${Register_SessionTimeout}|50",
"ReloadOnChange": true
}
{
"Ip": "${Server_IP}|127.0.0.1",
"WatchInterval": 30,
"Port": "${Server_port}",
"Token": "true",
"Protocol": "${Protocol}|Tcp", //支持Http,Tcp协议
"RootPath": "${RootPath}",
"RequestCacheEnabled": false
}
{
"Ip": "${Server_IP}|0.0.0.0",//私有容器IP
"WatchInterval": 30,
"Port": "${Server_port}|98",//私有容器端口
"MappingIp": "${Mapping_ip}",//公开主机IP
"MappingPort": "${Mapping_Port}",//公开主机端口
"Protocol": "${Protocol}|Tcp", //支持Http,Tcp协议
"Token": "true",
"RootPath": "${RootPath}",
"RequestCacheEnabled": false
}
服务路由访问配置:
[ServiceBundle("api/{Service}")]JWT验证,接口方法添加以下特性:
[Authorization(AuthType = AuthorizationType.JWT)];AppSecret验证,接口方法添加以下特性:
[Authorization(AuthType = AuthorizationType.AppSecret)];订阅功能:
ServiceLocator.GetService< ISubscriptionAdapt >().SubscribeAt();[Command(Strategy= StrategyType.Injection ,Injection = @"return null;")][Command(Strategy= StrategyType.Injection ,Injection = @"return
Task.FromResult(new Surging.IModuleServices.Common.Models.UserModel
{
Name=""fanly"",
Age=18
});",InjectionNamespaces =new string[] { "Surging.IModuleServices.Common"})] [Command(Strategy= StrategyType.Injection ,Injection = @"return true;")] 增加缓存降级,怎么使用?
在业务接口方法上添加如下特性
[Command(Strategy= StrategyType.Failover,FailoverCluster =3,RequestCacheEnabled =true)] //RequestCacheEnabled =true 就是启用缓存 [InterceptMethod(CachingMethod.Get, Key = "GetUser_id_{0}", Mode = CacheTargetType.Redis, Time = 480)] [InterceptMethod(CachingMethod.Remove, "GetUser_id_{0}", "GetUserName_name_{0}", Mode = CacheTargetType.Redis)][CacheKey(1)] .AddClientIntercepted(typeof(CacheProviderInterceptor))surging 接受来自社区的捐赠,所有款项将通过 捐赠明细表 进行公示,接受社区监督。
IDE:Visual Studio 2017 15.5,vscode
框架:.NET core 2.1
QQ群:615562965
No open issues yet, or sync has not completed.