.NET微服務架構及API網關
阿新 • • 發佈:2018-03-05
.dll 除了 nqa targe tor scrip art src protobuf
MSA服務端的架構
SOA實現 | 微服務架構實現 | |
企業級,自頂向下開展實施 | 團隊級,自底向上開展實施 | |
粒度大:服務由多個子系統組成 | 粒度細:一個系統被拆分成多個服務,且服務的定義更加清晰 | |
重ESB:企業服務總線,集中式的服務架構 | 輕網關:無集中式總線,松散的服務架構 | |
開發過程復雜 | 易開發:減少了企業ESB開發的復雜性,與敏捷開發的思想高度結合在一起 | |
單塊架構系統,相互依賴,部署復雜 | 服務能被獨立部署 | |
1 Plugins.Add(new ValidationFeature()); 2 container.RegisterValidator(typeof(OrderValidator));
1 Plugins.Add(new ProtoBufFormat());
1 TResponse Get<TResponse>(IReturn<TResponse> requestDto);
1 Plugins.Add(new SwaggerFeature());
1 public class OrderRequest : IReturn<OrderResponse> 2 { 3 [ApiMember(Name = "Id", Description = "訂單ID號", IsRequired = false)] 4 public int Id { get; set; } 5 [ApiMember(Name = "CustomerName", Description = "客戶名", IsRequired = false)] 6 public string CustomerName { get; set; } 7 //...... 8 [ApiMember(Name = "OrderItemList", Description = "訂購的產品列表", IsRequired = false)] 9 public List<OrderItem> OrderItemList { get; set; } 10 }在MSA API可視化說明文檔中顯示各請求參數、響應的含義說明
Metadata頁
MSA接口註冊頁
所有服務通過一個API網關來暴露
API Gateway主要實現以下功能:
在自主開發的API網關後臺管理子系統中配置網關參數
.NET微服務架構及API網關