SlideShare a Scribd company logo
From codebase to database:
Automation via workflows
A way of writing customizable logic.
patelmilanp
patelmilan-p
Agenda
● What is workflow as a concept
● Some examples of workflow
● Automate workflows using traditional coding techniques
● Problem with traditional techniques
● Design a technique using event based architecture to solve
the problem
● Use Cases
● Benefits / Advantages over traditional methods
● Overview: our implementation of this technique
● Challenges we are facing with this design
● Dictionary meaning:
The sequence of processes through which a piece of work passes from initiation
to completion.
● It is a sequence of operations, declared as work of a person or group/organization.
● From a higher-level perspective, workflow may be considered a view or
representation of real work.
● Workflows may be viewed as one fundamental building block to be combined
with other parts of an organization's structure.
● History:
One of the earliest usages of the term 'work flow' was in a railway engineering
journal from 1921.
Workflow as a concept
Sample Workflow
An example workflow for the purpose to this talk.
A simplistic workflow from medical services domain
Appointment
Patient schedules an appointment.
Arrival
Patient gets to the clinic.
Visit
Patient talks with the doctor.
Send a notification via sms to patient
& doctor.
Send a reminder sms to patient
15 mins before the appointment.
Automated workflow via
Traditional coding
technique
class Appointment < ActiveRecord::Base
belongs_to :doctor
belongs_to :patient
after_create :send_sms_to_doctor_and_patient
after_create :remind_patient_before_hand
def remind_patient_before_hand(appointment)
MailerWorker.perform_at(
(appointment.scheduled_time - 15.minutes),
appointment.patient_id)
end
end
Problems with this method:
● Suppose we try to sell this to different doctors, and found out that every doctor’s
workflow is little bit different.
● How can we achieve this kind of customizability in our application to cater for
different requirements ?
● Suppose, we came up with settings feature where a set of settings can be
enabled/disabled to handle different requirements. (but is it a feasible solution ?)
● So now we will design a solution based on event driven architecture, which is fully
customizable and can handle requirement differences easily.
Event driven architecture (EDA)
● It’s a software architecture pattern promoting the production, detection,
consumption of, and reaction to events.
● Key aspects:
1. Type of interaction: Event-driven
2. Initiator: Event
3. Participants: Open-ended
● Some principles of EDA:
1. “Real-time” events as they happen at the producer
2. One-way “fire-and-forget”
3. Immediate action at the consumers
4. Informational (“someone logged in”), not commands (“audit this”)
EDA (generic block diagram)
Business
Processes
Services State
Machines
Monitors /
Probes
Business
Processes
Services State
Machines
Monitors /
Probes
Event Publishers
Event Subscribers
Event processing engine
Event Handler
Event Emitter
Event Channels
Event Flow
Design a system using EDA to solve our
problem
System comprised of following entities
System’s primary focus should be on the domain & domain logic.
● Domain events:
○ A Domain Event is something that happened that the domain expert cares about.
○ By exposing relevant Domain Events on a shared event bus we can isolate cross cutting functions to
separate system.
● Conditions:
○ Often domain logic accompanies with some conditional scenarios.
○ Through this entity, we decide whether to execute a given action after evaluating defined
conditions. Conditions may be optional.
● Actions:
○ A way of reacting to domain events in the system.
○ We can perform any activity in the system when an event is triggered.
● We will create a workflow as:
○ Triggering Event:
■ New appointment scheduled event.
○ Action:
■ Send a notification sms to doctor & patient with appointment time.
■ Send a reminder to patient 15 mins before appointment time.
● Let’s name this workflow as ‘notification_workflow’
Automate the sample workflow with this event-driven
system
● We can have a workflow model to save our
custom workflows to database.
● Instead of sending notification directly in
appointment’s callback, we now publish
appointment scheduled(created) event in it.
● Consider we have some method to subscribe a
workflow to any domain event. Using that we
can now register our notification_workflow to
appointment scheduled event.
● We can implement some sort of Event
processing engine which will find all the
workflows registered on a triggered event &
can execute them all.
● We can provide a GUI interface for creating &
editing workflows. This way every health
provider can create custom workflows
according to his needs.
class Worflow < ActiveRecord::Base
has_many :conditions
has_many :actions
def execute
# evaluate conditions & execute actions
...
end
end
class Appointment < ActiveRecord::Base
belongs_to :doctor
belongs_to :patient
after_create :new_appointment_created_event
end
register(notification_workflow,
:new_appointment_created)
# some method in Event processing engine.
def execute(worflow_id)
workflow = Workflow.find(workflow_id)
workflow.execute()
end
● Notifications module
○ Notifications can be a cross cutting concern in many systems, which makes it a perfect contestant
for using EDA.
○ For example: A system consisting of monitoring & reporting service
■ Monitoring service - want’s to send notification when some metric goes above threshold
value.
■ Reporting service - send different types of reports via notifications.
● Implement hooks within some service
○ For example: A popular code hosting platform ‘Github’ provides a webhook service.
■ It allows external services to be notified with a POST request, when certain events happen
within your repository.
Use cases for EDA
Workflows via Event driven architecture
● Fully Customizable
● Highly Scalable
● Easily extensible
● Efficiently handle crosscutting concerns by decoupled system.
Advantages of EDA over traditional methods
High level overview of ‘our’ implementation of EDA
Workflow
Branch 1 Branch 2
Trigger branch
● Binary tree structure
● Introduced notion of branches
● Branch can be action branch or
condition branch
● Workflow has one compulsory branch
called trigger branch
● Action branches are always present at
leaf nodes of the tree
Challenges we are facing in this system
● Activities performed in workflow actions can trigger other events implicitly
triggering other workflows subscribed to that event which can result into a
loop of workflows triggering each other leading to deadlock conditions.
How this problem can be solved efficiently ? (Think)
Open for discussions !
References
● Wikipedia
● http://www.slideshare.net/stnor/event-driven-architecture-3395407
Thank You
patelmilanp
patelmilan-p

