【发布时间】:2021-02-09 09:39:06
【问题描述】:
假设我的系统要求您在开始使用之前添加一些余额。因此,假设它会在每个月的第 30 天扣除/支出您的余额。所以我使用 AxonFramework 结合 spring Scheduled annotation 所以代码可能看起来像这样。
@CommandHandler
@Scheduled(cron = "** cron for every 30th **")
fun handle(command: ExpendNetflixUserCommand){
if (user.balance < netflixPackage.price){
AggregateLifecycle.apply(command.toNetflixUserDisabled())
throw IllegalArgumentException("Insufficient balance, please add.")
}
AggregateLifecycle.apply(command.toNetflixUserExpended())
}
所以我的问题是,如果它在 30 日并且我的系统即将计算这些付款,但突然服务中断/中断并且它在 31 日重新开始工作,它会重新计算之前的付款吗?所以如果不能,你能建议我应该如何处理这种情况。
【问题讨论】:
标签: spring spring-boot kotlin axon