SlideShare uma empresa Scribd logo
1 de 16
Baixar para ler offline
A simple workflow system



        David Peterson
      peterson@orbitec.com.au
What is a workflow?


A process that moves through a
sequence of steps (from start and
   finish) in order to perform
          some function
Examples


    Fulfilling an order
●




    Publishing documents / content
●




    Approving a request
●
A few things in common ...


    Typically multi-step
●



    Performed asynchronously
●



    May be long-running
●



    Steps may be conditional
●



    Each step may need to do an operation
●
The Idea


Many simple workflows
can be modelled as a
finite state machine


      (Not all)
acts_as_state_machine


    AASM to friends!
●



    Rails plugin by Scott Barron
●




    Provides:
●


        A simple FSM implementation
    ●


        A DSL for expressing FSM in Ruby code
    ●
http://elitists.textdriven.com/svn/plugins/
       acts_as_state_machine/trunk/
# Basic workflow example
class ActionWorkflow < ActiveRecord::Base

 acts_as_state_machine :initial => :created,
  :column => 'status'

 state :created
 state :approved
 state :rejected
 state :cancelled

 event :approve { transitions :to => :approved, :from
 => :created }

 event :cancel { transitions :to => :cancelled, :from
 =>[:created, :approved, :rejected] }
 ...
end
AASM provides some methods


    An action! method for each event
●



    A query? method for each state
●




Examples:
    workflow.approve!   # moves to approved state
    workflow.cancelled? # Returns boolean
Guards

    event :approve { transitions :to => :approved, :from
     => :created, :guard => Proc.new {|w| !w.expired?}}


    Allows conditions on transitions
●



    Transition is not available unless
●


    condition is met
    Some conditions may be expressed
●


    best in your code, not in guards
Callbacks
    state :approved, :after => :on_submit
    state :approved, :after => :Proc.new {|m| m.abc }



    Available hooks :enter, :after and :exit
●



    Callbacks provide a way to do some
●


    operation when a transition occurs
     def on_submit
       record_action
       ...
     end
Other useful stuff
# Fire your actions (cleanly)
  attr_accessor :action
  def action_workflow
    eval(quot;self.#{self.action}!quot;) unless self.action.nil?
  end


# Add an audit trail ...
  has_many :actions, :class_name => quot;WorkflowActionquot;
  def record_action
   self.actions << WorkflowAction.create(
    :comment => self.comment, :actioner_id =>
    self.acting_person, :state => self.state)
  end
A few caveats
    A minor change to AASM .rb required
●


        Avoids runtime error (on 1.2.3 anyway!)
    ●




    Also added a couple of things locally
●


        Lourens Naude's method (mis-named)
    ●


        A corrected next_events_for_current_state
    ●




    Ask me for the patch if you're keen
●
# Retrieves next states for current state

 def next_events_for_current_state
  events = []
  self.class.read_inheritable_attribute(
    :transition_table).each do |key, value|
      value.each do |transition|
       events << key if transition.from ==
          current_state()
        end
   end
 events
end
Remarks
AASM makes it very simple to implement
 a simple workflow model
        A full workflow system is more complex
    ●


        acts_as_coloured_petri_net :)
    ●




    Piston is your friend ... especially when
●


    making local modifications to plugins
Parting thought
Q: What are the three most important
 ideas in programming?

  1. Abstraction
  2. Abstraction
  3. Abstraction


(Hudak, 2000)

Mais conteúdo relacionado

Mais procurados

Ct102 using ltmom to move to sap s4 hana
Ct102  using ltmom to move to sap s4 hanaCt102  using ltmom to move to sap s4 hana
Ct102 using ltmom to move to sap s4 hanaMichelle Crapo
 
SynapseIndia drupal presentation on drupal info
SynapseIndia drupal  presentation on drupal infoSynapseIndia drupal  presentation on drupal info
SynapseIndia drupal presentation on drupal infoSynapseindiappsdevelopment
 
Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...
Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...
Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...Startupfest
 
Jonathon Wright - Intelligent Performance Cognitive Learning (AIOps)
Jonathon Wright - Intelligent Performance Cognitive Learning (AIOps)Jonathon Wright - Intelligent Performance Cognitive Learning (AIOps)
Jonathon Wright - Intelligent Performance Cognitive Learning (AIOps)Neotys_Partner
 
