Created
April 25, 2024 18:02
-
-
Save pit/9c35f9fcd441413b39cde48d55a54c04 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun requestProcess(requestDto: RequestDto) { | |
val saga = Saga(options) | |
try { | |
log.info("Creating request") | |
val requestId = requestActivity.create(requestDto) | |
saga.addCompensation(requestActivity::cancelCreate, requestId) | |
log.info("Creating request($requestId) party") | |
val requestPartyId = partyActivity.createParty(requestId, requestDto) | |
saga.addCompensation(partyActivity::cancelCreateParty, requestPartyId) | |
log.info("Linking party($requestPartyId) to request($requestId)") | |
val requestPartyLinkRef = requestLinkActivity.linkParty(requestId, requestPartyId) | |
saga.addCompensation(requestLinkActivity::unlinkParty, requestPartyLinkRef) | |
notifyClient.sendEmail(requestId, requestPartyId) | |
} catch (e: ActivityFailure) { | |
saga.compensate() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment