This is an automated email from the ASF dual-hosted git repository. ningjiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/servicecomb-pack.git
commit ee374f49ee94c84ca39049a4de39dee9b88ba056 Author: Daniel Qian <[email protected]> AuthorDate: Wed Jul 24 07:17:34 2019 +0800 SCB-1389 Polish doc with suggestion of Willem Jiang --- docs/user_guide.md | 11 ++++++++--- docs/user_guide_zh.md | 9 ++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/docs/user_guide.md b/docs/user_guide.md index 92d9d49..cc40e87 100644 --- a/docs/user_guide.md +++ b/docs/user_guide.md @@ -137,8 +137,8 @@ public void bar() { Here is how Omega does: 1. Service A's `foo` method opens a new global transaction. -2. `TransactionClientHttpRequestInterceptor` injects transaction context into request headers when `RestTemplate` request Service B. -3. When Service B receive the request, `TransactionHandlerInterceptor` extract context info from request headers. +2. [TransactionClientHttpRequestInterceptor][src-TransactionClientHttpRequestInterceptor] injects transaction context into request headers when `RestTemplate` request Service B. +3. When Service B receive the request, [TransactionHandlerInterceptor][src-TransactionHandlerInterceptor] extract context info from request headers. Omega supports following implicity transaction context passing: @@ -146,7 +146,7 @@ Omega supports following implicity transaction context passing: 2. Method call in the same thread (based on `OmegaContext` thread local fields). 3. `java.util.concurrent.Executor{Service}` annotated by `@OmegaContextAware`. -So here comes a problem: what if implicit transaction context passing can't work? For example, Service A invokes Service B via some RPC library and no extension can be made to injecting or extracting transaction context information. In this situation you need explicit transaction context passing. Omega provides two classes to achieve that. +So here comes a problem: what if implicit transaction context passing can't work? For example, Service A invokes Service B via some RPC library and no extension can be made to injecting or extracting transaction context information. In this situation you need explicit transaction context passing. Since ServiceComb Pack 0.5.0, it provides two classes to achieve that. ##### TransactionContext @@ -789,3 +789,8 @@ Uses Spring Cloud Nacos Discovery 0.2.x by default, if you want to use Spring Cl ## Cluster Alpha can be highly available by deploying multiple instances, enable cluster support with the `alpha.cluster.master.enabled=true` parameter. + + + +[src-TransactionClientHttpRequestInterceptor]: ../omega/omega-transport/omega-transport-resttemplate/src/main/java/org/apache/servicecomb/pack/omega/transport/resttemplate/TransactionClientHttpRequestInterceptor.java +[src-TransactionHandlerInterceptor]: ../omega/omega-transport/omega-transport-resttemplate/src/main/java/org/apache/servicecomb/pack/omega/transport/resttemplate/TransactionHandlerInterceptor.java \ No newline at end of file diff --git a/docs/user_guide_zh.md b/docs/user_guide_zh.md index f385f37..143f08f 100644 --- a/docs/user_guide_zh.md +++ b/docs/user_guide_zh.md @@ -137,8 +137,8 @@ public void bar() { 我们可以先来看看Omega是怎么传递事务上下文的: 1. Service A的foo方法会开启一个新的全局事务。 -2. TransactionClientHttpRequestInterceptor会在RestTemplate请求Service B时在Http请求头中注入事务上下文信息。 -3. 当Servce B接收到请求时,TransactionHandlerInterceptor会从请求头中提取事务上下文信息。 +2. [TransactionClientHttpRequestInterceptor][src-TransactionClientHttpRequestInterceptor]会在RestTemplate请求Service B时在Http请求头中注入事务上下文信息。 +3. 当Servce B接收到请求时,[TransactionHandlerInterceptor][src-TransactionHandlerInterceptor]会从请求头中提取事务上下文信息。 目前Omega支持以下形式的隐式事务上下文传递: @@ -146,7 +146,7 @@ public void bar() { 2. 同线程内调用(基于OmegaContext的ThreadLocal字段)。 3. 标注了@OmegaContextAware的java.util.concurrent.Executor{Service}。 -那么问题来了,如果隐式传递事务上下文不行怎么办?比如Service A使用某种RPC机制件来调用Service B,而你又没有办法注入或提取事务上下文信息。这个时候你只能采用显式的方式把事务上下文传递出去。Omega提供了两个类来实现这一点。 +那么问题来了,如果无法隐式传递事务上下文怎么办?比如Service A使用某种RPC机制件来调用Service B,而你又没有办法注入或提取事务上下文信息。这个时候你只能采用显式的方式把事务上下文传递出去。ServiceComb Pack从0.5.0开始提供了两个类来实现这一点。 ##### 利用TransactionContext传递 @@ -778,3 +778,6 @@ public void bar(BarCommandWithTxContext cmdWithTxContext) { ## 集群 Alpha 可以通过部署多实例的方式保证高可用,使用 `alpha.cluster.master.enabled=true` 参数开启集群支持 + +[src-TransactionClientHttpRequestInterceptor]: ../omega/omega-transport/omega-transport-resttemplate/src/main/java/org/apache/servicecomb/pack/omega/transport/resttemplate/TransactionClientHttpRequestInterceptor.java +[src-TransactionHandlerInterceptor]: ../omega/omega-transport/omega-transport-resttemplate/src/main/java/org/apache/servicecomb/pack/omega/transport/resttemplate/TransactionHandlerInterceptor.java \ No newline at end of file
