package com.brilliance.isc.common.transaction.eventlistener;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.transaction.event.TransactionPhase;
import org.springframework.transaction.event.TransactionalEventListener;

@Slf4j
@Component
public class RollBackTransactionalEventListener {
    public static final String Srvs = "LMA,LMO";

    @TransactionalEventListener(phase = TransactionPhase.AFTER_ROLLBACK)
    public void rollbackEvent(EventVo eventVo) throws Exception {
        if (Srvs.contains(eventVo.getSrv())) {
            eventVo.getRollback().dorollback();
            log.info("-----------------------正在进行回滚操作 回滚服务为{}",eventVo.getSrv());
        }
    }
}
