would really appreciate your help, in terms of the implementation details, as well as the 2 clarifying questions I have below:
Context:
Creating an offers promotion workflow. The offer has an expiration date (We start counting down after the offer is accepted.)
User can choose to decline offer (workflow then stops)
Once offer is accepted, they will have 7 days to try and redeem cashback points. Once they meet the cashback points requirement, we will credit the the points to their account
1st question: is the below logic correct? and That I am using signals.
2nd question:, I am listening for signals in the parent workflow on say 'parentSignal' channel. Listening for "ACCEPTED", "REJECTED", "CANCELLED".
In the child workflow I am listening for "10%CASHBACK", "50%CASHBACK" "100%CASHBACK" as well as "CANCELLED" as the admin can cancel whenever he/she wants to. IS THIS THE CORRECT WAY TO TRIGGER WORKFLOWS?
How I'm thinking of writing the workflow (however, I can't seem to get it to work properly in the Cadence GUI, when I try to emit different signals)
Parent workflow (OfferWorkflow)
Listen for signal (signal received from external service)
if accept, start execute Child Workflow (cashback workflow)
if reject, end workflow
if cancelled (by admin, end workflow, cancel any cashback progress)
child workflow (cashbackWorkflow, with expiration time)
Listen for signal, once 10% of cashback requirement is met (send email)
Listen for signal, once 50% cashback is met (send email)
Listen for 100% cashback is met
// Perform credit (make call to external function)
There will be an external service that will be sending signals. The external service knows the progress. For example, if a user spends up to 10% of cashback, then we send a signal to the cadence workflow.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…