More Related Content

What's hot (19)

PDF
Google Cloud and Confluent Streaming: Generating Real Value From Real Time | ...
confluent
 
PDF
Digital Transformation with Kubernetes, Containers, and Microservices
Lightbend
 
PDF
Building Event Driven Systems
WSO2
 
PDF
Confluent Messaging Modernization Forum
confluent
 
PDF
Microservices, Kubernetes, and Application Modernization Done Right
Lightbend
 
PDF
Dynatrace FreeTrial Test Drive
Jerry Tan
 
PDF
A practical introduction to Event Sourcing and CQRS
Robert Lemke
 
PDF
Moving Legacy Apps to Cloud: How to Avoid Risk
CloverDX
 
PDF
Event Driven Architecture
Lourens Naudé
 
PPTX
Unlocking the Power of Salesforce Integrations with Confluent
AaronLieberman5
 
PDF
Five Trends in Real Time Applications
confluent
 
PPTX
Dynatrace
Purnima Kurella
 
PDF
Cloudstate - Towards Stateful Serverless
Lightbend
 
PPTX
Designing microservices
Masashi Narumoto
 
PPT
CEP and SOA: An Open Event-Driven Architecture for Risk Management
Tim Bass
 
PPTX
Introduction to Rundeck
Rundeck
 
PDF
Effective Akka v2.0 - Jamie Allen
JAXLondon_Conference
 
PDF
Three Pillars, Zero Answers: Rethinking Observability
DevOps.com
 
PPTX
Microservices event-driven-saga
Vijay Redkar
 
Google Cloud and Confluent Streaming: Generating Real Value From Real Time | ...
confluent
 
Digital Transformation with Kubernetes, Containers, and Microservices
Lightbend
 
Building Event Driven Systems
WSO2
 
Confluent Messaging Modernization Forum
confluent
 
Microservices, Kubernetes, and Application Modernization Done Right
Lightbend
 
Dynatrace FreeTrial Test Drive
Jerry Tan
 
A practical introduction to Event Sourcing and CQRS
Robert Lemke
 
Moving Legacy Apps to Cloud: How to Avoid Risk
CloverDX
 
Event Driven Architecture
Lourens Naudé
 
Unlocking the Power of Salesforce Integrations with Confluent
AaronLieberman5
 
Five Trends in Real Time Applications
confluent
 
Dynatrace
Purnima Kurella
 
Cloudstate - Towards Stateful Serverless
Lightbend
 
Designing microservices
Masashi Narumoto
 
CEP and SOA: An Open Event-Driven Architecture for Risk Management
Tim Bass
 