bed-con 2015 - From Virtual Machines to Containers
bed-con 2015 - From Virtual Machines to Containersbed-con 2015 - From Virtual Machines to Containers
bed-con 2015 - From Virtual Machines to Containerscamunda services GmbH
 
Case of the Unexplained Support Issue – Troubleshooting steps for diagnosing ...
Case of the Unexplained Support Issue – Troubleshooting steps for diagnosing ...Case of the Unexplained Support Issue – Troubleshooting steps for diagnosing ...
Case of the Unexplained Support Issue – Troubleshooting steps for diagnosing ...Charles Beyer
 
Object Oriented Programming I
Object Oriented Programming IObject Oriented Programming I
Object Oriented Programming Iraven_rainagi
 
Load testing with Visual Studio and Azure - Andrew Siemer
Load testing with Visual Studio and Azure - Andrew SiemerLoad testing with Visual Studio and Azure - Andrew Siemer
Load testing with Visual Studio and Azure - Andrew SiemerAndrew Siemer
 
Automated Performance Testing With J Meter And Maven
Automated  Performance  Testing With  J Meter And  MavenAutomated  Performance  Testing With  J Meter And  Maven
Automated Performance Testing With J Meter And MavenPerconaPerformance
 
Architecting for the cloud storage build test
Architecting for the cloud storage build testArchitecting for the cloud storage build test
Architecting for the cloud storage build testLen Bass
 
BlazeMeter- Effective Performance Reporting
BlazeMeter- Effective Performance ReportingBlazeMeter- Effective Performance Reporting
BlazeMeter- Effective Performance ReportingBlazeMeter
 
Gearman - Northeast PHP 2012
Gearman - Northeast PHP 2012Gearman - Northeast PHP 2012
Gearman - Northeast PHP 2012Mike Willbanks
 
SAP Workflow Po create workflow by pavan golesar
SAP Workflow Po create workflow by pavan golesarSAP Workflow Po create workflow by pavan golesar
SAP Workflow Po create workflow by pavan golesarPavan Golesar
 
Advanced Load Runner
Advanced Load RunnerAdvanced Load Runner
Advanced Load Runnertelab
 
Silk Performer Presentation v1
Silk Performer Presentation v1Silk Performer Presentation v1
Silk Performer Presentation v1Sun Technlogies
 
Synthetic web performance testing with Selenium
Synthetic web performance testing with SeleniumSynthetic web performance testing with Selenium
Synthetic web performance testing with SeleniumAndriy Samilyak
 
Building software by feature with immutable infrastructures on AWS
Building software by feature with immutable infrastructures on AWSBuilding software by feature with immutable infrastructures on AWS
Building software by feature with immutable infrastructures on AWSNicolas Mas
 
Kanban - Class of Service (To Manage Incidents in a DevOps Team)
Kanban - Class of Service (To Manage Incidents in a DevOps Team)Kanban - Class of Service (To Manage Incidents in a DevOps Team)
Kanban - Class of Service (To Manage Incidents in a DevOps Team)Anurag Shrivastava
 

Mais procurados (20)

Ct102 using ltmom to move to sap s4 hana
Ct102  using ltmom to move to sap s4 hanaCt102  using ltmom to move to sap s4 hana
Ct102 using ltmom to move to sap s4 hana
 
SynapseIndia drupal presentation on drupal info
SynapseIndia drupal  presentation on drupal infoSynapseIndia drupal  presentation on drupal info
SynapseIndia drupal presentation on drupal info
 
Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...
Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...
Jeremy Edberg (MinOps ) - How to build a solid infrastructure for a startup t...
 
Jonathon Wright - Intelligent Performance Cognitive Learning (AIOps)
Jonathon Wright - Intelligent Performance Cognitive Learning (AIOps)Jonathon Wright - Intelligent Performance Cognitive Learning (AIOps)
Jonathon Wright - Intelligent Performance Cognitive Learning (AIOps)
 
bed-con 2015 - From Virtual Machines to Containers
bed-con 2015 - From Virtual Machines to Containersbed-con 2015 - From Virtual Machines to Containers
bed-con 2015 - From Virtual Machines to Containers
 
Task flow
Task flowTask flow
Task flow
 
