Nilesh Trivedi
11/29/2023, 12:23 PM# Tasks are enqueued jobs to specific queues. They emit events like started, success, failure, cancelled as well as custom intermediate events.
# Tasks cannot consume events. Task invoker can cancel those tasks.
# Tasks are triggerred by specific events indicated by their corresponding "when" clause.
# Process is a stateful workflow which orchestrates tasks based on events.
process pizza() do
x = @customer.select_pizza when $start
y = @customer.order_pizza(kind: x.kind) when x
z = @chef.make_pizza(order: y.order) when y
p = y.order.line_items.map do |item| # array processing
subprocess procure(item: item) #invoke a subprocess
end when z
q = @clerk.pack when p.all?
w = @delivery_boy.deliver_pizza(to: y.address) when z
u = @customer.pay_for_pizza when w
v = @customer.eat_pizza when u
success $hunger_satisfied when v
r = @customer.ask_for_pizza when (y or r[-1] + 60.minutes) and w.pending?
s = @clerk.calm_the_customer when r
end
alltom
11/29/2023, 4:30 PMNilesh Trivedi
11/29/2023, 11:58 PMalltom
11/30/2023, 12:23 AMNilesh Trivedi
11/30/2023, 12:25 AMNilesh Trivedi
11/30/2023, 12:28 AMalltom
11/30/2023, 12:29 AMNilesh Trivedi
11/30/2023, 12:29 AMalltom
11/30/2023, 12:30 AMalltom
11/30/2023, 12:31 AMNilesh Trivedi
11/30/2023, 12:52 AMJason Morris
12/01/2023, 5:58 AMNilesh Trivedi
12/01/2023, 6:02 AMdo ... end
is just a construct I copied from Ruby's block syntax.
BPMN has around 120 types of elements including exclusive gateways, parallel gateways which seems highly unnecessary. I'm trying to avoid all those elements with some kind of composable event algebra. I think workflow engines (where some tasks could be done by humans) have been underutilized by developers precisely because of BPMN's complexity.Jason Morris
12/01/2023, 6:15 AM