review v1

examples/review/temporal/review.flow · dandori doc

Jev scores an application and says how sure it is, and a rule decides whether the verdict is acted on at once or goes to a person for approval, due by 17:00 on the third business day after it comes in: approving at once asks more certainty than rejecting at once. Written for Temporal: the scoring is an activity dandori writes, which calls Jev with TypeSafe's key (TYPESAFE_API_KEY) on the workers of its own task queue, which may be written in another language, and so does the notice, an activity you write; the rule and the date of the approval run in the worker of the workflow; the approver's tool answers the callback by the update the generated client sends

flow
on failureaskon timeoutapprove, rejectreview v151 r = score(…)jev · jev-1.13.0retry 2 times every 10 seconds on busy, overloaded · timeout 10 seconds52 fail Unscorable"Could not score application {application.id}"53 d = policy(…)rule review_policy.ruletimeout, failure → the workflow fails!54 match d.decision57 due = approvals.due(…)dates approval_terms.caltimeout, failure → the workflow fails!58 a = ask_for_approval(…)a task you write, answered by a callbacktimeout until bytimeout → line 59; failure → the workflow fails!59 fail NoAnswer"No approval by 17:00 on the third business day"60 notify(…)a task you writetimeout, failure → the workflow fails!61 succeed verdict = approve62 notify(…)a task you writetimeout, failure → the workflow fails!63 succeed verdict = r.verdict

Calls

LineCallCallsRetriesTimeoutWhen it fails
51r = score(…)jev · jev-1.13.02 times every 10 seconds (busy, overloaded)10 secondsbusy, overloaded, timeout, failure → line 52
53d = policy(…)rule review_policy.rule2 times, after 1 second and 2 (failure, timeout)10 secondstimeout, failure → the workflow fails
57due = approvals.due(…)the date due of approval_terms.cal2 times, after 1 second and 2 (failure, timeout)10 secondstimeout, failure → the workflow fails
58a = ask_for_approval(…)a task you write, answered by a callback—1 minute to hand the id on, then until due.attimeout → line 59
failure → the workflow fails
60notify(…)a task you write, idempotent——timeout, failure → the workflow fails
62notify(…)a task you write, idempotent——timeout, failure → the workflow fails

Ends

LineEnd
52fail Unscorable "Could not score application {application.id}"
59fail NoAnswer "No approval by 17:00 on the third business day"
61succeed verdict = approve
63succeed verdict = r.verdict