Integrated seata into springboot+jpa+dubbo+druid project.
in this demo, we simulate a deposit service, there will be two tables, one is for deposit record, the other is the balance of account asset.
when we invoke increaseAmount, It will write a deposit record and then invoke a remote service called assignService
-
install a mysql server
-
connect to your db server, and execute sql/init_db.sql to init the table
-
Configure the Db instance address in /src/main/resources/application.yml , including database name, username and password
-
configure the spring.dubbo.registry in application.yml if necessary,if multicast is not ok, for example, you can set it as
zookeeper://localhost:2181
-
start up your seata server, which means the tc role
-
Startup the SeataSpringbootApp .
-
visit http://127.0.0.1:9999/demo//asset/assign , and you will see an exception, which throw by remote service, you can check your asset table, ps: you can vist many times as you wish.