Introduction to Rundeck
Rundeck
 
Effective Akka v2.0 - Jamie Allen
JAXLondon_Conference
 
Three Pillars, Zero Answers: Rethinking Observability
DevOps.com
 
Microservices event-driven-saga
Vijay Redkar
 

Viewers also liked (8)

KEY
Event Driven Architecture
Stefan Norberg
 
PDF
Lighning Talk: Event-Driven architecture for microservices
Martins Sipenko
 
PPTX
Event driven-automation and workflows
Dmitri Zimine
 
PPTX
Xavient overview
Neeraj Sabharwal
 
PDF
Event Driven Architecture
Fabien Doiron
 
PPTX
The Impact of Messaging Standards on Event-Driven Architecture and IoT
Solace
 
KEY
Event Driven Architecture
Chris Patterson
 
ODP
Event-driven BPM the JBoss way
Kris Verlaenen
 
Event Driven Architecture
Stefan Norberg
 
Lighning Talk: Event-Driven architecture for microservices
Martins Sipenko
 
Event driven-automation and workflows
Dmitri Zimine
 
Xavient overview
Neeraj Sabharwal
 
Event Driven Architecture
Fabien Doiron
 
The Impact of Messaging Standards on Event-Driven Architecture and IoT
Solace
 
Event Driven Architecture
Chris Patterson
 
Event-driven BPM the JBoss way
Kris Verlaenen
 
Ad

Similar to Workflows via Event driven architecture (20)

PDF
The future of workflow and case management - A Study Initiative
Thomas Bohn
 
PDF
Model-driven and low-code development for event-based systems | Bobby Calderw...
HostedbyConfluent
 
PDF
S-CUBE LP: Chemical Modeling: Workflow Enactment based on the Chemical Metaphor
virtual-campus
 
PPT
Towards Service-based Business Process Modeling, Prototyping and Integration
Ang Chen
 
PPTX
Supporting Adaptation Patterns in the Event-driven Business Process Modell...
Malinda Kapuruge
 
