Ruote in 20 Minutes
Upcoming SlideShare
Loading in...5
×
 

Ruote in 20 Minutes

on

  • 16,407 views

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.

Statistics

Views

Total Views
16,407
Views on SlideShare
6,499
Embed Views
9,908

Actions

Likes
9
Downloads
162
Comments
0

24 Embeds 9,908

http://ruote.rubyforge.org 5051
http://www.opensourcery.co.za 2627
http://nvoynov.blogspot.com 1074
http://nvoynov.blogspot.ru 654
http://openwferu.rubyforge.org 328
http://ruote.io 53
http://francescoagati.wordpress.com 30
http://ruote.lambda.io 29
http://www.slideshare.net 18
http://nvoynov.blogspot.de 15
http://translate.googleusercontent.com 10
http://nvoynov.blogspot.fr 3
http://localhost 3
http://nvoynov.blogspot.co.il 2
http://nvoynov.blogspot.com.au 2
http://nvoynov.blogspot.ca 1
http://www.slideee.com 1
http://localhost:4331 1
http://nvoynov.blogspot.co.uk 1
http://ruote.rubyforge.org. 1
http://webcache.googleusercontent.com 1
http://www.linkedin.com 1
http://xss.yandex.net 1
http://nvoynov.blogspot.fi 1
More...

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Ruote in 20 Minutes Ruote in 20 Minutes Presentation Transcript

  • 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
  • Workflows? BPM?
    • “Improved state machine”
    • Long running processes, long-lived process interpreter
    • Diverse participants
    • Complex rules & decisions
    • Implement clearly defined business processes
  • Joe's Mortgages
    • Applies on your behalf at seven different institutions
    • Selects the best deal for you
    • Handles application for you
    • You sign
    • You buy
    • You pay
  • State Machine
    • :requested
    • :evaluation
    • :acquired
    • :accepted
    • :applied
    • :approved
    • Where?
    • When?
    • Rate?
    • Comparison?
    • Who?
  • 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?
  • 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!
  • Recap
    • State machines are only valuable when they have a few, well defined states
    • Tempted to setup hundreds of states, with complex transitions
    • State machines help manage the results of real life processes, not the processes
  • 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
  • Enter ruote
    • Clearly defined DSL for workflow
    • Clearly defined processes
      • Expressions
      • Participants
    • Concurrent tasks
    • Timeouts
    • Easy decision making
  • Expressions
    • Utility statements that give structure to your processes
    • Conditional statements that facilitate branching and merging patterns
  • Participants
    • A point in the process where work gets done
    • Can be automated code
    • Can be human interaction
    • Ruote provides plenty of participants out the box
    • Breeze to write new ones
  • 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
  • Problems so far
    • Will request quotations in serial
    • 14 days to complete if each institution takes 2 days on average
  • Concurrency!
    • Not the Erlang kind, the business kind
    • Send all requests in one go, and continue the process once we've received at least 4 quotes
    • Also, quote process may not take longer than 7 days to complete
  • 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
  • Achievements so far
    • Quotations requested simultaneously
    • Process will take 7 days at most to complete
    • First 4 institutions stand the chance of earning new business
    • Mortgage is still “pending”
  • Rule: Joe can re-request quotes
    • Joe drives a hard bargain
    • Can request quotes any number of times
    • But, wants to let the client know he's doing his best!
  • 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
  • Achievements so far
    • Loop used to keep the quote request process running until Joe is happy, or cancels the process
    • Client notified everytime the quote request process starts all over again
    • First glimpse of workitems
    • Mortgage is still “pending”
  • Workitems?
    • The internal “message” passed from participant to participant
    • They're JSON friendly Ruby hashes
    • Participants can modify workitems
    • Processes can be launched with an initial payload, client details in this case, which is accessed through the workitems
    • Workitem attributes accessed in process definitions through the “dollar notation”
  • Quote found, action the client class MortgageApplication < OpenWFE::ProcessDefinition sequence do loop do # ... end secretary :activity => “Send client application forms” end end
  • 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
  • Achievements so far
    • Dynamic participant specification from workitem attributes
    • Another human participant
    • Mortgage now in “applied” state
  • Let Joe Know
    • Joe reviews the results of the application, and notifies the client
    • Might attempt to restart the entire process
  • 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
  • What happens here?
    • Joe will inform the client of the institutions response
    • Mortgage will stay in “applied” state, or move to “approved”/”rejected” states
    • Process ends
  • Possibilities from here
    • Automated decision making
      • Decision tables
      • Better conditional tests
    • Automated response processing, streamlines the feedback loop and decision making
    • Harass institutions that don't respond within 2 days of process timeout
    • Joe improves his handicap
  • Ruote & AASM
    • Great combination
    • Ruote handles business logic, AASM the state
    • AASM becomes skinny, ruote stays declarative
  • More ruote: Listeners
    • Start process, or wait for
      • Messages from SQS
      • Jabber messages
      • Atom feed entries
  • More ruote: Cancel, cursors, replay & redo
    • When processes are cancelled, run sub-processes for “cleanup” tasks
    • Replay failed steps
    • Redo steps based on conditions
    • Jump to any point in the workflow using cursors
  • More ruote: ruote-fluo
    • Graphical representation of process definitions
    • Edit process definitions on the fly
  • More ruote: Active*Participants
    • ActiveRecordParticipant
      • Save workitem information in database
    • ActiveResourceParticipant
      • Interact with any Rails resource as DHH intended you to do
  • Shameless Self Promotion
    • Developed the JabberParticipant and JabberListener now bundled with ruote
    • Added support for daemonizing ruote-rest
    • In talks on refactoring ruote-rest to become preferred “Rails-friendly” implementation of ruote
  • Summary
    • Process definitions built up from expressions
    • Expressions are “steps in the workflow”
    • Participants perform explicit function during workflow
    • Workitems used as “internal messaging” mechanism between expressions/participants
    • The best complement to any state machine implementation
    • Simplifies complex business process implementations
    • You have full control over the entire process
  • Thank You opensourcery.co.za @kennethkalmer openwferu.rubyforge.org #ruote on Freenode groups.google.com/group/openwferu-users @jmettraux