目录
一、Resource
Resource能被ResourceManager管理并且能够关联globalTransaction。
public interface Resource {
// 主从的datasource应该有相同的groupId
String getResourceGroupId();
// 当前datasource或者tccResourceId的resourceId
String getResourceId();
// 获取resource的类型, 有AT、TCC两种
BranchType getBranchType();
}
二、TCCResource
TCCResource实现Resource接口,为用户提供复杂业务sql自定义手动模式
public class TCCResource implements Resource {
private String resourceGroupId = "DEFAULT";
private String appName;
private String actionName;
private Object targetBean;
private Method prepareMethod;
private String commitMethodName;
private Method commitMethod;