seata Provide annotated saga mode

qv7cva1a  于 2022-12-31  发布在  其他
关注(0)|答案(2)|浏览(157)

Why you need it?

Provide annotated saga mode:

  • At present, SEATA has realized the orchestration Saga mode. The annotated saga can write business process directly through code. The cost of business process development is lower. Here is the pseudo code of annotation mode:
@SagaCompensatable(method="compensateOne", retryCount=3, retryIntervalSeconds=1.5, retryBackoffRate=1.5)
public Map<String, Object> one(String id, BeanA beanA){
    return null;
}

public boolean compensateOne(Context context){
    return true;
}

@SagaTransactional(compensateBy=CompensationException.class, lazyStart=true)
public Map<String, Object> processA(String id, BeanA beanA){
    Map<String, Object> oneResult = one(id, beanA);
    if("SUCCESS".equals(oneResult.get("RETURN_CODE"))){
        Map<String, Object> twoResult = two(id, beanA);
        return twoResult;
    }
    else{
        throw new CompensationException("ERROR_CODE", args);
    }
}
neskvpey

neskvpey1#

Hey @long187

I am interested to work on this project, may I know more details to explore and draft a proposal.

Cheers
Rohit

webghufk

webghufk2#

有过中型项目重构经历,了解阿里编程基本规范,对代码要求严格,请问是已经写好伪代码,直接写业务嘛?

相关问题