Skip to content

Commit

Permalink
发布1.0.1版本
Browse files Browse the repository at this point in the history
  • Loading branch information
xlorne committed Nov 22, 2017
1 parent fb6fbbf commit 39bdb8e
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 21 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
2. 兼容SpringCloud、Dubbo、motan
3. 使用简单,低依赖,代码完全开源
4. 基于切面的强一致性事务框架
5. 高可用,模块可以依赖Dubbo或SpringCloud的集群方式做集群化,TxManager也可以做集群化
5. 高可用,模块可以依赖RPC模块做集群化,TxManager也可以做集群化
6. 支持本地事务和分布式事务共存
7. 支持事务补偿机制,增加事务补偿决策提醒
8. 增加插件拓展机制
8. 添加插件拓展机制


## 原理介绍
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ public void channelActive(ChannelHandlerContext ctx) throws Exception {
/**
* 当客户端的所有ChannelHandler中4s内没有write事件,则会触发userEventTriggered方法
*
* @param ctx
* @param evt
* @param ctx 管道
* @param evt 状态
* @throws Exception 异常数据
*/
@Override
Expand Down
2 changes: 1 addition & 1 deletion tx-manager/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.codingapi</groupId>
<artifactId>tx-manager</artifactId>
<version>4.0.0</version>
<version>4.0.1</version>
<packaging>jar</packaging>

<name>tx-manager</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void run() {
logger.error("补偿回调结果->" + res);
if (configReader.isCompensateAuto()) {
//自动补偿,是否自动执行补偿
if ("success".equalsIgnoreCase(res)) {
if (res.contains("success")||res.contains("SUCCESS")) {
//自动补偿
autoCompensate(compensateKey, transactionCompensateMsg);
}
Expand Down
23 changes: 18 additions & 5 deletions tx-manager/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,25 @@ tm.socket.port=8898
# 最大socket连接数
tm.socket.maxconnection=100

#事务补偿记录回调地址(rest api 地址,post json格式)
#json格式如下:{"address":"192.168.0.4:8081","className":"com.example.demo.service.impl.DemoServiceImpl","currentTime":1510490201118,"data":"C5IBLWNvbS5leGFtcGxlLmRlbW8uc2VydmljZS5pbXBsLkRlbW9TZXJ2aWNlSW1wbAwSBHNhdmUbehBqYXZhLmxhbmcuT2JqZWN0GAAQARwjeg9qYXZhLmxhbmcuQ2xhc3MYABABJA==","groupId":"FxGRURve","method":"save","model":"demo1","time":101,"uniqueKey":"1dc8781821747b7050d8ebc23a4fa343"}
tm.compensate.notifyUrl=http://www.baidu.com
#事务自动补偿


#事务自动补偿 (true:开启,false:关闭)
# 说明:
# 开启自动补偿以后,必须要配置 tm.compensate.notifyUrl 地址,仅当tm.compensate.notifyUrl 在请求补偿确认时返回success或者SUCCESS时,才会执行自动补偿,否则不会自动补偿。
# 关闭自动补偿,当出现数据时也会 tm.compensate.notifyUrl 地址。
# 当tm.compensate.notifyUrl 无效时,不影响TxManager运行,仅会影响自动补偿。
tm.compensate.auto=false
#补偿失败,再次尝试间隔(秒)

#事务补偿记录回调地址(rest api 地址,post json格式)
#json格式如下:
#该请求是在通知补偿事务时的补偿记录数据请求
#{"groupId":"TtQxTwJP","action":"compensate","json":"{\"address\":\"133.133.5.100:8081\",\"className\":\"com.example.demo.service.impl.DemoServiceImpl\",\"currentTime\":1511356150413,\"data\":\"C5IBLWNvbS5leGFtcGxlLmRlbW8uc2VydmljZS5pbXBsLkRlbW9TZXJ2aWNlSW1wbAwSBHNhdmUbehBqYXZhLmxhbmcuT2JqZWN0GAAQARwjeg9qYXZhLmxhbmcuQ2xhc3MYABABJCo/cHVibGljIGludCBjb20uZXhhbXBsZS5kZW1vLnNlcnZpY2UuaW1wbC5EZW1vU2VydmljZUltcGwuc2F2ZSgp\",\"groupId\":\"TtQxTwJP\",\"methodStr\":\"public int com.example.demo.service.impl.DemoServiceImpl.save()\",\"model\":\"demo1\",\"state\":0,\"time\":36,\"txGroup\":{\"groupId\":\"TtQxTwJP\",\"hasOver\":1,\"isCommit\":0,\"list\":[{\"address\":\"133.133.5.100:8899\",\"isCommit\":0,\"isGroup\":0,\"kid\":\"wnlEJoSl\",\"methodStr\":\"public int com.example.demo.service.impl.DemoServiceImpl.save()\",\"model\":\"demo2\",\"modelIpAddress\":\"133.133.5.100:8082\",\"modelName\":\"/133.133.5.100:64153\",\"notify\":1,\"uniqueKey\":\"bc13881a5d2ab2ace89ae5d34d608447\"}],\"nowTime\":0,\"startTime\":1511356150379,\"state\":1},\"uniqueKey\":\"be6eea31e382f1f0878d07cef319e4d7\"}"}
#该请求是在执行完补偿事务以后的反馈结果请求
#{"resState":true,"groupId":"TtQxTwJP","action":"notify"}

tm.compensate.notifyUrl=http://ip:port/path

#补偿失败,再次尝试间隔(秒),最大尝试次数3次,当超过3次即为补偿失败。
tm.compensate.tryTime=30


Expand Down
4 changes: 2 additions & 2 deletions tx-manager/src/main/resources/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8"/>
<title>TxManager v4.0.0</title>
<title>TxManager v4.0.1</title>
<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="static/bootstrap/css/bootstrap.min.css"/>
<script src="static/jquery/jquery.min.js"></script>
Expand All @@ -24,7 +24,7 @@
<body>
<div class="container">

<h3 class="text-center">TxManagerV4.0.0 服务已启动</h3>
<h3 class="text-center">TxManagerV4.0.1 服务已启动</h3>
<div class="table-responsive">
<table class="table table-bordered table-striped">
<colgroup>
Expand Down
19 changes: 12 additions & 7 deletions tx-manager/src/main/resources/static/log.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@
<div class="table-responsive">
<table class="table table-bordered table-striped">
<colgroup>
<col class="col-xs-4"/>
<col class="col-xs-8"/>
<col class="col-xs-4"/>
</colgroup>
<thead>
<tr>
<th>模块名称</th>
<th>补偿数量</th>
<th>条数</th>
</tr>
</thead>
<tbody id="list">
Expand All @@ -67,12 +67,11 @@
</div>
</div>

<div class="col-lg-1 col-md-1">
<div class="col-lg-1 col-md-1" style="margin: 0;padding: 0">
<div class="table-responsive">
<table class="table table-bordered table-striped">
<table class="table table-bordered table-striped" >
<colgroup>
<col class="col-xs-4"/>
<col class="col-xs-8"/>
<col class="col-xs-12"/>
</colgroup>
<thead>
<tr>
Expand All @@ -90,11 +89,17 @@
<div class="col-lg-9 col-md-9">
<div class="table-responsive">
<table class="table table-bordered table-striped">
<colgroup>
<col class="col-xs-2"/>
<col class="col-xs-6"/>
<col class="col-xs-1"/>
<col class="col-xs-3"/>
</colgroup>
<thead>
<tr>
<th>记录时间</th>
<th>执行方法</th>
<th>执行时间(毫秒)</th>
<th>执行时间</th>
<th>操作</th>
</tr>
</thead>
Expand Down
2 changes: 1 addition & 1 deletion tx-manager/src/main/resources/static/static/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var init = function () {

var tr = '<tr>' +
'<td><a class="model-name" href="#">' + v['name'] + '</a></td>' +
'<td><a href="#">' + v['count'] + '</a></td>' +
'<td><span>' + v['count'] + '</span></td>' +
'</tr>';
list.append(tr);
}
Expand Down

0 comments on commit 39bdb8e

Please sign in to comment.