- Newest
- Most votes
- Most comments
There is not transaction scope in EventBridge. Each target handles the events it receives in an independent way. As you do need some coordination between them I would recommend that you invoke a Step Functions state machine from EventBridge. The state machine will implement a Saga Pattern to perform both operations and roll back in case of failures.
EventBridge by itself is not transactional.
The Lambda can do both create User in DB and create Coupon. If this fails, you can handle this in your Lambda function and then throw an error.
EventBridge has an retry for failed Lambda functions.
As @Uri explained, this would be more a case for coordinating using Step Functions, here's one example of implementation https://github.com/aws-samples/aws-step-functions-saga-pattern-with-sam
Relevant content
- asked 2 months ago
- Accepted Answerasked 2 years ago
- Accepted Answerasked a day ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
This situation can happen. The user is created in the DB, but the coupon retrieval has failed. Because the coupon retrieval also has failed, the created user also should be rolled back. Deleting the already created user like it was created seems to the solution if there is no transaction scope can be created around both those operations. Do you see any other option to add transaction scope?