Case of the Unexplained Support Issue – Troubleshooting steps for diagnosing ...
Case of the Unexplained Support Issue – Troubleshooting steps for diagnosing ...Case of the Unexplained Support Issue – Troubleshooting steps for diagnosing ...
Case of the Unexplained Support Issue – Troubleshooting steps for diagnosing ...
 
Object Oriented Programming I
Object Oriented Programming IObject Oriented Programming I
Object Oriented Programming I
 
Load testing with Visual Studio and Azure - Andrew Siemer
Load testing with Visual Studio and Azure - Andrew SiemerLoad testing with Visual Studio and Azure - Andrew Siemer
Load testing with Visual Studio and Azure - Andrew Siemer
 
Automated Performance Testing With J Meter And Maven
Automated  Performance  Testing With  J Meter And  MavenAutomated  Performance  Testing With  J Meter And  Maven
Automated Performance Testing With J Meter And Maven
 
Architecting for the cloud storage build test
Architecting for the cloud storage build testArchitecting for the cloud storage build test
Architecting for the cloud storage build test
 
BlazeMeter- Effective Performance Reporting
BlazeMeter- Effective Performance ReportingBlazeMeter- Effective Performance Reporting
BlazeMeter- Effective Performance Reporting
 
Gearman - Northeast PHP 2012
Gearman - Northeast PHP 2012Gearman - Northeast PHP 2012
Gearman - Northeast PHP 2012
 
SAP Workflow Po create workflow by pavan golesar
SAP Workflow Po create workflow by pavan golesarSAP Workflow Po create workflow by pavan golesar
SAP Workflow Po create workflow by pavan golesar
 
Load Runner
Load RunnerLoad Runner
Load Runner
 
Advanced Load Runner
Advanced Load RunnerAdvanced Load Runner
Advanced Load Runner
 
Silk Performer Presentation v1
Silk Performer Presentation v1Silk Performer Presentation v1
Silk Performer Presentation v1
 
Synthetic web performance testing with Selenium
Synthetic web performance testing with SeleniumSynthetic web performance testing with Selenium
Synthetic web performance testing with Selenium
 
Building software by feature with immutable infrastructures on AWS
Building software by feature with immutable infrastructures on AWSBuilding software by feature with immutable infrastructures on AWS
Building software by feature with immutable infrastructures on AWS
 
Kanban - Class of Service (To Manage Incidents in a DevOps Team)
Kanban - Class of Service (To Manage Incidents in a DevOps Team)Kanban - Class of Service (To Manage Incidents in a DevOps Team)
Kanban - Class of Service (To Manage Incidents in a DevOps Team)
 

Destaque

Corporate Workflow Process - Complaints and Legal Matters (illustration)
Corporate Workflow Process - Complaints and Legal Matters (illustration)Corporate Workflow Process - Complaints and Legal Matters (illustration)
Corporate Workflow Process - Complaints and Legal Matters (illustration)Elizabeth Baker, JD, CRCMP
 
Scalable web-based workflow platform
Scalable web-based workflow platformScalable web-based workflow platform
Scalable web-based workflow platformAshutosh Bijoor
 
workflow in temporal state machine v1
workflow in temporal state machine v1workflow in temporal state machine v1
workflow in temporal state machine v1Gordon Morrison
 
Events Workflow diagram
Events Workflow diagramEvents Workflow diagram
Events Workflow diagramColin Thomson
 
JBoss BPM Suite 6 Tech labs
JBoss BPM Suite 6 Tech labsJBoss BPM Suite 6 Tech labs
JBoss BPM Suite 6 Tech labsAndrea Leoncini
 
Message Oriented Middleware (MOM)
Message Oriented Middleware (MOM)Message Oriented Middleware (MOM)
Message Oriented Middleware (MOM)drewenut
 
Sending and receiving messages in mq queues
Sending and receiving messages in mq queuesSending and receiving messages in mq queues
Sending and receiving messages in mq queuesRavi Babu
 
The Workflow Reference Model
The Workflow Reference ModelThe Workflow Reference Model
The Workflow Reference ModelAldo Quelopana
 
Djangocon 09 Presentation - Pluggable Applications
Djangocon 09 Presentation - Pluggable ApplicationsDjangocon 09 Presentation - Pluggable Applications
Djangocon 09 Presentation - Pluggable ApplicationsNowell Strite
 
