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: 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 runs 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 v149 r = score(…)jev · jev-1.13.0retry 2 times every 10 seconds on busy, overloaded · timeout 10 seconds50 fail Unscorable"Could not score application {application.id}"51 d = policy(…)rule review_policy.ruletimeout, failure → the workflow fails!52 match d.decision55 a = ask_for_approval(…)a task you write, answered by a callbacktimeout 3 daystimeout → line 56; failure → the workflow fails!56 fail NoAnswer"No approval in three days"57 notify(…)a task you writetimeout, failure → the workflow fails!58 succeed verdict = approve59 notify(…)a task you writetimeout, failure → the workflow fails!60 succeed verdict = r.verdict

Calls

LineCallCallsRetriesTimeoutWhen it fails
49r = score(…)jev · jev-1.13.02 times every 10 seconds (busy, overloaded)10 secondsbusy, overloaded, timeout, failure → line 50
51d = policy(…)rule review_policy.rule2 times, after 1 second and 2 (failure)—timeout, failure → the workflow fails
55a = ask_for_approval(…)a task you write, answered by a callback—3 daystimeout → line 56
failure → the workflow fails
57notify(…)a task you write, idempotent——timeout, failure → the workflow fails
59notify(…)a task you write, idempotent——timeout, failure → the workflow fails

Ends

LineEnd
50fail Unscorable "Could not score application {application.id}"
56fail NoAnswer "No approval in three days"
58succeed verdict = approve
60succeed verdict = r.verdict