package com.yeejoin.amos.boot.module.jg.biz.hook;

import io.seata.tm.api.transaction.TransactionHook;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class EsSyncTransactionHook implements TransactionHook {

    private final String xid; // final保证构造后不变

    public EsSyncTransactionHook(String xid) {
        this.xid = xid;
    }

    @Override
    public void beforeBegin() {
        log.info("beforeBegin:{}", xid);
    }

    @Override
    public void afterBegin() {
        log.info("afterBegin:{}", xid);
    }

    @Override
    public void beforeCommit() {
        log.info("beforeCommit:{}", xid);
    }

    @Override
    public void afterCommit() {
        log.info("afterCommit:{}", xid);
    }

    @Override
    public void beforeRollback() {
        log.info("beforeRollback:{}", xid);
    }

    @Override
    public void afterRollback() {
        log.info("afterRollback:{}", xid);
    }

    @Override
    public void afterCompletion() {
        log.info("afterCompletion:{}", xid);
    }
}