Architecture of message oriented middleware
Architecture of message oriented middlewareArchitecture of message oriented middleware
Architecture of message oriented middlewareLikan Patra
 
Cognitive IBM Watson Services for Bluemix Developers
Cognitive IBM Watson Services for Bluemix DevelopersCognitive IBM Watson Services for Bluemix Developers
Cognitive IBM Watson Services for Bluemix DevelopersNiklas Heidloff
 
Responsive Design Workflow: Mobilism 2012
Responsive Design Workflow: Mobilism 2012Responsive Design Workflow: Mobilism 2012
Responsive Design Workflow: Mobilism 2012Stephen Hay
 
Developing a PLN and open co-learning opportunities #UoRsocialmedia
Developing a PLN and open co-learning opportunities #UoRsocialmediaDeveloping a PLN and open co-learning opportunities #UoRsocialmedia
Developing a PLN and open co-learning opportunities #UoRsocialmediaSue Beckingham
 

Destaque (20)

Corporate Workflow Process - Complaints and Legal Matters (illustration)
Corporate Workflow Process - Complaints and Legal Matters (illustration)Corporate Workflow Process - Complaints and Legal Matters (illustration)
Corporate Workflow Process - Complaints and Legal Matters (illustration)
 
Neuro4j Workflow Overview
Neuro4j Workflow OverviewNeuro4j Workflow Overview
Neuro4j Workflow Overview
 
Scalable web-based workflow platform
Scalable web-based workflow platformScalable web-based workflow platform
Scalable web-based workflow platform
 
workflow in temporal state machine v1
workflow in temporal state machine v1workflow in temporal state machine v1
workflow in temporal state machine v1
 
Workflow Foundation 4
Workflow Foundation 4Workflow Foundation 4
Workflow Foundation 4
 
Message oriented middleware
Message oriented middlewareMessage oriented middleware
Message oriented middleware
 
Windows Workflow Foundation
Windows Workflow FoundationWindows Workflow Foundation
Windows Workflow Foundation
 
Events Workflow diagram
Events Workflow diagramEvents Workflow diagram
Events Workflow diagram
 
JBoss BPM Suite 6 Tech labs
JBoss BPM Suite 6 Tech labsJBoss BPM Suite 6 Tech labs
JBoss BPM Suite 6 Tech labs
 
Message Oriented Middleware (MOM)
Message Oriented Middleware (MOM)Message Oriented Middleware (MOM)
Message Oriented Middleware (MOM)
 
Sending and receiving messages in mq queues
Sending and receiving messages in mq queuesSending and receiving messages in mq queues
Sending and receiving messages in mq queues
 
Workflow for XPages
Workflow for XPagesWorkflow for XPages
Workflow for XPages
 
The Workflow Reference Model
The Workflow Reference ModelThe Workflow Reference Model
The Workflow Reference Model
 
Djangocon 09 Presentation - Pluggable Applications
Djangocon 09 Presentation - Pluggable ApplicationsDjangocon 09 Presentation - Pluggable Applications
Djangocon 09 Presentation - Pluggable Applications
 
Architecture of message oriented middleware
Architecture of message oriented middlewareArchitecture of message oriented middleware
Architecture of message oriented middleware
 
Cognitive IBM Watson Services for Bluemix Developers
Cognitive IBM Watson Services for Bluemix DevelopersCognitive IBM Watson Services for Bluemix Developers
Cognitive IBM Watson Services for Bluemix Developers
 
Responsive Design Workflow: Mobilism 2012
Responsive Design Workflow: Mobilism 2012Responsive Design Workflow: Mobilism 2012
Responsive Design Workflow: Mobilism 2012
 
Career vs Health
Career vs HealthCareer vs Health
Career vs Health
 
Circuits 2011 in English
Circuits 2011 in EnglishCircuits 2011 in English
Circuits 2011 in English
 
Developing a PLN and open co-learning opportunities #UoRsocialmedia
Developing a PLN and open co-learning opportunities #UoRsocialmediaDeveloping a PLN and open co-learning opportunities #UoRsocialmedia
Developing a PLN and open co-learning opportunities #UoRsocialmedia
 

Semelhante a A simple workflow system using state machines

540slidesofnodejsbackendhopeitworkforu.pdf
540slidesofnodejsbackendhopeitworkforu.pdf540slidesofnodejsbackendhopeitworkforu.pdf
540slidesofnodejsbackendhopeitworkforu.pdfhamzadamani7
 
