Your SlideShare is downloading. ×
Ruote in 20 Minutes
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Ruote in 20 Minutes

12,622
views

Published on

A quick introduction to the Ruote workflow and BPM engine by John Mettraux, presented by myself at the third monthly Ruby on Beer meetup.

A quick introduction to the Ruote workflow and BPM engine by John Mettraux, presented by myself at the third monthly Ruby on Beer meetup.

Published in: Technology

0 Comments
9 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
12,622
On Slideshare
0
From Embeds
0
Number of Embeds
18
Actions
Shares
0
Downloads
164
Comments
0
Likes
9
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. ruote - open source ruby workflow and bpm engine Developed by John Mettraux jmettraux.wordpress.com Presented by Kenneth Kalmer in 20 minutes opensourcery.co.za
  • 2. Workflows? BPM?
    • “Improved state machine”
    • 3. Long running processes, long-lived process interpreter
    • 4. Diverse participants
    • 5. Complex rules & decisions
    • 6. Implement clearly defined business processes
  • 7. Joe's Mortgages
    • Applies on your behalf at seven different institutions
    • 8. Selects the best deal for you
    • 9. Handles application for you
    • 10. You sign
    • 11. You buy
    • 12. You pay
  • 13. State Machine
  • 23. Rule: Notify Client when 4 quotes are received aasm_state :pending_four_left aasm_state :pending_three_left aasm_state :pending_two_left aasm_state :pending_one_left aasm_state :pending_but_notified_client ... aasm_state :is_this_ridiculous_or_what?
  • 24. Rule: Wait up to 7 days for quotes aasm_state :pending_four_remaining_timeout aasm_state :pending_three_remaining_timout aasm_state :pending_two_remaining_timout aasm_state :pending_one_remaining_timout … aasm_state :call_recruiter_for_new_dev!
  • 25. Recap
    • State machines are only valuable when they have a few, well defined states
    • 26. Tempted to setup hundreds of states, with complex transitions
    • 27. State machines help manage the results of real life processes, not the processes
  • 28. Modified State Machine class Mortgage aasm_initial_state :pending aasm_state :pending aasm_state :quoted aasm_state :applied aasm_state :approved aasm_state :rejected end
  • 29. Enter ruote
    • Clearly defined DSL for workflow
    • 30. Clearly defined processes
      • Expressions
      • 31. Participants
    • Concurrent tasks
    • 32. Timeouts
    • 33. Easy decision making
  • 34. Expressions
    • Utility statements that give structure to your processes
    • 35. Conditional statements that facilitate branching and merging patterns
  • 36. Participants
    • A point in the process where work gets done
    • 37. Can be automated code
    • 38. Can be human interaction
    • 39. Ruote provides plenty of participants out the box
    • 40. Breeze to write new ones
  • 41. First round: Participants class MortgageApplication < OpenWFE::ProcessDefinition sequence do institution_1 :activity => 'Mortgage Quote' institution_2 :activity => 'Mortgage Quote' institution_3 :activity => 'Mortgage Quote' institution_4 :activity => 'Mortgage Quote' institution_5 :activity => 'Mortgage Quote' institution_6 :activity => 'Mortgage Quote' institution_7 :activity => 'Mortgage Quote' end end
  • 42. Problems so far
    • Will request quotations in serial
    • 43. 14 days to complete if each institution takes 2 days on average
  • 44. Concurrency!
    • Not the Erlang kind, the business kind
    • 45. Send all requests in one go, and continue the process once we've received at least 4 quotes
    • 46. Also, quote process may not take longer than 7 days to complete
  • 47. Second round: Concurrency and Timeout class MortgageApplication < OpenWFE::ProcessDefinition sequence do timeout :after => '7d' do concurrence :count => 4 do institution_1 :activity => 'Mortgage Quote' institution_2 :activity => 'Mortgage Quote' institution_3 :activity => 'Mortgage Quote' institution_4 :activity => 'Mortgage Quote' institution_5 :activity => 'Mortgage Quote' institution_6 :activity => 'Mortgage Quote' institution_7 :activity => 'Mortgage Quote' e nd end end end
  • 48. Achievements so far
    • Quotations requested simultaneously
    • 49. Process will take 7 days at most to complete
    • 50. First 4 institutions stand the chance of earning new business
    • 51. Mortgage is still “pending”
  • 52. Rule: Joe can re-request quotes
    • Joe drives a hard bargain
    • 53. Can request quotes any number of times
    • 54. But, wants to let the client know he's doing his best!
  • 55. Third round: Bargain hard class MortgageApplication < OpenWFE::ProcessDefinition sequence do loop do concurrence :timeout => '7d', :count => 4 do institution_1 :activity => 'Mortgage Quote' # ... e nd joe :activity => 'Review quotes' _break :if => “${f:joe_happy}” email :activity => “Getting new quotes”, :to => “${f:client.email}” end end end
  • 56. Achievements so far
    • Loop used to keep the quote request process running until Joe is happy, or cancels the process
    • 57. Client notified everytime the quote request process starts all over again
    • 58. First glimpse of workitems
    • 59. Mortgage is still “pending”
  • 60. Workitems?
    • The internal “message” passed from participant to participant
    • 61. They're JSON friendly Ruby hashes
    • 62. Participants can modify workitems
    • 63. Processes can be launched with an initial payload, client details in this case, which is accessed through the workitems
    • 64. Workitem attributes accessed in process definitions through the “dollar notation”
  • 65. Quote found, action the client class MortgageApplication < OpenWFE::ProcessDefinition sequence do loop do # ... end secretary :activity => “Send client application forms” end end
  • 66. Application received, apply at institution class MortgageApplication < OpenWFE::ProcessDefinition sequence do # ... secretary :activity => “Send client application forms” participant :ref => “${f:selected_institution}”, :activity => “Apply for mortgage” end end
  • 67. Achievements so far
    • Dynamic participant specification from workitem attributes
    • 68. Another human participant
    • 69. Mortgage now in “applied” state
  • 70. Let Joe Know
    • Joe reviews the results of the application, and notifies the client
    • 71. Might attempt to restart the entire process
  • 72. Joe has last say class MortgageApplication < OpenWFE::ProcessDefinition sequence do # ... participant :ref => “${f:selected_institution}”, :activity => “Apply for mortgage” joe :activity => “Review application results” end end
  • 73. What happens here?
    • Joe will inform the client of the institutions response
    • 74. Mortgage will stay in “applied” state, or move to “approved”/”rejected” states
    • 75. Process ends
  • 76. Possibilities from here
    • Automated decision making
      • Decision tables
      • 77. Better conditional tests
    • Automated response processing, streamlines the feedback loop and decision making
    • 78. Harass institutions that don't respond within 2 days of process timeout
    • 79. Joe improves his handicap
  • 80. Ruote & AASM
    • Great combination
    • 81. Ruote handles business logic, AASM the state
    • 82. AASM becomes skinny, ruote stays declarative
  • 83. More ruote: Listeners
    • Start process, or wait for
      • Messages from SQS
      • 84. Jabber messages
      • 85. Atom feed entries
  • 86. More ruote: Cancel, cursors, replay & redo
    • When processes are cancelled, run sub-processes for “cleanup” tasks
    • 87. Replay failed steps
    • 88. Redo steps based on conditions
    • 89. Jump to any point in the workflow using cursors
  • 90. More ruote: ruote-fluo
    • Graphical representation of process definitions
    • 91. Edit process definitions on the fly
  • 92. More ruote: Active*Participants
    • ActiveRecordParticipant
      • Save workitem information in database
    • ActiveResourceParticipant
      • Interact with any Rails resource as DHH intended you to do
  • 93. Shameless Self Promotion
    • Developed the JabberParticipant and JabberListener now bundled with ruote
    • 94. Added support for daemonizing ruote-rest
    • 95. In talks on refactoring ruote-rest to become preferred “Rails-friendly” implementation of ruote
  • 96. Summary
    • Process definitions built up from expressions
    • 97. Expressions are “steps in the workflow”
    • 98. Participants perform explicit function during workflow
    • 99. Workitems used as “internal messaging” mechanism between expressions/participants
    • 100. The best complement to any state machine implementation
    • 101. Simplifies complex business process implementations
    • 102. You have full control over the entire process
  • 103. Thank You opensourcery.co.za @kennethkalmer openwferu.rubyforge.org #ruote on Freenode groups.google.com/group/openwferu-users @jmettraux