PDF
Proposing a Formal Method for Workflow Modelling: Temporal Logic of Actions (...
ijcsta
 
PPTX
LITE 2018 – Adapt Your Processes with Administrate's Scalable Workflows Engin...
getadministrate
 
PDF
An artifact centric approach to generating web-based business process driven ...
Dr. Sira Yongchareon
 
PPTX
Cloud computing_Applications and paradigams.pptx
MayuraD1
 
PPTX
Cloud computing_Applications and paradigams.pptx
MayuraD1
 
PDF
Designing and Implementing Information Systems with Event Modeling, Bobby Cal...
confluent
 
PPT
From Event-Driven Business Process Management to Ubiquitous Complex Event Pr...
ServiceWave 2010
 
PPT
From Event-Driven Business Process Management to Ubiquitous Complex Event Pro...
ServiceWave 2010
 
DOCX
Deliverable 2
Arslan Mehmood
 
PDF
Business Process Modeling
Ang Chen
 
PDF
Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...
confluent
 
PDF
MuCon London 2017: Break your event chains
Bernd Ruecker
 
PDF
Event driven actors - lessons learned
Rick van der Arend
 
PPTX
Introduction To Windows Workflow Foundation 4.0
Melick Baranasooriya
 
The future of workflow and case management - A Study Initiative
Thomas Bohn
 
Model-driven and low-code development for event-based systems | Bobby Calderw...
HostedbyConfluent
 
S-CUBE LP: Chemical Modeling: Workflow Enactment based on the Chemical Metaphor
virtual-campus
 
Towards Service-based Business Process Modeling, Prototyping and Integration
Ang Chen
 
Supporting Adaptation Patterns in the Event-driven Business Process Modell...
Malinda Kapuruge
 
Proposing a Formal Method for Workflow Modelling: Temporal Logic of Actions (...
ijcsta
 
LITE 2018 – Adapt Your Processes with Administrate's Scalable Workflows Engin...
getadministrate
 
An artifact centric approach to generating web-based business process driven ...
Dr. Sira Yongchareon
 
Cloud computing_Applications and paradigams.pptx
MayuraD1
 
Cloud computing_Applications and paradigams.pptx
MayuraD1
 
Designing and Implementing Information Systems with Event Modeling, Bobby Cal...
confluent
 
From Event-Driven Business Process Management to Ubiquitous Complex Event Pr...
ServiceWave 2010
 
From Event-Driven Business Process Management to Ubiquitous Complex Event Pro...
ServiceWave 2010
 
Deliverable 2
Arslan Mehmood
 
Business Process Modeling
Ang Chen
 
Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...
confluent
 
MuCon London 2017: Break your event chains
Bernd Ruecker
 
Event driven actors - lessons learned
Rick van der Arend
 
Introduction To Windows Workflow Foundation 4.0
Melick Baranasooriya
 
Ad

Recently uploaded (20)

PDF
Alarm in Android-Scheduling Timed Tasks Using AlarmManager in Android.pdf
Nabin Dhakal
 
PDF
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
PDF
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
PPTX
Revolutionizing Code Modernization with AI
KrzysztofKkol1
 
PDF
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
PPTX
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
PDF
Beyond Binaries: Understanding Diversity and Allyship in a Global Workplace -...
Imma Valls Bernaus
 
PPTX
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
PDF
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
DOCX
Import Data Form Excel to Tally Services
Tally xperts
 
PDF
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
PDF
Mobile CMMS Solutions Empowering the Frontline Workforce
CryotosCMMSSoftware
 
PDF
Streamline Contractor Lifecycle- TECH EHS Solution
TECH EHS Solution
 
PPTX
How Apagen Empowered an EPC Company with Engineering ERP Software
SatishKumar2651
 
PPTX
A Complete Guide to Salesforce SMS Integrations Build Scalable Messaging With...
360 SMS APP
 
PDF
Capcut Pro Crack For PC Latest Version {Fully Unlocked} 2025
hashhshs786
 
PDF
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
PPTX
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
PPTX
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
PDF
Salesforce CRM Services.VALiNTRY360
VALiNTRY360
 
Alarm in Android-Scheduling Timed Tasks Using AlarmManager in Android.pdf
Nabin Dhakal
 
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
Revolutionizing Code Modernization with AI
KrzysztofKkol1
 
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
Beyond Binaries: Understanding Diversity and Allyship in a Global Workplace -...
Imma Valls Bernaus
 
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
Import Data Form Excel to Tally Services
Tally xperts
 
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
Mobile CMMS Solutions Empowering the Frontline Workforce
CryotosCMMSSoftware
 
Streamline Contractor Lifecycle- TECH EHS Solution
TECH EHS Solution
 
How Apagen Empowered an EPC Company with Engineering ERP Software
SatishKumar2651
 
A Complete Guide to Salesforce SMS Integrations Build Scalable Messaging With...
360 SMS APP
 
Capcut Pro Crack For PC Latest Version {Fully Unlocked} 2025
hashhshs786
 
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
Salesforce CRM Services.VALiNTRY360
VALiNTRY360
 

Workflows via Event driven architecture

  • 1. From codebase to database: Automation via workflows A way of writing customizable logic. patelmilanp patelmilan-p
  • 2. Agenda ● What is workflow as a concept ● Some examples of workflow ● Automate workflows using traditional coding techniques ● Problem with traditional techniques ● Design a technique using event based architecture to solve the problem
  • 3. ● Use Cases ● Benefits / Advantages over traditional methods ● Overview: our implementation of this technique ● Challenges we are facing with this design
  • 4. ● Dictionary meaning: The sequence of processes through which a piece of work passes from initiation to completion. ● It is a sequence of operations, declared as work of a person or group/organization. ● From a higher-level perspective, workflow may be considered a view or representation of real work. ● Workflows may be viewed as one fundamental building block to be combined with other parts of an organization's structure. ● History: One of the earliest usages of the term 'work flow' was in a railway engineering journal from 1921. Workflow as a concept
  • 5. Sample Workflow An example workflow for the purpose to this talk.
  • 6. A simplistic workflow from medical services domain Appointment Patient schedules an appointment. Arrival Patient gets to the clinic. Visit Patient talks with the doctor. Send a notification via sms to patient & doctor. Send a reminder sms to patient 15 mins before the appointment.
  • 7. Automated workflow via Traditional coding technique class Appointment < ActiveRecord::Base belongs_to :doctor belongs_to :patient after_create :send_sms_to_doctor_and_patient after_create :remind_patient_before_hand def remind_patient_before_hand(appointment) MailerWorker.perform_at( (appointment.scheduled_time - 15.minutes), appointment.patient_id) end end
  • 8. Problems with this method: ● Suppose we try to sell this to different doctors, and found out that every doctor’s workflow is little bit different. ● How can we achieve this kind of customizability in our application to cater for different requirements ? ● Suppose, we came up with settings feature where a set of settings can be enabled/disabled to handle different requirements. (but is it a feasible solution ?) ● So now we will design a solution based on event driven architecture, which is fully customizable and can handle requirement differences easily.
  • 9. Event driven architecture (EDA) ● It’s a software architecture pattern promoting the production, detection, consumption of, and reaction to events. ● Key aspects: 1. Type of interaction: Event-driven 2. Initiator: Event 3. Participants: Open-ended ● Some principles of EDA: 1. “Real-time” events as they happen at the producer 2. One-way “fire-and-forget” 3. Immediate action at the consumers 4. Informational (“someone logged in”), not commands (“audit this”)
  • 10. EDA (generic block diagram) Business Processes Services State Machines Monitors / Probes Business Processes Services State Machines Monitors / Probes Event Publishers Event Subscribers Event processing engine Event Handler Event Emitter Event Channels Event Flow
  • 11. Design a system using EDA to solve our problem
  • 12. System comprised of following entities System’s primary focus should be on the domain & domain logic. ● Domain events: ○ A Domain Event is something that happened that the domain expert cares about. ○ By exposing relevant Domain Events on a shared event bus we can isolate cross cutting functions to separate system. ● Conditions: ○ Often domain logic accompanies with some conditional scenarios. ○ Through this entity, we decide whether to execute a given action after evaluating defined conditions. Conditions may be optional. ● Actions: ○ A way of reacting to domain events in the system. ○ We can perform any activity in the system when an event is triggered.
  • 13. ● We will create a workflow as: ○ Triggering Event: ■ New appointment scheduled event. ○ Action: ■ Send a notification sms to doctor & patient with appointment time. ■ Send a reminder to patient 15 mins before appointment time. ● Let’s name this workflow as ‘notification_workflow’ Automate the sample workflow with this event-driven system
  • 14. ● We can have a workflow model to save our custom workflows to database. ● Instead of sending notification directly in appointment’s callback, we now publish appointment scheduled(created) event in it. ● Consider we have some method to subscribe a workflow to any domain event. Using that we can now register our notification_workflow to appointment scheduled event. ● We can implement some sort of Event processing engine which will find all the workflows registered on a triggered event & can execute them all. ● We can provide a GUI interface for creating & editing workflows. This way every health provider can create custom workflows according to his needs. class Worflow < ActiveRecord::Base has_many :conditions has_many :actions def execute # evaluate conditions & execute actions ... end end class Appointment < ActiveRecord::Base belongs_to :doctor belongs_to :patient after_create :new_appointment_created_event end register(notification_workflow, :new_appointment_created) # some method in Event processing engine. def execute(worflow_id) workflow = Workflow.find(workflow_id) workflow.execute() end
  • 15. ● Notifications module ○ Notifications can be a cross cutting concern in many systems, which makes it a perfect contestant for using EDA. ○ For example: A system consisting of monitoring & reporting service ■ Monitoring service - want’s to send notification when some metric goes above threshold value. ■ Reporting service - send different types of reports via notifications. ● Implement hooks within some service ○ For example: A popular code hosting platform ‘Github’ provides a webhook service. ■ It allows external services to be notified with a POST request, when certain events happen within your repository. Use cases for EDA
  • 17. ● Fully Customizable ● Highly Scalable ● Easily extensible ● Efficiently handle crosscutting concerns by decoupled system. Advantages of EDA over traditional methods
  • 18. High level overview of ‘our’ implementation of EDA Workflow Branch 1 Branch 2 Trigger branch ● Binary tree structure ● Introduced notion of branches ● Branch can be action branch or condition branch ● Workflow has one compulsory branch called trigger branch ● Action branches are always present at leaf nodes of the tree
  • 19. Challenges we are facing in this system ● Activities performed in workflow actions can trigger other events implicitly triggering other workflows subscribed to that event which can result into a loop of workflows triggering each other leading to deadlock conditions. How this problem can be solved efficiently ? (Think) Open for discussions !