You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
932 B
40 lines
932 B
package com.soa.microservice.core;
|
|
|
|
/**
|
|
* 事务管理器接口
|
|
* 定义分布式事务的管理操作
|
|
*/
|
|
public interface TransactionManager {
|
|
/**
|
|
* 创建并开始一个新事务
|
|
* @return 事务ID
|
|
*/
|
|
String beginTransaction();
|
|
|
|
/**
|
|
* 加入参与者到事务中
|
|
* @param transactionId 事务ID
|
|
* @param participant 事务参与者
|
|
*/
|
|
void addParticipant(String transactionId, TransactionParticipant participant);
|
|
|
|
/**
|
|
* 提交事务
|
|
* @param transactionId 事务ID
|
|
* @return 是否提交成功
|
|
*/
|
|
boolean commitTransaction(String transactionId);
|
|
|
|
/**
|
|
* 回滚事务
|
|
* @param transactionId 事务ID
|
|
*/
|
|
void rollbackTransaction(String transactionId);
|
|
|
|
/**
|
|
* 获取事务状态
|
|
* @param transactionId 事务ID
|
|
* @return 事务状态
|
|
*/
|
|
TransactionStatus getTransactionStatus(String transactionId);
|
|
} |