Packages
mozart
0.6.7
1.0.1
1.0.0
0.9.8
0.9.7
0.9.6
0.9.5
0.9.4
0.9.3
0.9.2
0.9.1
0.9.0
0.8.9
0.8.8
0.8.7
0.8.6
0.8.5
0.8.4
0.8.3
0.8.2
0.8.1
0.8.0
0.7.8
0.7.7
0.7.6
0.7.5
0.7.4
0.7.3
0.7.2
0.7.1
0.7.0
0.6.8
0.6.7
0.6.6
0.6.5
0.6.4
0.6.3
0.6.2
0.6.1
0.6.0
0.5.8
0.5.7
0.5.6
0.5.5
0.5.4
0.5.3
0.5.2
0.5.1
0.5.0
0.4.5
0.4.4
0.4.3
0.4.2
0.4.1
0.4.0
0.3.7
0.3.6
0.3.5
0.3.4
0.3.3
0.3.2
0.3.1
0.3.0
0.2.11
0.2.10
0.2.9
0.2.8
0.2.7
0.2.6
0.2.5
0.2.4
0.2.3
0.2.2
0.2.1
0.2.0
0.1.11
0.1.10
0.1.9
0.1.8
0.1.7
0.1.6
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0
Mozart is an Elixir based BPM platform. It provides a powerful and highly readable DSL for implementing executable business process models.
Current section
86 Versions
Jump to
Current section
86 Versions
Compare versions
3
files changed
+61
additions
-31
deletions
| @@ -1,6 +1,6 @@ | |
| 1 1 | {<<"links">>,[{<<"GitHub">>,<<"https://github.com/CharlesIrvineKC/mozart">>}]}. |
| 2 2 | {<<"name">>,<<"mozart">>}. |
| 3 | - {<<"version">>,<<"0.6.6">>}. |
| 3 | + {<<"version">>,<<"0.6.7">>}. |
| 4 4 | {<<"description">>, |
| 5 5 | <<"Mozart is a BPM platform written in Elixir. It is currently in active development,\nbut it has sufficient functionality for the development of BPM POCs.">>}. |
| 6 6 | {<<"elixir">>,<<"~> 1.16">>}. |
| @@ -194,7 +194,7 @@ defmodule Mozart.BpmProcess do | |
| 194 194 | defevent "exit loan decision 1", |
| 195 195 | process: "exit a user task 1", |
| 196 196 | exit_task: "user task 1", |
| 197 | - selector: &BpmAppWithEvent.event_selector/1 do |
| 197 | + selector: :event_selector do |
| 198 198 | prototype_task("event 1 prototype task 1") |
| 199 199 | prototype_task("event 1 prototype task 2") |
| 200 200 | end |
| @@ -284,6 +284,37 @@ defmodule Mozart.BpmProcess do | |
| 284 284 | end |
| 285 285 | end |
| 286 286 | |
| 287 | + @doc false |
| 288 | + defmacro route(do: tasks) do |
| 289 | + quote do |
| 290 | + @capture_subtasks true |
| 291 | + unquote(tasks) |
| 292 | + first = hd(@subtasks) |
| 293 | + @subtasks set_next_tasks(@subtasks) |
| 294 | + @subtask_sets [@subtasks | @subtask_sets] |
| 295 | + @route_task_names @route_task_names ++ [first.name] |
| 296 | + @subtasks [] |
| 297 | + @capture_subtasks false |
| 298 | + end |
| 299 | + end |
| 300 | + |
| 301 | + @doc """ |
| 302 | + Used to define a task that executes only when a condition (function) |
| 303 | + evaluates to true (a truthy value). When the condition evaluates to |
| 304 | + false, execution proceeds directly to the next task. |
| 305 | + |
| 306 | + Example: |
| 307 | + |
| 308 | + ``` |
| 309 | + defprocess "process with conditional task" do |
| 310 | + prototype_task("fast initial credit check") |
| 311 | + conditional_task "additional credit check", condition: :initial_check_inconclusive do |
| 312 | + prototype_task("extensive credit check") |
| 313 | + end |
| 314 | + prototype_task("report credit check results") |
| 315 | + end |
| 316 | + ``` |
| 317 | + """ |
| 287 318 | defmacro conditional_task(name, options, do: tasks) do |
| 288 319 | quote do |
| 289 320 | options = unquote(options) |
| @@ -305,36 +336,18 @@ defmodule Mozart.BpmProcess do | |
| 305 336 | end |
| 306 337 | |
| 307 338 | @doc """ |
| 308 | - Used to define one of many parallel execution paths within a parallel task. Arguments are a task name a block of tasks. |
| 339 | + Used to a sequence of tasks that repeat as long as a condition evaluates to |
| 340 | + a truthy value. |
| 309 341 | |
| 342 | + Example: |
| 310 343 | ``` |
| 311 | - defprocess "two parallel routes process" do |
| 312 | - parallel_task "a parallel task" do |
| 313 | - route do |
| 314 | - user_task("1", groups: "admin") |
| 315 | - user_task("2", groups: "admin") |
| 316 | - end |
| 317 | - route do |
| 318 | - user_task("3", groups: "admin") |
| 319 | - user_task("4", groups: "admin") |
| 320 | - end |
| 344 | + defprocess "account overdue process" do |
| 345 | + repeat_task "notify customer", condition: :third_notice_sent do |
| 346 | + service_task("send overdue notice", function: :record_notifiction_sent) |
| 321 347 | end |
| 322 348 | end |
| 323 349 | ``` |
| 324 350 | """ |
| 325 | - defmacro route(do: tasks) do |
| 326 | - quote do |
| 327 | - @capture_subtasks true |
| 328 | - unquote(tasks) |
| 329 | - first = hd(@subtasks) |
| 330 | - @subtasks set_next_tasks(@subtasks) |
| 331 | - @subtask_sets [@subtasks | @subtask_sets] |
| 332 | - @route_task_names @route_task_names ++ [first.name] |
| 333 | - @subtasks [] |
| 334 | - @capture_subtasks false |
| 335 | - end |
| 336 | - end |
| 337 | - |
| 338 351 | defmacro repeat_task(name, options, do: tasks) do |
| 339 352 | quote do |
| 340 353 | options = unquote(options) |
| @@ -365,6 +378,24 @@ defmodule Mozart.BpmProcess do | |
| 365 378 | String.split(groups_string, ",") |> Enum.map(fn s -> String.trim(s) end) |
| 366 379 | end |
| 367 380 | |
| 381 | + @doc """ |
| 382 | + Used to reroute a process flow off the typical execution path (off the 'happy path'). |
| 383 | + |
| 384 | + Example: |
| 385 | + ``` |
| 386 | + defprocess "act on one of multiple events" do |
| 387 | + prototype_task("create order") |
| 388 | + receive_task("receive payment details", selector: :receive_payment_details) |
| 389 | + reroute_task "payment period expired", condition: :payment_period_expired do |
| 390 | + prototype_task("cancel order due to timeout") |
| 391 | + end |
| 392 | + reroute_task "order canceled", condition: :order_canceled do |
| 393 | + prototype_task("cancel order due to order cancelation") |
| 394 | + end |
| 395 | + prototype_task("process payment") |
| 396 | + end |
| 397 | + ``` |
| 398 | + """ |
| 368 399 | defmacro reroute_task(name, options, do: tasks) do |
| 369 400 | quote do |
| 370 401 | options = unquote(options) |
| @@ -396,11 +427,11 @@ defmodule Mozart.BpmProcess do | |
| 396 427 | ``` |
| 397 428 | defprocess "two case process" do |
| 398 429 | case_task "yes or no" do |
| 399 | - case_i &ME.x_less_than_y/1 do |
| 430 | + case_i :x_less_than_y do |
| 400 431 | user_task("1", groups: "admin") |
| 401 432 | user_task("2", groups: "admin") |
| 402 433 | end |
| 403 | - case_i &ME.x_greater_or_equal_y/1 do |
| 434 | + case_i :x_greater_or_equal_y do |
| 404 435 | user_task("3", groups: "admin") |
| 405 436 | user_task("4", groups: "admin") |
| 406 437 | end |
| @@ -426,7 +457,7 @@ defmodule Mozart.BpmProcess do | |
| 426 457 | ``` |
| 427 458 | defprocess "two case process" do |
| 428 459 | case_task "yes or no" do |
| 429 | - case_i &ME.x_less_than_y/1 do |
| 460 | + case_i :x_less_than_y do |
| 430 461 | user_task("1", groups: "admin") |
| 431 462 | user_task("2", groups: "admin") |
| 432 463 | end |
| @@ -4,7 +4,7 @@ defmodule Mozart.MixProject do | |
| 4 4 | def project do |
| 5 5 | [ |
| 6 6 | app: :mozart, |
| 7 | - version: "0.6.6", |
| 7 | + version: "0.6.7", |
| 8 8 | elixir: "~> 1.16", |
| 9 9 | elixirc_paths: ["lib", "test/support"], |
| 10 10 | start_permanent: Mix.env() == :prod, |
| @@ -44,7 +44,6 @@ defmodule Mozart.MixProject do | |
| 44 44 | "guides/app_overview.md", |
| 45 45 | "guides/first_process_execution.md", |
| 46 46 | "guides/task_types.md", |
| 47 | - "guides/home_loan.md", |
| 48 47 | "guides/event_types.md" |
| 49 48 | ] |
| 50 49 | end |