Linux Cluster Job Management Systems (SGE)
Linux Cluster Job Management Systems (SGE)Linux Cluster Job Management Systems (SGE)
Linux Cluster Job Management Systems (SGE)anandvaidya
 
Getting Reactive with Cycle.js and xstream
Getting Reactive with Cycle.js and xstreamGetting Reactive with Cycle.js and xstream
Getting Reactive with Cycle.js and xstreamSteve Lee
 
Automating EVA Workflows with AWS Step Functions
Automating EVA Workflows with AWS Step FunctionsAutomating EVA Workflows with AWS Step Functions
Automating EVA Workflows with AWS Step FunctionsChris Shenton
 
Velocity 2018 preetha appan final
Velocity 2018   preetha appan finalVelocity 2018   preetha appan final
Velocity 2018 preetha appan finalpreethaappan
 
Intro to tsql unit 14
Intro to tsql   unit 14Intro to tsql   unit 14
Intro to tsql unit 14Syed Asrarali
 
File Processing - Batch Process Execution
File Processing - Batch Process ExecutionFile Processing - Batch Process Execution
File Processing - Batch Process ExecutionAbimael Desales López
 
File Processing - Process Execution Solution
File Processing - Process Execution SolutionFile Processing - Process Execution Solution
File Processing - Process Execution SolutionAbimael Desales López
 
Complex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBoxComplex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBoxbobmcwhirter
 
Angular Optimization Web Performance Meetup
Angular Optimization Web Performance MeetupAngular Optimization Web Performance Meetup
Angular Optimization Web Performance MeetupDavid Barreto
 
Gearmanpresentation 110308165409-phpapp01
Gearmanpresentation 110308165409-phpapp01Gearmanpresentation 110308165409-phpapp01
Gearmanpresentation 110308165409-phpapp01longtuan
 
Angular performance slides
Angular performance slidesAngular performance slides
Angular performance slidesDavid Barreto
 
Node js
Node jsNode js
Node jshazzaz
 
Container Orchestration from Theory to Practice
Container Orchestration from Theory to PracticeContainer Orchestration from Theory to Practice
Container Orchestration from Theory to PracticeDocker, Inc.
 
IBM ConnectED 2015 - MAS103 XPages Performance and Scalability
IBM ConnectED 2015 - MAS103 XPages Performance and ScalabilityIBM ConnectED 2015 - MAS103 XPages Performance and Scalability
IBM ConnectED 2015 - MAS103 XPages Performance and ScalabilityPaul Withers
 
Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...
Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...
Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...Alan Pinstein
 

Semelhante a A simple workflow system using state machines (20)

Os Whitaker
Os WhitakerOs Whitaker
Os Whitaker
 
540slidesofnodejsbackendhopeitworkforu.pdf
540slidesofnodejsbackendhopeitworkforu.pdf540slidesofnodejsbackendhopeitworkforu.pdf
540slidesofnodejsbackendhopeitworkforu.pdf
 
Linux Cluster Job Management Systems (SGE)
Linux Cluster Job Management Systems (SGE)Linux Cluster Job Management Systems (SGE)
Linux Cluster Job Management Systems (SGE)
 
Getting Reactive with Cycle.js and xstream
Getting Reactive with Cycle.js and xstreamGetting Reactive with Cycle.js and xstream
Getting Reactive with Cycle.js and xstream
 
Automating EVA Workflows with AWS Step Functions
Automating EVA Workflows with AWS Step FunctionsAutomating EVA Workflows with AWS Step Functions
Automating EVA Workflows with AWS Step Functions
 
Velocity 2018 preetha appan final
Velocity 2018   preetha appan finalVelocity 2018   preetha appan final
Velocity 2018 preetha appan final
 
Intro to tsql
Intro to tsqlIntro to tsql
Intro to tsql
 
Intro to tsql unit 14
Intro to tsql   unit 14Intro to tsql   unit 14
Intro to tsql unit 14
 
File Processing - Batch Process Execution
File Processing - Batch Process ExecutionFile Processing - Batch Process Execution
File Processing - Batch Process Execution
 
File Processing - Process Execution Solution
File Processing - Process Execution SolutionFile Processing - Process Execution Solution
File Processing - Process Execution Solution
 
