# sofa-rpc-example **Repository Path**: laochen/sofa-rpc-example ## Basic Information - **Project Name**: sofa-rpc-example - **Description**: 更多在 sofa-bolt-example - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-10-15 - **Last Updated**: 2023-10-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 版本对应关系 ``` 1. sofa-rpc-all 5.11.1 时 curator-recipes 版本不能大于4.3.0 另外 zookeeper 的版本和 zookeeper-server对应即可 遵循 Spring Boot 命名规范,SOFABoot 所有中间件组件命名都是以 [rpc|tracer|lookout]-sofa-boot-starter 来标示的 Spring Boot 管理自身依赖的理念一致,SOFA 中间件的引入也不需要版本号,因为所有 SOFA 中间件的依赖管理已经在 sofaboot-dependencies 中定义好了 ``` # [SOFAStack系列文章知乎专栏](https://zhuanlan.zhihu.com/sofastack) # [ByteBuddy入门教程](https://zhuanlan.zhihu.com/p/151843984) # [JOOR(反射库)使用](https://www.jianshu.com/p/1ba3680c114c) ``` https://droidyue.com/blog/2017/01/09/joor-examples/ ``` # [SOFABolt 用户手册](https://www.sofastack.tech/projects/sofa-bolt/sofa-bolt-handbook/) # [RPC 常见问题](https://help.aliyun.com/knowledge_detail/184128.html) # [SOFARPC官方文档](https://help.aliyun.com/document_detail/149838.html) # [剖析 | SOFARPC 框架之总体设计与扩展机制](https://mp.weixin.qq.com/s/ZKUmmFT0NWEAvba2MJiJfA) # [SOFABolt 文档手册](https://www.bookstack.cn/read/sofa-bolt/README.md) # [SofaBolt最简单Demo ](https://www.cnblogs.com/YangGC/p/12397322.html) # [SOFABolt 源码分析11 - Config 配置管理的设计](https://www.jianshu.com/p/76b0be893745) # [蚂蚁 RPC 框架 SOFA-RPC 初体验](https://www.jianshu.com/p/d986dd9b1e63) # [AutoValue使用那点事](https://blog.csdn.net/wangxiaotongfan/article/details/81486952) ``` 针对反射需要时这个不可使用 https://www.jianshu.com/p/0e2be3536a4e ``` # [forest做RPC](https://forest.dtflyx.com/) # [推荐-SOFARPC 文档手册(201808)](https://www.bookstack.cn/read/SOFARPC-zh/Home.md) # [JSR-303 校验规则](https://blog.csdn.net/springyh/article/details/80560439) # [MacOS中安装Consul(启动及关闭)](https://www.cnblogs.com/niceyoo/p/14223158.html) ``` 官网下载链接:https://www.consul.io/downloads.html wget https://releases.hashicorp.com/consul/1.4.5/consul_1.4.5_darwin_amd64.zip wget https://releases.hashicorp.com/consul/1.4.2/consul_1.4.2_darwin_amd64.zip #cd /Users/simple/Applications/bin #consul agent -dev #http://localhost:8500/ui/dc1/services consul agent -server -ui -bootstrap-expect=1 -client=0.0.0.0 -data-dir=./logs/consul.log consul agent -server -ui -bootstrap-expect=1 -client=0.0.0.0 -bind 你的ip地址 -data-dir=/状态数据存储文件夹/data >> /日志记录文件夹/logs/consul.log & ``` # [zookeeper 下载](https://archive.apache.org/dist/zookeeper/) ``` 注意: zookeeper 3.4.14 只能适配 curator-recipes 4.3.0 注意: Curator 框架与 Zookeeer 版本 适配 ZK 3.4.x https://blog.csdn.net/qq_24434251/article/details/119055534 https://curator.apache.org/zk-compatibility-34.html 集成 https://www.sofastack.tech/blog/sofa-rpc-zookeeper-integriation/ https://mirrors.aliyun.com/apache/zookeeper/ https://blog.csdn.net/qq53167889/article/details/106282771 cp zoo_sample.cfg zoo.cfg dataDir=/tmp/zookeeper/data dataLogDir=/tmp/zookeeper/log ``` # [集成 Nacos 与 Hystrix](https://developer.aliyun.com/article/712213) # [在 SOFABoot 使用 SOFARPC 及 ZooKeeper 注册中心](https://www.sofastack.tech/blog/sofa-rpc-zookeeper-integriation/) # [5分钟学习zookeeper:Curator Recipes](https://www.jianshu.com/p/012e5ac85d4c) ``` Curator针对zookeeper的常见应用场景,提供了方便的Recipes(菜谱),帮助用户快速高效地完成代码开发。如:Leader选举,分布式锁,Barriers,分布式队列等。 Curator Recipes封装了底层细节,让用户可以更快捷地实现各种分布式应用场景。除了本文列出的leader选举和分布式锁,还有分布式队列,节点缓存,Barrier等。可以参考官方文档http://curator.apache.org/curator-recipes/index.html上的api。 ``` # [Apache Curator Framework教程](https://zhuanlan.zhihu.com/p/603185454) # [RPC 发布订阅配置](https://www.sofastack.tech/projects/sofa-rpc/configuration-common/) ``` 服务发布或消费启动时的参数 ``` # [SOFATracer 配置项](https://www.sofastack.tech/projects/sofa-tracer/configuration/) ``` sofarpc 默认集成 SOFATracer,看不到日志是因为SOFATracer默认输出到 ${user.home} 修改方式一: 在非 SpringBoot 工程中,可以通过在 classpath 下新建一个 sofa.tracer.properties 配置文件,配置项如下 修改方式二: 在启动的时候通过 -Dlogging.path=./logs 修改该默认值 java -Dlogging.path=./logs -cp ./lib/*:sofa-bolt-example-0.0.1-SNAPSHOT.jar com.example.rpc.main.QuickStartServer ``` # 打包运行 ``` #mvn clean package -Dmaven.test.skip=true ( 打包前需要 在pom.xml中打开 使用spring 否则会出现复制lib不成功) #java -cp ./lib/*:sofa-bolt-example-0.0.1-SNAPSHOT.jar com.example.rpc.main.QuickStartServer ``` # [阿里-企业级分布式应用服务 EDAS](https://help.aliyun.com/zh/edas/) ``` 监控可以集成 鹰眼 系统 鹰眼跟踪、限流降级,EDAS的微服务解决之道 https://developer.aliyun.com/article/60994 ``` # [剖析 | SOFARPC 框架](https://www.sofastack.tech/tags/%E5%89%96%E6%9E%90-sofarpc-%E6%A1%86%E6%9E%B6/) ## [总体设计与扩展机制](https://www.sofastack.tech/blog/sofa-rpc-framework-overall-extension/) ## [链路追踪剖析](https://mp.weixin.qq.com/s?__biz=MzUzMzU5Mjc1Nw==&mid=2247484287&idx=1&sn=0a10adbd6708b902f4c6bbb2927c2526&chksm=faa0eca5cdd765b33e2cad7507221d51786e49fd3f31d4ed3a6850454377a189b5504b09cc49&scene=21#wechat_redirect) # [Bolt 协议泛化调用](https://www.sofastack.tech/projects/sofa-rpc/generic-invoke/) ``` 1. 定义接口,并集成cxsservice和cxsmethod 2. 通过泛化调用集成 ``` # [集成 SOFARPC RESTful 服务和 Swagger](https://www.sofastack.tech/projects/sofa-rpc/restful-swagger/) # [HTTP 转 SOFARPC 入门-参数透传](https://help.aliyun.com/zh/sofa-apigateway/getting-started/sofarpc-protocol) ``` 网关现已支持 HTTP Header 转 SOFARPC Baggage 透传功能,在 HTTP-SOFARPC 的转换中,把约定好的 HTTP Header 中的传参形式加入到 Baggage 参数中 request.getHeaderParams().put("baggage_context.透传参数名称","透传数据") 然后在 SOFARPC 服务中,可以通过 Baggage 函数获取对应的参数值。 RpcInvokeContext context = RpcInvokeContext.getContext(); context.getRequestBaggage("透传参数名称") ``` # [高性能无锁并发框架Disruptor](https://tech.meituan.com/2016/11/18/disruptor.html) ``` Disruptor是英国外汇交易公司LMAX开发的一个高性能队列,研发的初衷是解决内存队列的延迟问题(在性能测试中发现竟然与I/O操作处于同样的数量级)。基于Disruptor开发的系统单线程能支撑每秒600万订单,2010年在QCon演讲后,获得了业界关注。2011年,企业应用软件专家Martin Fowler专门撰写长文介绍。同年它还获得了Oracle官方的Duke大奖。 ``` # [高性能队列 Disruptor 使用教程](https://juejin.cn/post/6844904020973191181) # [protostuff-java 动态创建protobuf] ``` com.google.protobuf protobuf-java 3.5.1 io.protostuff protostuff-core 1.6.0 io.protostuff protostuff-runtime 1.6.0 ``` # [java高级用法之:绑定CPU的线程Thread-Affinity](https://www.cnblogs.com/flydean/p/16258171.html) # [JRaft RheaKV 用户指南](https://www.sofastack.tech/projects/sofa-jraft/jraft-rheakv-user-guide/) ``` 基于 JRaft 和 RocksDB 实现的嵌入式、分布式、高可用、强一致的 KV 存储类库 使用场景 轻量级的状态/元信息存储以及集群同步 分布式锁服务 ``` # 异常处理方式 # 在线文档 # [一篇文章带你学习分布式事务](https://mp.weixin.qq.com/s?__biz=MzI0Nzc3MTQyMw==&mid=2247484990&idx=1&sn=5404add102848853738fec5a1eba74a3&chksm=e9abbe4ededc375854682904bfe44a4dd11c3d4c414ade55fb57f5c6a403ddd4940daf84cbfa&scene=21#wechat_redirect) # [深度| 一篇文章为你解读SOFA-DTX 分布式事务的设计演进路线](https://mp.weixin.qq.com/s/OX_RMkMbjDT2SnGIystm2w) ``` com.alipay.dtx dtx-remoting-sofa-rpc 2.3.0 ```