You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ni...@apache.org on 2018/03/09 12:17:39 UTC

[incubator-servicecomb-saga] branch master updated (7118701 -> e5dd6df)

This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-saga.git.


    from 7118701  Move the project version to 0.2.0-SNAPSHOT
     new 99fabad  SCB-330 add guides to run executable alpha server
     new 787cce1  SCB-330 swallow exception when saving the same timeout concurrently
     new e5dd6df  SCB-330 add guides to run executable alpha server with mysql

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../alpha/server/SpringTxTimeoutRepository.java    | 10 ++++++++-
 .../how_to_use_mysql_as_alpha_backend_database.md  | 24 +++++++++++++++++++-
 .../how_to_use_mysql_as_alpha_backend_database.md  | 26 ++++++++++++++++++++--
 docs/user_guide.md                                 | 24 +++++++++++---------
 docs/user_guide_zh.md                              | 24 +++++++++++---------
 5 files changed, 84 insertions(+), 24 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
ningjiang@apache.org.

[incubator-servicecomb-saga] 02/03: SCB-330 swallow exception when saving the same timeout concurrently

Posted by ni...@apache.org.
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/incubator-servicecomb-saga.git

commit 787cce112fcc99eeef0581654a29558ee332c32e
Author: Eric Lee <da...@huawei.com>
AuthorDate: Fri Mar 9 11:07:56 2018 +0800

    SCB-330 swallow exception when saving the same timeout concurrently
    
    Signed-off-by: Eric Lee <da...@huawei.com>
---
 .../saga/alpha/server/SpringTxTimeoutRepository.java           | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/SpringTxTimeoutRepository.java b/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/SpringTxTimeoutRepository.java
index ee75496..7195139 100644
--- a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/SpringTxTimeoutRepository.java
+++ b/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/SpringTxTimeoutRepository.java
@@ -19,15 +19,19 @@ package org.apache.servicecomb.saga.alpha.server;
 
 import static org.apache.servicecomb.saga.alpha.core.TaskStatus.PENDING;
 
