-
Notifications
You must be signed in to change notification settings - Fork 27
Description
Let's say I have a createOrg route in my app, which is called when a user attempts to create a new organisation. In this route, I create an org record in my DB and a Stripe Customer. To ensure both operations succeed or fail as a whole, I would like to use a QStash Workflow. For this, I need the createOrg route to know if the workflow succeeded or failed so I can respond to the user appropriately. Let's say the user is redirected to a payments page after submitting the CreateOrgForm. I need to know the Stripe Customer has been successfully created at this point. I don't think this is currently possible, but I think it's a pretty essential feature. I imagine you could add a rollback callback to context.run, which executes in the background after the Workflow returns an error, to rollback the org record creation in the DB. There may already be a way to solve this, or maybe Workflows aren't even the right tool for this sort of operation?