Skip to content

Commit

Permalink
fix apache#201 add sample module sql script (apache#202)
Browse files Browse the repository at this point in the history
* fix apache#142 delete defaultEventExecutorGroup

* fix apache#139 netty heartbeat configurable

* fix apache#149 (long)->Number.longValue

* revert OrderServiceImpl, change version 0.1.2-SNAPSHOT

* fix apache#201 add sample module sql script

* fix apache#206 optimize sample log print location.
  • Loading branch information
slievrly authored Jan 21, 2019
1 parent d5e8c70 commit fb8f805
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class BusinessServiceImpl implements BusinessService {
@Override
@GlobalTransactional(timeoutMills = 300000, name = "dubbo-demo-tx")
public void purchase(String userId, String commodityCode, int orderCount) {
LOGGER.info("purchase begin ... xid: " + RootContext.getXID());
storageService.deduct(commodityCode, orderCount);
orderService.create(userId, commodityCode, orderCount);
throw new RuntimeException("xxx");
Expand All @@ -60,9 +61,6 @@ public static void main(String[] args) {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
new String[] {"dubbo-business.xml"});
final BusinessService business = (BusinessService)context.getBean("business");

LOGGER.info("Main business begin ... xid: " + RootContext.getXID());
business.purchase("U100001", "C00321", 2);
LOGGER.info("Main business end ... xid: " + RootContext.getXID());
}
}
28 changes: 28 additions & 0 deletions examples/src/main/resources/sql/dubbo_biz.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
DROP TABLE IF EXISTS `storage_tbl`;
CREATE TABLE `storage_tbl` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`commodity_code` varchar(255) DEFAULT NULL,
`count` int(11) DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE KEY (`commodity_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `order_tbl`;
CREATE TABLE `order_tbl` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` varchar(255) DEFAULT NULL,
`commodity_code` varchar(255) DEFAULT NULL,
`count` int(11) DEFAULT 0,
`money` int(11) DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `account_tbl`;
CREATE TABLE `account_tbl` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` varchar(255) DEFAULT NULL,
`money` int(11) DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
12 changes: 12 additions & 0 deletions examples/src/main/resources/sql/undo_log.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
CREATE TABLE `undo_log` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`branch_id` bigint(20) NOT NULL,
`xid` varchar(100) NOT NULL,
`rollback_info` longblob NOT NULL,
`log_status` int(11) NOT NULL,
`log_created` datetime NOT NULL,
`log_modified` datetime NOT NULL,
`ext` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `idx_unionkey` (`xid`,`branch_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

0 comments on commit fb8f805

Please sign in to comment.