摘要: 使用简单 hystrix的使用是非常简单的,同步执行,直接调用Do方法。 err := hystrix.Do("my_command", func() error { // talk to other services return nil }, func(err error) error { // 阅读全文
posted @ 2020-11-06 17:39 Binb 阅读(443) 评论(0) 推荐(0) 编辑
摘要: option参数的各种用法 Error对象的处理 主要在 main.go中 httpTransport.NewServer() 函数中的 ServerOption 选传参数 我们可以看到 // ServerOption设置服务器的可选参数。 type ServerOption func(*Serve 阅读全文
posted @ 2020-11-06 17:07 Binb 阅读(860) 评论(0) 推荐(0) 编辑
摘要: 首先,让我们来回顾一下我们的项目架构 // 项目结构 -| Server | server.go -| EndPoint | endpoint.go -| Transport | Transport.go - main.go 使用外部路由组件扩充服务 我们这里使用 https://github.co 阅读全文
posted @ 2020-11-06 14:29 Binb 阅读(2800) 评论(0) 推荐(1) 编辑
摘要: 我们客户端的架构与服务的类似 根据我们Demo的示例,我们创建一个客户端,客户端与服务端架构类似 // 项目结构 -| Client | Client.go -| EndPoint | endpoint.go -| Transport | Transport.go - main.go 1.首先我们还 阅读全文
posted @ 2020-11-06 11:49 Binb 阅读(1432) 评论(0) 推荐(0) 编辑