package com.elab.mq.api.transaction;

import com.aliyun.openservices.shade.com.alibaba.rocketmq.client.producer.LocalTransactionState;

/**
 * 本地事务消息
 *
 * @author Liukx
 * @create 2018-04-10 20:15
 * @email liukx@elab-plus.com
 **/
public enum LocalTransactionStateEnum {
    COMMIT_MESSAGE,
    ROLLBACK_MESSAGE,
    UNKNOW;

    public static LocalTransactionState getAction(LocalTransactionStateEnum action) {
        if (LocalTransactionState.COMMIT_MESSAGE.name().equals(action.name())) {
            return LocalTransactionState.COMMIT_MESSAGE;
        } else if (LocalTransactionState.ROLLBACK_MESSAGE.name().equals(action.name())) {
            return LocalTransactionState.ROLLBACK_MESSAGE;
        }
        return LocalTransactionState.UNKNOW;
    }
}
