SlideShare a Scribd company logo
1 of 12
Workflow Patterns and Correlation
Workflow Patterns and Correlation
• Understand how to use correlated workflows
• Understand how to use the message correlation scope
Goals
Workflow Patterns and Correlation
• Using singleton patterns with workflows
• Using correlation when sending and receiving messages
• Using the message correlation scope
• Using compensation
Lesson Plan
Workflow Patterns and Correlation
• It is a design pattern that restricts the instantiation of a class to one object
• It is useful when exactly one object is needed to coordinate actions across the system
• In workflow, this means that for a given set of messages, only one workflow instance will be
created
• Use cases:
• Aggregating messages for batch deliver – i.e. Collect Orders for FTP to partner
• Collecting data that is delivered across multiple messages – i.e. an order is delivered across multiple
files (header, line items, footer)
Singleton Pattern
Workflow Patterns and Correlation
Singleton Pattern
What’s required for a singleton?
• Create a “Correlated Workflow”
• In a loop:
• Receive Message
• Do something with the received
message
• Check condition
• Am I expecting a certain number of
files?
• Am I expecting a “terminating” file?
• Always put a time limit – avoid
“Zombies”
Workflow Patterns and Correlation
Correlation Sets
What is a Correlation Set?
• Identifies the message as being part of a
unique set
• Necessary for Neuron to associate messages
with one another
How else can you initialize a Correlation Set?
• Correlated Workflow
• Correlation Set Tab of the Workflow Endpoint
• Can use custom properties as well as aspects
of the message
• Message Correlation Scope
• Use this when there isn’t a one-way publish to
initialize the correlation set
• Define the Correlation Set on the Message
Correlation Scope
• Define a CorrelationID and set on the Receive
Activity Must be “correlationId”
Workflow Patterns and Correlation
• Long-running transactions require asynchronous communication with external systems
• How do you correlate a response that comes in 2 days later?
• What happens to the workflow instance while it’s waiting?
• Use cases:
• EDI (Send 850 via GEIS, partner receives 850 and send back an ACK the next day)
• Approvals – Send an email requiring a response
Correlated Send / Receive
Workflow Patterns and Correlation
What’s required for a correlated send/receive?
• Correlation ID – This is the value that is used for routing incoming messages to the correct instance of
the workflow. You must define this variable, but do not set it!
• Correlation Set – This defines the location of the value in the incoming message that will be used in
the Correlation ID. It’s easiest to use a message property!
• Publish Message Activity – Publishes the one-way request and initializes the correlation set
• Receive Message Activity – Participates in the correlation by creating an internal subscription for
message(s) that match the correlation set
Correlated Send / Receive
Workflow Correlation : Demo
Purpose:
To familiarize users with correlated workflows in the Neuron ESB Explorer
Objectives:
To acquaint users with how to create correlated workflows:
• Correlation Sets
• Correlating Send and Receive
Workflow Patterns and Correlation
Compensation
• What is compensation?
• The mechanism by which previously completed work can be
undone
• Why is it important?
• Not all systems are transactional!
• How do you do it?
• Compensable Activity
• See: https://msdn.microsoft.com/en-
us/library/system.activities.statements.compensableactivity(v=vs.110).a
spx
Workflow Patterns and Correlation : Lab
Purpose:
Learn how to create a a workflow which implements correlated send and receive.
Objectives:
• Create a workflow with correlated send and receive
• Test the correlated workflow at design time
Workflow Patterns and Correlation
Review
• Correlated workflows allow Neuron ESB to implement a singleton pattern
• Correlated IDs and Correlation Sets are necessary for implementing correlation
• When systems are not transactional they can be used in a compensation block

More Related Content

Similar to Workflow Patterns and Correlation 3.7

Module 18 - Workflow Patterns and Correlation
Module 18 - Workflow Patterns and CorrelationModule 18 - Workflow Patterns and Correlation
Module 18 - Workflow Patterns and Correlation
Courtney Doeing
 

Similar to Workflow Patterns and Correlation 3.7 (20)

Module 18 - Workflow Patterns and Correlation
Module 18 - Workflow Patterns and CorrelationModule 18 - Workflow Patterns and Correlation
Module 18 - Workflow Patterns and Correlation
 
Introduction to Long Running Workflows 3.7
Introduction to Long Running Workflows 3.7Introduction to Long Running Workflows 3.7
Introduction to Long Running Workflows 3.7
 