+import java.lang.invoke.MethodHandles;
 import java.util.List;
 
 import javax.transaction.Transactional;
 
 import org.apache.servicecomb.saga.alpha.core.TxTimeout;
 import org.apache.servicecomb.saga.alpha.core.TxTimeoutRepository;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.data.domain.PageRequest;
 
 public class SpringTxTimeoutRepository implements TxTimeoutRepository {
+  private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
   private final TxTimeoutEntityRepository timeoutRepo;
 
   SpringTxTimeoutRepository(TxTimeoutEntityRepository timeoutRepo) {
@@ -36,7 +40,11 @@ public class SpringTxTimeoutRepository implements TxTimeoutRepository {
 
   @Override
   public void save(TxTimeout timeout) {
-    timeoutRepo.save(timeout);
+    try {
+      timeoutRepo.save(timeout);
+    } catch (Exception ignored) {
+      log.warn("Failed to save some timeout {}", timeout);
+    }
   }
 
   @Override

-- 
To stop receiving notification emails like this one, please contact
ningjiang@apache.org.

[incubator-servicecomb-saga] 03/03: SCB-330 add guides to run executable alpha server with mysql

Posted by ni...@apache.org.
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/incubator-servicecomb-saga.git

commit e5dd6df0e19cc200df30e1bfddb2fff5c47ec4b5
Author: Eric Lee <da...@huawei.com>
AuthorDate: Fri Mar 9 11:49:01 2018 +0800

    SCB-330 add guides to run executable alpha server with mysql
    
    Signed-off-by: Eric Lee <da...@huawei.com>
---
 .../how_to_use_mysql_as_alpha_backend_database.md  | 24 +++++++++++++++++++-
 .../how_to_use_mysql_as_alpha_backend_database.md  | 26 ++++++++++++++++++++--
 docs/user_guide.md                                 |  4 ++--
 docs/user_guide_zh.md                              |  4 ++--
 4 files changed, 51 insertions(+), 7 deletions(-)

diff --git a/docs/faq/cn/how_to_use_mysql_as_alpha_backend_database.md b/docs/faq/cn/how_to_use_mysql_as_alpha_backend_database.md
index 891a124..f241b36 100644
--- a/docs/faq/cn/how_to_use_mysql_as_alpha_backend_database.md
+++ b/docs/faq/cn/how_to_use_mysql_as_alpha_backend_database.md
@@ -8,5 +8,27 @@
          <artifactId>mysql-connector-java</artifactId>
        </dependency>
    ```
+
+2. 安装Saga
+   ```bash
+   mvn clean install -Pdocker -DskipTests
+   ```
+   在命令执行完成后,会生成名为alpha-server的镜像和可执行文件`alpha/alpha-server/target/saga/alpha-server-${version}-exec.jar`。
+   **注意**: 如果不需要生成docker镜像,则直接运行`mvn clean install -DskipTests`即可。
+   **注意**: 如果您之前已生成了alpha-server的docker镜像,则需要在运行命令前将其删除。
    
-2. 在alpha启动时通过添加`-Dspring.profiles.active=mysql`的启动参数来使mysql的配置生效。
+3. 运行MySQL
+   ```bash
+   docker run -d -e "MYSQL_ROOT_PASSWORD=password" "-e "MYSQL_DATABASE=saga" -e "MYSQL_USER=saga" -e "MYSQL_PASSWORD=password" -p 3306:3306 mysql/mysql-server:5.7
+   ```
+
+4. 运行alpha。请确保MySQL在此前已成功启动。alpha的运行可通过docker或可执行文件的方式。
+   * 通过docker
+      ```bash
+      docker run -d -p 8090:8090 -e "JAVA_OPTS=-Dspring.profiles.active=mysql -Dspring.datasource.url=jdbc:mysql://${host_address}:3306/saga?useSSL=false" alpha-server:${saga_version}
+      ```
+   * 通过可执行文件
+      ```bash
+      java -Dspring.profiles.active=mysql -D"spring.datasource.url=jdbc:mysql://${host_address}:3306/saga?useSSL=false" -jar alpha-server-${saga_version}-exec.jar
+      ```
+   **注意**: 请在运行命令前将`${saga_version}`和`${host_address}`更改为实际值。
diff --git a/docs/faq/en/how_to_use_mysql_as_alpha_backend_database.md b/docs/faq/en/how_to_use_mysql_as_alpha_backend_database.md
index adb44e2..2bb2954 100644
--- a/docs/faq/en/how_to_use_mysql_as_alpha_backend_database.md
+++ b/docs/faq/en/how_to_use_mysql_as_alpha_backend_database.md
@@ -8,5 +8,27 @@
          <artifactId>mysql-connector-java</artifactId>
        </dependency>
    ```
-   
-2. activate mysql profile by specifying option `-Dspring.profiles.active=mysql` when booting alpha.
\ No newline at end of file
+
+2. install Saga
+   ```bash
+   mvn clean install -Pdocker -DskipTests
+   ```
+   After that, you will find the generated docker image `alpha-server` and executable file `alpha/alpha-server/target/saga/alpha-server-${version}-exec.jar`.
+   **Notice**: If you do not want to build the docker image, run `mvn clean install -DskipTests` is enough.
+   **Notice**: If you have installed saga with docker before, you need to remove the alpha-server's docker image first.
+
+3. run MySQL
+   ```bash
+   docker run -d -e "MYSQL_ROOT_PASSWORD=password" "-e "MYSQL_DATABASE=saga" -e "MYSQL_USER=saga" -e "MYSQL_PASSWORD=password" -p 3306:3306 mysql/mysql-server:5.7
+   ```
+
+4. Run alpha. Please make sure MySQL is up before this step. You can run alpha through docker or executable file.
+   * via docker
+      ```bash
+      docker run -d -p 8090:8090 -e "JAVA_OPTS=-Dspring.profiles.active=mysql -Dspring.datasource.url=jdbc:mysql://${host_address}:3306/saga?useSSL=false" alpha-server:${saga_version}
+      ```
+   * via executable file
+      ```bash
+      java -Dspring.profiles.active=mysql -D"spring.datasource.url=jdbc:mysql://${host_address}:3306/saga?useSSL=false" -jar alpha-server-${saga_version}-exec.jar
+      ```
+   **Notice**: Please change `${saga_version}` and `${host_address}` to the actual value before you execute the command.
\ No newline at end of file
diff --git a/docs/user_guide.md b/docs/user_guide.md
index 97494ad..62eadc7 100644
--- a/docs/user_guide.md
+++ b/docs/user_guide.md
@@ -84,13 +84,13 @@ Take a transfer money application as an example:
 2. run alpha. Before running alpha, please make sure postgreSQL is already up. You can run alpha through docker or executable file.
    * Run alpha through docker.
       ```bash
-      docker run -d -p 8090:8090 -e "JAVA_OPTS=-Dspring.profiles.active=prd -Dspring.datasource.url=jdbc:postgresql://${docker_host_address}:5432/saga?useSSL=false" alpha-server:${saga_version}
+      docker run -d -p 8090:8090 -e "JAVA_OPTS=-Dspring.profiles.active=prd -Dspring.datasource.url=jdbc:postgresql://${host_address}:5432/saga?useSSL=false" alpha-server:${saga_version}
       ```
    * Run alpha through executable file.
       ```bash
       java -Dspring.profiles.active=prd -D"spring.datasource.url=jdbc:postgresql://${host_address}:5432/saga?useSSL=false" -jar alpha-server-${saga_version}-exec.jar
       ```
-   **Note**: Please change `${saga_version}` and `${docker_host_address}`/`${host_address}` to the actual value before you execute the command.
+   **Note**: Please change `${saga_version}` and `${host_address}` to the actual value before you execute the command.
 
 3. setup omega. Configure the following values in `application.yaml`.
    ```yaml
diff --git a/docs/user_guide_zh.md b/docs/user_guide_zh.md
index ac657f3..befc97c 100644
--- a/docs/user_guide_zh.md
+++ b/docs/user_guide_zh.md
@@ -83,13 +83,13 @@ $ mvn clean install -DskipTests -Pdocker
 2. 运行alpha。在运行alpha前,请确保postgreSQL已正常启动。可通过docker或可执行文件的方式来启动alpha。
    * 通过docker运行:
       ```bash
-      docker run -d -p 8090:8090 -e "JAVA_OPTS=-Dspring.profiles.active=prd -Dspring.datasource.url=jdbc:postgresql://${docker_host_address}:5432/saga?useSSL=false" alpha-server:${saga_version}
+      docker run -d -p 8090:8090 -e "JAVA_OPTS=-Dspring.profiles.active=prd -Dspring.datasource.url=jdbc:postgresql://${host_address}:5432/saga?useSSL=false" alpha-server:${saga_version}
       ```
    * 通过可执行文件运行:
       ```bash
       java -Dspring.profiles.active=prd -D"spring.datasource.url=jdbc:postgresql://${host_address}:5432/saga?useSSL=false" -jar alpha-server-${saga_version}-exec.jar
       ```
-   **注意**: 请在执行命令前将`${saga_version}`和`${docker_host_address}`/`${host_address}`更改为实际值。
+   **注意**: 请在执行命令前将`${saga_version}`和`${host_address}`更改为实际值。
 
 3. 配置omega。在 `application.yaml` 添加下面的配置项:
    ```yaml

-- 
To stop receiving notification emails like this one, please contact
ningjiang@apache.org.

[incubator-servicecomb-saga] 01/03: SCB-330 add guides to run executable alpha server

Posted by ni...@apache.org.
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/incubator-servicecomb-saga.git

commit 99fabadda232b8c2095fe540ab6545be67c4f8ce
Author: Eric Lee <da...@huawei.com>
AuthorDate: Fri Mar 9 10:48:10 2018 +0800

    SCB-330 add guides to run executable alpha server
    
    Signed-off-by: Eric Lee <da...@huawei.com>
---
 docs/user_guide.md    | 24 ++++++++++++++----------
 docs/user_guide_zh.md | 24 ++++++++++++++----------
 2 files changed, 28 insertions(+), 20 deletions(-)

diff --git a/docs/user_guide.md b/docs/user_guide.md
index a0d9db5..97494ad 100644
--- a/docs/user_guide.md
+++ b/docs/user_guide.md
@@ -25,14 +25,15 @@ $ mvn clean install -DskipTests -Pdocker
     <dependency>
       <groupId>org.apache.servicecomb.saga</groupId>
       <artifactId>omega-spring-starter</artifactId>
-      <version>0.0.3-SNAPSHOT</version>
+      <version>${saga.version}</version>
     </dependency>
     <dependency>
       <groupId>org.apache.servicecomb.saga</groupId>
       <artifactId>omega-transport-resttemplate</artifactId>
-      <version>0.0.3-SNAPSHOT</version>
+      <version>${saga.version}</version>
     </dependency>
 ```
+**Note**: Please change the `${saga.version}` to the actual version.
 
 ### Add saga annotations and corresponding compensation methods
 Take a transfer money application as an example:
@@ -80,13 +81,16 @@ Take a transfer money application as an example:
    docker run -d -e "POSTGRES_DB=saga" -e "POSTGRES_USER=saga" -e "POSTGRES_PASSWORD=password" -p 5432:5432 postgres
    ```
 
-2. run alpha. Before running alpha, please make sure postgreSQL is already up.
-   ```bash
-   docker run -d -p 8090:8090 \
-     -e "JAVA_OPTS=-Dspring.profiles.active=prd" \
-     -e "spring.datasource.url=jdbc:postgresql://{docker.host.address}:5432/saga?useSSL=false" \
-     alpha-server:0.0.3-SNAPSHOT
-   ```
+2. run alpha. Before running alpha, please make sure postgreSQL is already up. You can run alpha through docker or executable file.
+   * Run alpha through docker.
+      ```bash
+      docker run -d -p 8090:8090 -e "JAVA_OPTS=-Dspring.profiles.active=prd -Dspring.datasource.url=jdbc:postgresql://${docker_host_address}:5432/saga?useSSL=false" alpha-server:${saga_version}
+      ```
+   * Run alpha through executable file.
+      ```bash
+      java -Dspring.profiles.active=prd -D"spring.datasource.url=jdbc:postgresql://${host_address}:5432/saga?useSSL=false" -jar alpha-server-${saga_version}-exec.jar
+      ```
+   **Note**: Please change `${saga_version}` and `${docker_host_address}`/`${host_address}` to the actual value before you execute the command.
 
 3. setup omega. Configure the following values in `application.yaml`.
    ```yaml
@@ -98,4 +102,4 @@ Take a transfer money application as an example:
        address: {alpha.cluster.addresses}
    ```
 
-Then you can start your micro-services.
+Then you can start your micro-services and access all saga events via http://${alpha-server:port}/events.
diff --git a/docs/user_guide_zh.md b/docs/user_guide_zh.md
index 6b8ce47..ac657f3 100644
--- a/docs/user_guide_zh.md
+++ b/docs/user_guide_zh.md
@@ -24,14 +24,15 @@ $ mvn clean install -DskipTests -Pdocker
     <dependency>
       <groupId>org.apache.servicecomb.saga</groupId>
       <artifactId>omega-spring-starter</artifactId>
-      <version>0.0.3-SNAPSHOT</version>
+      <version>${saga.version}</version>
     </dependency>
     <dependency>
       <groupId>org.apache.servicecomb.saga</groupId>
       <artifactId>omega-transport-resttemplate</artifactId>
-      <version>0.0.3-SNAPSHOT</version>
+      <version>${saga.version}</version>
     </dependency>
 ```
+**注意**: 请将`${saga.version}`更改为实际的版本号。
 
 ### 添加Saga的注解及相应的补偿方法
 以一个转账应用为例:
@@ -79,13 +80,16 @@ $ mvn clean install -DskipTests -Pdocker
    docker run -d -e "POSTGRES_DB=saga" -e "POSTGRES_USER=saga" -e "POSTGRES_PASSWORD=password" -p 5432:5432 postgres
    ```
 
-2. 运行alpha。在运行alpha前,请确保postgreSQL已正常启动。
-   ```bash
-   docker run -d -p 8090:8090 \
-     -e "JAVA_OPTS=-Dspring.profiles.active=prd" \
-     -e "spring.datasource.url=jdbc:postgresql://{docker.host.address}:5432/saga?useSSL=false" \
-     alpha-server:0.0.3-SNAPSHOT
-   ```
+2. 运行alpha。在运行alpha前,请确保postgreSQL已正常启动。可通过docker或可执行文件的方式来启动alpha。
+   * 通过docker运行:
+      ```bash
+      docker run -d -p 8090:8090 -e "JAVA_OPTS=-Dspring.profiles.active=prd -Dspring.datasource.url=jdbc:postgresql://${docker_host_address}:5432/saga?useSSL=false" alpha-server:${saga_version}
+      ```
+   * 通过可执行文件运行:
+      ```bash
+      java -Dspring.profiles.active=prd -D"spring.datasource.url=jdbc:postgresql://${host_address}:5432/saga?useSSL=false" -jar alpha-server-${saga_version}-exec.jar
+      ```
+   **注意**: 请在执行命令前将`${saga_version}`和`${docker_host_address}`/`${host_address}`更改为实际值。
 
 3. 配置omega。在 `application.yaml` 添加下面的配置项:
    ```yaml
@@ -97,4 +101,4 @@ $ mvn clean install -DskipTests -Pdocker
        address: {alpha.cluster.addresses}
    ```
 
-然后就可以运行相关的微服务了。
+然后就可以运行相关的微服务了,可通过访问http://${alpha-server:port}/events 来获取所有的saga事件信息。

-- 
To stop receiving notification emails like this one, please contact
ningjiang@apache.org.