Complex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBoxComplex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBox
 
Angular Optimization Web Performance Meetup
Angular Optimization Web Performance MeetupAngular Optimization Web Performance Meetup
Angular Optimization Web Performance Meetup
 
Capistrano
CapistranoCapistrano
Capistrano
 
Gearmanpresentation 110308165409-phpapp01
Gearmanpresentation 110308165409-phpapp01Gearmanpresentation 110308165409-phpapp01
Gearmanpresentation 110308165409-phpapp01
 
ReactJS
ReactJSReactJS
ReactJS
 
Angular performance slides
Angular performance slidesAngular performance slides
Angular performance slides
 
Node js
Node jsNode js
Node js
 
Container Orchestration from Theory to Practice
Container Orchestration from Theory to PracticeContainer Orchestration from Theory to Practice
Container Orchestration from Theory to Practice
 
IBM ConnectED 2015 - MAS103 XPages Performance and Scalability
IBM ConnectED 2015 - MAS103 XPages Performance and ScalabilityIBM ConnectED 2015 - MAS103 XPages Performance and Scalability
IBM ConnectED 2015 - MAS103 XPages Performance and Scalability
 
Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...
Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...
Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...
 

Último

Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 

Último (20)

Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 

A simple workflow system using state machines

  • 1. A simple workflow system David Peterson peterson@orbitec.com.au
  • 2. What is a workflow? A process that moves through a sequence of steps (from start and finish) in order to perform some function
  • 3. Examples Fulfilling an order ● Publishing documents / content ● Approving a request ●
  • 4. A few things in common ... Typically multi-step ● Performed asynchronously ● May be long-running ● Steps may be conditional ● Each step may need to do an operation ●
  • 5. The Idea Many simple workflows can be modelled as a finite state machine (Not all)
  • 6. acts_as_state_machine AASM to friends! ● Rails plugin by Scott Barron ● Provides: ● A simple FSM implementation ● A DSL for expressing FSM in Ruby code ●
  • 7. http://elitists.textdriven.com/svn/plugins/ acts_as_state_machine/trunk/
  • 8. # Basic workflow example class ActionWorkflow < ActiveRecord::Base acts_as_state_machine :initial => :created, :column => 'status' state :created state :approved state :rejected state :cancelled event :approve { transitions :to => :approved, :from => :created } event :cancel { transitions :to => :cancelled, :from =>[:created, :approved, :rejected] } ... end
  • 9. AASM provides some methods An action! method for each event ● A query? method for each state ● Examples: workflow.approve! # moves to approved state workflow.cancelled? # Returns boolean
  • 10. Guards event :approve { transitions :to => :approved, :from => :created, :guard => Proc.new {|w| !w.expired?}} Allows conditions on transitions ● Transition is not available unless ● condition is met Some conditions may be expressed ● best in your code, not in guards
  • 11. Callbacks state :approved, :after => :on_submit state :approved, :after => :Proc.new {|m| m.abc } Available hooks :enter, :after and :exit ● Callbacks provide a way to do some ● operation when a transition occurs def on_submit record_action ... end
  • 12. Other useful stuff # Fire your actions (cleanly) attr_accessor :action def action_workflow eval(quot;self.#{self.action}!quot;) unless self.action.nil? end # Add an audit trail ... has_many :actions, :class_name => quot;WorkflowActionquot; def record_action self.actions << WorkflowAction.create( :comment => self.comment, :actioner_id => self.acting_person, :state => self.state) end
  • 13. A few caveats A minor change to AASM .rb required ● Avoids runtime error (on 1.2.3 anyway!) ● Also added a couple of things locally ● Lourens Naude's method (mis-named) ● A corrected next_events_for_current_state ● Ask me for the patch if you're keen ●
  • 14. # Retrieves next states for current state def next_events_for_current_state events = [] self.class.read_inheritable_attribute( :transition_table).each do |key, value| value.each do |transition| events << key if transition.from == current_state() end end events end
  • 15. Remarks AASM makes it very simple to implement a simple workflow model A full workflow system is more complex ● acts_as_coloured_petri_net :) ● Piston is your friend ... especially when ● making local modifications to plugins
  • 16. Parting thought Q: What are the three most important ideas in programming? 1. Abstraction 2. Abstraction 3. Abstraction (Hudak, 2000)