Choosing the Right Salesforce Integration: The Questions You Should Ask - A C...
Choosing the Right Salesforce Integration: The Questions You Should Ask - A C...Choosing the Right Salesforce Integration: The Questions You Should Ask - A C...
Choosing the Right Salesforce Integration: The Questions You Should Ask - A C...
 
Build, Test and Extend Integrated Workflows 3.7
Build, Test and Extend Integrated Workflows 3.7Build, Test and Extend Integrated Workflows 3.7
Build, Test and Extend Integrated Workflows 3.7
 
Design pattern and their application
Design pattern and their applicationDesign pattern and their application
Design pattern and their application
 
Object modeling
Object modelingObject modeling
Object modeling
 
Publishing Data to REST APIs with Lightning Process Builder
Publishing Data to REST APIs with Lightning Process BuilderPublishing Data to REST APIs with Lightning Process Builder
Publishing Data to REST APIs with Lightning Process Builder
 
Sviluppare app per office
Sviluppare app per officeSviluppare app per office
Sviluppare app per office
 
Best Practices for SharePoint Timer Jobs
Best Practices for SharePoint Timer JobsBest Practices for SharePoint Timer Jobs
Best Practices for SharePoint Timer Jobs
 
stigbot_beta
stigbot_betastigbot_beta
stigbot_beta
 
Commonly used design patterns
Commonly used design patternsCommonly used design patterns
Commonly used design patterns
 
LDV.pptx
LDV.pptxLDV.pptx
LDV.pptx
 
Why I am hooked on the future of React
Why I am hooked on the future of ReactWhy I am hooked on the future of React
Why I am hooked on the future of React
 
Portal and Intranets
Portal and Intranets Portal and Intranets
Portal and Intranets
 
Patterns&Antipatternsof SOA
Patterns&Antipatternsof SOAPatterns&Antipatternsof SOA
Patterns&Antipatternsof SOA
 
IBM File Net P8
IBM File Net P8IBM File Net P8
IBM File Net P8
 
Scaling for Success: Lessons from handling peak loads on Azure with NServiceBus
Scaling for Success: Lessons from handling peak loads on Azure with NServiceBusScaling for Success: Lessons from handling peak loads on Azure with NServiceBus
Scaling for Success: Lessons from handling peak loads on Azure with NServiceBus
 
L06 Using Design Patterns
L06 Using Design PatternsL06 Using Design Patterns
L06 Using Design Patterns
 
E-Commerce Applications Development
E-Commerce Applications Development E-Commerce Applications Development
E-Commerce Applications Development
 
Software design with Domain-driven design
Software design with Domain-driven design Software design with Domain-driven design
Software design with Domain-driven design
 

More from StephenKardian

More from StephenKardian (20)

Deployment and Configuration 3.7
Deployment and Configuration 3.7Deployment and Configuration 3.7
Deployment and Configuration 3.7
 
Tracing, Logging and Troubleshooting 3.7
Tracing, Logging and Troubleshooting 3.7Tracing, Logging and Troubleshooting 3.7
Tracing, Logging and Troubleshooting 3.7
 
Operational Security 3.7
Operational Security 3.7Operational Security 3.7
Operational Security 3.7
 
Workflow Hosting and Tracking 3.7
Workflow Hosting and Tracking 3.7Workflow Hosting and Tracking 3.7
Workflow Hosting and Tracking 3.7
 
Monitoring Neuron ESB 3.7
Monitoring Neuron ESB 3.7Monitoring Neuron ESB 3.7
Monitoring Neuron ESB 3.7
 
Building Custom Adapters 3.7
Building Custom Adapters 3.7Building Custom Adapters 3.7
Building Custom Adapters 3.7
 
Using Adapters and Mediation to Integrate Systems 3.7
Using Adapters and Mediation to Integrate Systems 3.7Using Adapters and Mediation to Integrate Systems 3.7
Using Adapters and Mediation to Integrate Systems 3.7
 
Introduction to Adapters 3.7
Introduction to Adapters 3.7Introduction to Adapters 3.7
Introduction to Adapters 3.7
 
Web Security 3.7
Web Security 3.7Web Security 3.7
Web Security 3.7
 
