You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2020/04/30 07:44:35 UTC

[GitHub] [servicecomb-pack] WillemJiang commented on issue #652: get globalTxId.

WillemJiang commented on issue #652:
URL: https://github.com/apache/servicecomb-pack/issues/652#issuecomment-621670930


   > How to get globalTxId in service A?
   > 
   > ```java
   > @SagaStart
   > public void foo(BarCommand cmd) {
   >   TransactionContext localTxContext = omegaContext.getTransactionContext();
   >   someRpc.send(cmd, localTxContext);
   > }
   > ```
   > 
   > On above, How to declare `omegaContext` and `someRpc` object?
   
   omegaContext can be injected into the your service object if the service object is managed by Spring.
    ```
   @Inject
   OmegaContext omegaContext
   
   ```
   someRpc is just for demo for calling the outside service.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org