Developing and Hosting SOAP Based Services
Developing and Hosting SOAP Based ServicesDeveloping and Hosting SOAP Based Services
Developing and Hosting SOAP Based Services
 
Developing and Hosting REST APIs 3.7
Developing and Hosting REST APIs 3.7Developing and Hosting REST APIs 3.7
Developing and Hosting REST APIs 3.7
 
Introduction to API and Service Hosting 3.7
Introduction to API and Service Hosting 3.7Introduction to API and Service Hosting 3.7
Introduction to API and Service Hosting 3.7
 
Extending Business Processes 3.7
Extending Business Processes 3.7Extending Business Processes 3.7
Extending Business Processes 3.7
 
Building Complex Business Processes 3.7
Building Complex Business Processes 3.7Building Complex Business Processes 3.7
Building Complex Business Processes 3.7
 
Introduction to Business Processes 3.7
Introduction to Business Processes 3.7Introduction to Business Processes 3.7
Introduction to Business Processes 3.7
 
Repository 3.7
Repository 3.7Repository 3.7
Repository 3.7
 
`Neuron ESB Client API 3.7
`Neuron ESB Client API 3.7`Neuron ESB Client API 3.7
`Neuron ESB Client API 3.7
 
Introduction to Messaging 3.7
Introduction to Messaging 3.7Introduction to Messaging 3.7
Introduction to Messaging 3.7
 
Introduction to Neuron ESB 3.7
Introduction to Neuron ESB 3.7Introduction to Neuron ESB 3.7
Introduction to Neuron ESB 3.7
 
ESB Fundamentals 3.7
ESB Fundamentals 3.7ESB Fundamentals 3.7
ESB Fundamentals 3.7
 

Recently uploaded

Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 

Recently uploaded (20)

This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 

Workflow Patterns and Correlation 3.7

  • 1. Workflow Patterns and Correlation
  • 2. Workflow Patterns and Correlation • Understand how to use correlated workflows • Understand how to use the message correlation scope Goals
  • 3. Workflow Patterns and Correlation • Using singleton patterns with workflows • Using correlation when sending and receiving messages • Using the message correlation scope • Using compensation Lesson Plan
  • 4. Workflow Patterns and Correlation • It is a design pattern that restricts the instantiation of a class to one object • It is useful when exactly one object is needed to coordinate actions across the system • In workflow, this means that for a given set of messages, only one workflow instance will be created • Use cases: • Aggregating messages for batch deliver – i.e. Collect Orders for FTP to partner • Collecting data that is delivered across multiple messages – i.e. an order is delivered across multiple files (header, line items, footer) Singleton Pattern
  • 5. Workflow Patterns and Correlation Singleton Pattern What’s required for a singleton? • Create a “Correlated Workflow” • In a loop: • Receive Message • Do something with the received message • Check condition • Am I expecting a certain number of files? • Am I expecting a “terminating” file? • Always put a time limit – avoid “Zombies”
  • 6. Workflow Patterns and Correlation Correlation Sets What is a Correlation Set? • Identifies the message as being part of a unique set • Necessary for Neuron to associate messages with one another How else can you initialize a Correlation Set? • Correlated Workflow • Correlation Set Tab of the Workflow Endpoint • Can use custom properties as well as aspects of the message • Message Correlation Scope • Use this when there isn’t a one-way publish to initialize the correlation set • Define the Correlation Set on the Message Correlation Scope • Define a CorrelationID and set on the Receive Activity Must be “correlationId”
  • 7. Workflow Patterns and Correlation • Long-running transactions require asynchronous communication with external systems • How do you correlate a response that comes in 2 days later? • What happens to the workflow instance while it’s waiting? • Use cases: • EDI (Send 850 via GEIS, partner receives 850 and send back an ACK the next day) • Approvals – Send an email requiring a response Correlated Send / Receive
  • 8. Workflow Patterns and Correlation What’s required for a correlated send/receive? • Correlation ID – This is the value that is used for routing incoming messages to the correct instance of the workflow. You must define this variable, but do not set it! • Correlation Set – This defines the location of the value in the incoming message that will be used in the Correlation ID. It’s easiest to use a message property! • Publish Message Activity – Publishes the one-way request and initializes the correlation set • Receive Message Activity – Participates in the correlation by creating an internal subscription for message(s) that match the correlation set Correlated Send / Receive
  • 9. Workflow Correlation : Demo Purpose: To familiarize users with correlated workflows in the Neuron ESB Explorer Objectives: To acquaint users with how to create correlated workflows: • Correlation Sets • Correlating Send and Receive
  • 10. Workflow Patterns and Correlation Compensation • What is compensation? • The mechanism by which previously completed work can be undone • Why is it important? • Not all systems are transactional! • How do you do it? • Compensable Activity • See: https://msdn.microsoft.com/en- us/library/system.activities.statements.compensableactivity(v=vs.110).a spx
  • 11. Workflow Patterns and Correlation : Lab Purpose: Learn how to create a a workflow which implements correlated send and receive. Objectives: • Create a workflow with correlated send and receive • Test the correlated workflow at design time
  • 12. Workflow Patterns and Correlation Review • Correlated workflows allow Neuron ESB to implement a singleton pattern • Correlated IDs and Correlation Sets are necessary for implementing correlation • When systems are not transactional they can be used in a compensation block

Editor's Notes

  1. The goals of this lesson are to provide users with an understanding of how to use correlated workflows and the message correlation scope.
  2. This lesson has been broken down into four sections to make the information presented easier to understand. The sections that we will be covering are Using singleton patterns with workflows Using correlation when sending and receiving messages Using the message correlation scope Using compensation
  3. The singleton pattern is a software design pattern that restricts the instantiation of a class to one "single" instance. This is useful when exactly one object is needed to coordinate actions across the system. In workflows this means that for a given set of messages, only one workflow instance will be created. This is extremely useful in cases such as aggregating messages for batch deliver or collecting data that is delivered across multiple messages such as an order delivered from multiple files.
  4. In order to create a singleton pattern in a workflow definition you need to create a correlated workflow, as these are the only workflow types that support the singleton pattern. Inside the workflow you would need to create a loop, usually a while loop. Using a while loop allows you to determine when to stop listening for messages. Are you expecting a certain number of messages? Is there some sort of message that indicates it is the last message in the set? Regardless of what method you use to determine the end of the expected messages, you should always encapsulate your loop in a timeout activity. This will avoid encountering zombie workflows should the final message not come through. Inside of the loop you will need to receive the message and then do something with that message such as add it to collection so the next message through does not overwrite it.
  5. So how does Neuron ESB know which messages goes to which workflow? Neuron ESB uses parts of the message or custom properties to indicate the unique identifier that tells the system what set of messages a message belongs to. This identifier is called the correlation id. Once the correlation id is found, Neuron ESB puts that value in the correlation set for the workflow endpoint. Each time a new message comes in, Neuron compares the messages correlation id with the correlation set of the running workflows. If a match is found, the message is handed off to the workflow. If not, then a new workflow is instantiated with the correlation set as the value of the correlation id. The correlation set of a correlated workflow is set on the Correlation Set tab of the workflow endpoint. This tab is only active if the workflow definition associated with the endpoint is a correlated workflow definition. Correlation sets also play a part in the message correlation scope, which we will discuss later in this presentation. However, it is important to note that the message correlation scope must be used in conjunction with a receive activity in order to get messages from the bus for the correlation set associated with it.
  6. Correlated send and receive is used when a long running transaction requires asynchronous communication with external systems. For example in a case where an approval is needed before allowing the workflow to continue processing, think loan types situations, it may take a day or more before that approval comes back. This is far outside the normal time period for a request reply scenario, so the correlated send and receive would be used to correlate the response back the the original requester without having to worry about a request reply timeout. While the workflow is waiting, the workflow unloads itself until it is informed that a message has been received.
  7. In order to perform a correlated send and receive you will need Correlation ID – This is the value that is used for routing incoming messages to the correct instance of the workflow. You must define this variable, but do not set it! Correlation Set – This defines the location of the value in the incoming message that will be used in the Correlation ID. It’s easiest to use a message property! Publish Message Activity – Publishes the one-way request and initializes the correlation set Receive Message Activity – Participates in the correlation by creating an internal subscription for message(s) that match the correlation set
  8. Compensation is the ability to undo the work performed by a series of activities, which together define an eventually consistent operation, if one or more of the steps fail. This is important if you are attempting to use transactions with a system that does not support them. The CompensableActivity activity provides this functionality for you, allowing you to create a series of steps that tell the system how to undo what was done in a system the does not support transactions.