SlideShare ist ein Scribd-Unternehmen logo
1 von 27
Mule Integration Workshop
Controlling Message Flow
Rajarajan Sadhasivam
Chapters
Schedule
Filter Types
Synchronous and Asynchronous flows
Multicasting a message
Routing message based on conditions
Filtering messages
Flow Processing Strategy
A flow processing strategy determines how mule implements message
processing for a given flow.
Should the message be processed synchronously (on the same thread)
or asynchronously(on a different thread)?
If asynchronous, what are the properties of the pool of threads used to
process the messages?
If asynchronously ,how will messages wait for their turn to be processed
in the second thread
Flow Processing Strategy
All Mule flows have an implicit processing strategy which Mule applies
automatically,
- Either synchronous or queued-asynchronous.
- Each of these is optimal for certain flows.
The Processing Strategy can be changed
The Common Flow Processing Strategy
Synchronous
- After the flow receives the message,all processing ,including the
processing of the response, is done in the same thread.
- With the exception of asynchronous scopes Async and For Each.
The Common Flow Processing Strategy
Queued -asynchronous
-Default if no other processing strategy is configured.
- Higher Throughput
- Uses a queue to decoupe the flow’s receiver from the rest of the
steps in the flow.
- Works the same way in a scope as in a flow.
- Can fine tune number of threads , number queued , Object Store.
- Asynchronous strategy is same except it doesn’t use a queue so
cannot be distributed across nodes in a cluster.
Determining Flow Processing Strategy
Mule selects a processing strategy for a flow based on the flow’s
exchange pattern (and if it is transactional).
The flow exchange is determined by the exchange pattern of the
inbound endpoint.
A request-response exchange pattern is used when the sender of the
message expects the response.
- Mule Applies a Synchronous processing strategy
A one way exchange pattern is used when no response is expected.
- Mule Applies a queued – asynchronous processing strategy.
Async Scope
A Branch processing block that executes simultaneously with the parent
message flow.
-Useful for executing time-consuming operations that do not require
sending a response back to the initiating flow.
Send a message copy to the first message processor in its own
processing block and the next message processor in the main flow.
The payload is not copied , the same payload objects will be referenced
by both messages in the two flows.
Async Scope vs Asynchronous Flow
An async scope is similar to an asynchronous flow in that:
It processes the message asynchronously with the main flow, so the message is
simultaneously processed in the async scope without pausing the processing in the
main flow thread
Does not pass data from the scope back into the main flow thread
It can have its own processing strategy
However, unlike an asynchronous flow, an async scope:
Exists in-line with the main flow thread
Is not called by a flow reference component
Is not re-usable
cannot have its own exception handling strategy ,it inherits from the flow it resides
Routers
Routes messages to various destination in a
mule flow
Some incorporates logic to analyze and
possibly transform messages before routing
takes place.
Some change the payload , some don’t
Flow controls that don’t change the payload
- Choice, Scatter-Gather , First Successful,
Round Robin.
Routers (Contd)Routers
Message Processor Description
Scatter-Gather Multicast a message to multiple targets concurrently
Choice Send a message to the first matching message processor
Collection Aggregator Aggregate messages into a message collection
Collection Splitter Split a message that is a collection
Custom Aggregator A custom-written class that aggregates messages
Custom Processor A custom-written message processor
First Successful Iterate through message processors until one succeeds (added in 3.0.1)
Message Chunk Aggregator Aggregate messages into a single message
Message Chunk Splitter Split a message into fixed-size chunks
Resequencer Reorder a list of messages
Round Robin Round-robin among a list of message processors (added in 3.0.1)
Splitter Split a message using an expression
Scatter-Gather
Scatter-Gather
 A number of flow controls aggregate results from multiple routes.
 Scatter-Gather sends the message to each route concurrently and returns
a collections of all results.
 Is often used with the combine collections transformer
- Flattens a collection of collections into one collection.
Eg:
<scatter-gather doc:name="Scatter-Gather">
<flow-ref name="scatter-gather-demoFlow1" doc:name="scatter-gather-demoFlow1"/>
<flow-ref name="scatter-gather-demoFlow2" doc:name="scatter-gather-demoFlow2"/>
</scatter-gather>
Choice
Choice
 The Choice message processor sends a message to the first message
processor that matches. If none match and a message processor has been
configured as "otherwise", the message is sent there. If none match and no
otherwise message processor has been configured, an exception is thrown.
Eg:
<choice doc:name="Choice">
<when expression="#[payload == 'Main Flow']">
<flow-ref name="choice-demoFlow1" doc:name="choice-demoFlow1"/>
</when>
<when expression="">
<flow-ref name="choice-demoFlow2" doc:name="choice-demoFlow2"/>
</when>
<otherwise>
<logger message="Default ::#[payload]" level="INFO" doc:name="Logger"/>
</otherwise>
</choice>
Collection Aggregator
 The Collection Aggregator groups incoming messages that have matching
group IDs before forwarding them.
 The group ID can come from the correlation ID or another property that
links messages together.
Eg:
<collection-aggregator timeout="6000" failOnTimeout="false"/>
Collection Splitter
 The Collection Splitter acts on messages whose payload is a Collection
type.
 It sends each member of the collection to the next message processor as
separate messages.
 Attribute “enableCorrelation” to determine whether a correlation ID is
set on each individual message.
Eg:
<collection-splitter enableCorrelation="IF_NOT_SET"/>
Custom Aggregator
 A Custom Aggregator is an instance of a user-written class that
aggregates messages. This class must implement the interface
MessageProcessor.
 Often, it will be useful for it to subclass AbstractAggregator, which
provides the skeleton of a thread-safe aggregator implementation,
requiring only specific correlation logic.
Eg:
<custom-aggregator failOnTimeout="true" class="com.mycompany.utils.PurchaseOrderAggregator"/>
First Successful
 The First Successful message processor iterates through its list of child message
processors, routing a received message to each of them in order until one processes
the message successfully. If none succeed, an exception is thrown.
 Success is defined as:
 If the child message processor thows an exception, this is a failure.
 Otherwise:
 If the child message processor returns a message that contains an exception payload, this
is a failure.
 If the child message processor returns a message that does not contain an exception
payload, this is a success.
 If the child message processor does not return a message (e.g. is a one-way endpoint),
this is a success.
Eg:
<first-successful>
<http:outbound-endpoint address="http://localhost:6090/weather-forecast" />
<http :outbound-endpoint address="http://localhost:6091/weather-forecast" />
<http:outbound-endpoint address="http://localhost:6092/weather-forecast" />
<vm:outbound-endpoint path="dead-letter-queue" />
</first-successful>
Resequencer
 The Resequencer sorts a set of received messages by their correlation
sequence property and issues them in the correct order. It uses the timeout
and failOnTimeout attributes to determine when all the messages in the set
have been received.
Eg:
<resequencer timeout="6000" failOnTimeout="false"/>
Round Robin
 The Round Robin message processor iterates through a list of child message
processors in round-robin fashion: the first message received is routed to the
first child, the second message to the second child, and so on. After a
message has been routed to each child, the next is routed to the first child
again, restarting the iteration.
Eg:
<round-robin>
<http:outbound-endpoint address="http://localhost:6090/weather-forecast" />
<http:outbound-endpoint address="http://localhost:6091/weather-forecast" />
<http:outbound-endpoint address="http://localhost:6092/weather-forecast" />
</round-robin>
Splitter
 A Splitter uses an expression to split a message into pieces, all of which are
then sent to the next message processor. Like other splitters, it can optionally
specify non-default locations within the message for the message ID and
correlation ID.
Eg:
<splitter expression="#[payload]" doc:name="Splitter"/>
Example with Scatter Gather – Multicasting a Message
Example with Choice– Routing Message Based on a Condition
Filters
 Determine whether a message can proceed in a mule
flow
- Keeps subsequent processors from receiving
irrelevant or incomprehensible messages
 Some implement basic logic operators(and,or,not)
 Can be combined for more logical conditions
 Can be defined as global filters and referenced for
reuse
 There are 12 bundled filters
- And, Or ,Not apply Boolean logic
- Message filter nests other filters
- Idempotent ensures a message is not delivered
more than once.
- You can create a custom filter
Filters
Idempotent Filter
 An idempotent filter checks the unique message ID of the incoming message
to ensure that only unique messages are received by the flow.
 The ID can be generated from the message using an expression defined in the
idExpression attribute. By default, the expression used is #[message:id], which
means the underlying endpoint must support unique message IDs for this to
work. Otherwise, a UniqueIdNotSupportedException is thrown.
Exception Filter
 An Exception Filter matches on the type of an exception. You supply the class
indicating the exception type to the Expected Type property.
Filters
Message Filter
• The Message Filter is used to control whether a message is processed by using a filter. In
addition to the filter, we can configure whether to throw an exception if the filter does not
accept the message and an optional message processor to send unaccepted messages to.
And/Or/Not Logic Filters
 Logic filters apply the And/Or/Not logic to one or more nested filters that they enclose. When
you use these logic filters, you add nested filters to them from within the And/Or/Not-filter
nested pane.
 Use the And Filter to combine two or more filters. The And Filter accepts the message and
returns true only if all of its enclosed filters return true.
 The Or Filter returns true if any of its enclosed child filters return true. That is, it accepts the
message if the message matches the criteria of any of its filters.
 The Not Filter inverts its enclosed filter. That is, the Not Filter accepts the message and returns
true if the message does not match the filter criteria. For example, if the enclosed filter normally
returns true for a specific message, when nested within the Not filter it returns false
Example With Payload Filter – Filtering Messages
Thank you

Weitere ähnliche Inhalte

Was ist angesagt?

Mule Message Chunk Aggregator
Mule Message Chunk AggregatorMule Message Chunk Aggregator
Mule Message Chunk AggregatorAnkush Sharma
 
Muleflowarchitecturepart2
Muleflowarchitecturepart2Muleflowarchitecturepart2
Muleflowarchitecturepart2vijaynerd
 
Scatter gather in mule
Scatter gather in muleScatter gather in mule
Scatter gather in muleKhasim Cise
 
Runing batch job in mule
Runing batch job in muleRuning batch job in mule
Runing batch job in muleSon Nguyen
 
Mule message processor or routers
Mule message processor or routersMule message processor or routers
Mule message processor or routersSon Nguyen
 
Mule threading profile & processing strategy
Mule threading profile & processing strategyMule threading profile & processing strategy
Mule threading profile & processing strategychetan singhal
 
Mule integration
Mule integrationMule integration
Mule integrationSon Nguyen
 
Message processor in mule
Message processor in muleMessage processor in mule
Message processor in muleSon Nguyen
 
Scatter gather flow in mule
Scatter gather flow in muleScatter gather flow in mule
Scatter gather flow in mulePraneethchampion
 
Mule any point studio
Mule any point studioMule any point studio
Mule any point studioSon Nguyen
 
mule custom aggregator
mule   custom aggregatormule   custom aggregator
mule custom aggregatorPaolo Mojica
 
Mule concepts filters scopes_routers
Mule concepts filters scopes_routersMule concepts filters scopes_routers
Mule concepts filters scopes_routerskunal vishe
 
Mule requestor component
Mule requestor componentMule requestor component
Mule requestor componentSindhu VL
 
Mule Script Transformer
Mule Script TransformerMule Script Transformer
Mule Script TransformerAnkush Sharma
 

Was ist angesagt? (20)

Mule jms
Mule   jmsMule   jms
Mule jms
 
Mule Message Chunk Aggregator
Mule Message Chunk AggregatorMule Message Chunk Aggregator
Mule Message Chunk Aggregator
 
Muleflowarchitecturepart2
Muleflowarchitecturepart2Muleflowarchitecturepart2
Muleflowarchitecturepart2
 
Scatter gather in mule
Scatter gather in muleScatter gather in mule
Scatter gather in mule
 
Mule splitters
Mule splittersMule splitters
Mule splitters
 
Runing batch job in mule
Runing batch job in muleRuning batch job in mule
Runing batch job in mule
 
Using seda in mule
Using seda in muleUsing seda in mule
Using seda in mule
 
Mule message processor or routers
Mule message processor or routersMule message processor or routers
Mule message processor or routers
 
Mule threading profile & processing strategy
Mule threading profile & processing strategyMule threading profile & processing strategy
Mule threading profile & processing strategy
 
Mule integration
Mule integrationMule integration
Mule integration
 
Mule LDAP Connector
Mule LDAP ConnectorMule LDAP Connector
Mule LDAP Connector
 
Message processor in mule
Message processor in muleMessage processor in mule
Message processor in mule
 
Scatter gather flow in mule
Scatter gather flow in muleScatter gather flow in mule
Scatter gather flow in mule
 
Mule SOAP Router
Mule SOAP RouterMule SOAP Router
Mule SOAP Router
 
Mule SFTP connector
Mule SFTP connectorMule SFTP connector
Mule SFTP connector
 
Mule any point studio
Mule any point studioMule any point studio
Mule any point studio
 
mule custom aggregator
mule   custom aggregatormule   custom aggregator
mule custom aggregator
 
Mule concepts filters scopes_routers
Mule concepts filters scopes_routersMule concepts filters scopes_routers
Mule concepts filters scopes_routers
 
Mule requestor component
Mule requestor componentMule requestor component
Mule requestor component
 
Mule Script Transformer
Mule Script TransformerMule Script Transformer
Mule Script Transformer
 

Andere mochten auch

Mapping and listing with mule
Mapping and listing with muleMapping and listing with mule
Mapping and listing with muleirfan1008
 
Mule esb
Mule esbMule esb
Mule esbPhaniu
 
Mule system properties
Mule system propertiesMule system properties
Mule system propertiesRavinder Singh
 
Xslt in mule
Xslt in muleXslt in mule
Xslt in muleirfan1008
 
Mule salesforce integration patterns
Mule salesforce integration patternsMule salesforce integration patterns
Mule salesforce integration patternsD.Rajesh Kumar
 
Database component in mule demo
Database component in mule demoDatabase component in mule demo
Database component in mule demoSudha Ch
 
Filter expression in mule demo
Filter expression in mule demoFilter expression in mule demo
Filter expression in mule demoSudha Ch
 
Groovy with Mule
Groovy with MuleGroovy with Mule
Groovy with Muleirfan1008
 
Connecting to external_application
Connecting to external_applicationConnecting to external_application
Connecting to external_applicationRajarajan Sadhasivam
 
Validate Soap Request in Mule
Validate Soap Request in MuleValidate Soap Request in Mule
Validate Soap Request in Muleirfan1008
 
File component in mule demo
File component in mule demoFile component in mule demo
File component in mule demoSudha Ch
 
Send email attachment using smtp in mule esb
Send email attachment using smtp  in mule esbSend email attachment using smtp  in mule esb
Send email attachment using smtp in mule esbirfan1008
 
Send email attachment using smtp in mule esb
Send email attachment using smtp  in mule esbSend email attachment using smtp  in mule esb
Send email attachment using smtp in mule esbprinceirfancivil
 
Mule security jaas
Mule security jaasMule security jaas
Mule security jaasirfan1008
 
Mule with velocity
Mule with velocityMule with velocity
Mule with velocityKhan625
 

Andere mochten auch (20)

Mapping and listing with mule
Mapping and listing with muleMapping and listing with mule
Mapping and listing with mule
 
Mule esb
Mule esbMule esb
Mule esb
 
Mule esb-microsoft
Mule esb-microsoftMule esb-microsoft
Mule esb-microsoft
 
Mule system properties
Mule system propertiesMule system properties
Mule system properties
 
Xslt in mule
Xslt in muleXslt in mule
Xslt in mule
 
Mule salesforce integration patterns
Mule salesforce integration patternsMule salesforce integration patterns
Mule salesforce integration patterns
 
Database component in mule demo
Database component in mule demoDatabase component in mule demo
Database component in mule demo
 
Filter expression in mule demo
Filter expression in mule demoFilter expression in mule demo
Filter expression in mule demo
 
Groovy with Mule
Groovy with MuleGroovy with Mule
Groovy with Mule
 
Mule with facebook
Mule with facebookMule with facebook
Mule with facebook
 
Connecting to external_application
Connecting to external_applicationConnecting to external_application
Connecting to external_application
 
Validate Soap Request in Mule
Validate Soap Request in MuleValidate Soap Request in Mule
Validate Soap Request in Mule
 
File component in mule demo
File component in mule demoFile component in mule demo
File component in mule demo
 
Mule soa
Mule soaMule soa
Mule soa
 
Send email attachment using smtp in mule esb
Send email attachment using smtp  in mule esbSend email attachment using smtp  in mule esb
Send email attachment using smtp in mule esb
 
Send email attachment using smtp in mule esb
Send email attachment using smtp  in mule esbSend email attachment using smtp  in mule esb
Send email attachment using smtp in mule esb
 
Mule security jaas
Mule security jaasMule security jaas
Mule security jaas
 
Http mule
Http muleHttp mule
Http mule
 
Mule with velocity
Mule with velocityMule with velocity
Mule with velocity
 
Mule architecture
Mule architectureMule architecture
Mule architecture
 

Ähnlich wie Controlling message flow

Ähnlich wie Controlling message flow (20)

Mule message processor or routers
Mule message processor or routersMule message processor or routers
Mule message processor or routers
 
Mule flow processing strategies
Mule flow processing strategiesMule flow processing strategies
Mule flow processing strategies
 
Mule esb flow processing strategies
Mule esb flow processing strategiesMule esb flow processing strategies
Mule esb flow processing strategies
 
Scopes in mule
Scopes in muleScopes in mule
Scopes in mule
 
Types of MessageRouting in Mule
Types of MessageRouting in MuleTypes of MessageRouting in Mule
Types of MessageRouting in Mule
 
Scopes
ScopesScopes
Scopes
 
Routing in mule
Routing in muleRouting in mule
Routing in mule
 
Scatter-Gather
Scatter-GatherScatter-Gather
Scatter-Gather
 
Introduction to Kafka and Event-Driven
Introduction to Kafka and Event-DrivenIntroduction to Kafka and Event-Driven
Introduction to Kafka and Event-Driven
 
Introduction to Kafka and Event-Driven
Introduction to Kafka and Event-DrivenIntroduction to Kafka and Event-Driven
Introduction to Kafka and Event-Driven
 
Splitter
SplitterSplitter
Splitter
 
Cache scope
Cache scopeCache scope
Cache scope
 
Cache scope
Cache scopeCache scope
Cache scope
 
Until successful scope in mule
Until successful scope in muleUntil successful scope in mule
Until successful scope in mule
 
Mule scopes&amp;error handling
Mule scopes&amp;error handlingMule scopes&amp;error handling
Mule scopes&amp;error handling
 
Spring JMS and ActiveMQ
Spring JMS and ActiveMQSpring JMS and ActiveMQ
Spring JMS and ActiveMQ
 
Apache samza
Apache samzaApache samza
Apache samza
 
Iterative processing using the for each scope in
Iterative processing using the for each scope inIterative processing using the for each scope in
Iterative processing using the for each scope in
 
Mule routing and filters
Mule routing and filtersMule routing and filters
Mule routing and filters
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 

Kürzlich hochgeladen

%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyAnusha Are
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfryanfarris8
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...Nitya salvi
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxalwaysnagaraju26
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 

Kürzlich hochgeladen (20)

%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodology
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide Deck
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 

Controlling message flow

  • 1. Mule Integration Workshop Controlling Message Flow Rajarajan Sadhasivam
  • 2. Chapters Schedule Filter Types Synchronous and Asynchronous flows Multicasting a message Routing message based on conditions Filtering messages
  • 3. Flow Processing Strategy A flow processing strategy determines how mule implements message processing for a given flow. Should the message be processed synchronously (on the same thread) or asynchronously(on a different thread)? If asynchronous, what are the properties of the pool of threads used to process the messages? If asynchronously ,how will messages wait for their turn to be processed in the second thread
  • 4. Flow Processing Strategy All Mule flows have an implicit processing strategy which Mule applies automatically, - Either synchronous or queued-asynchronous. - Each of these is optimal for certain flows. The Processing Strategy can be changed
  • 5. The Common Flow Processing Strategy Synchronous - After the flow receives the message,all processing ,including the processing of the response, is done in the same thread. - With the exception of asynchronous scopes Async and For Each.
  • 6. The Common Flow Processing Strategy Queued -asynchronous -Default if no other processing strategy is configured. - Higher Throughput - Uses a queue to decoupe the flow’s receiver from the rest of the steps in the flow. - Works the same way in a scope as in a flow. - Can fine tune number of threads , number queued , Object Store. - Asynchronous strategy is same except it doesn’t use a queue so cannot be distributed across nodes in a cluster.
  • 7. Determining Flow Processing Strategy Mule selects a processing strategy for a flow based on the flow’s exchange pattern (and if it is transactional). The flow exchange is determined by the exchange pattern of the inbound endpoint. A request-response exchange pattern is used when the sender of the message expects the response. - Mule Applies a Synchronous processing strategy A one way exchange pattern is used when no response is expected. - Mule Applies a queued – asynchronous processing strategy.
  • 8. Async Scope A Branch processing block that executes simultaneously with the parent message flow. -Useful for executing time-consuming operations that do not require sending a response back to the initiating flow. Send a message copy to the first message processor in its own processing block and the next message processor in the main flow. The payload is not copied , the same payload objects will be referenced by both messages in the two flows.
  • 9. Async Scope vs Asynchronous Flow An async scope is similar to an asynchronous flow in that: It processes the message asynchronously with the main flow, so the message is simultaneously processed in the async scope without pausing the processing in the main flow thread Does not pass data from the scope back into the main flow thread It can have its own processing strategy However, unlike an asynchronous flow, an async scope: Exists in-line with the main flow thread Is not called by a flow reference component Is not re-usable cannot have its own exception handling strategy ,it inherits from the flow it resides
  • 10. Routers Routes messages to various destination in a mule flow Some incorporates logic to analyze and possibly transform messages before routing takes place. Some change the payload , some don’t Flow controls that don’t change the payload - Choice, Scatter-Gather , First Successful, Round Robin.
  • 11. Routers (Contd)Routers Message Processor Description Scatter-Gather Multicast a message to multiple targets concurrently Choice Send a message to the first matching message processor Collection Aggregator Aggregate messages into a message collection Collection Splitter Split a message that is a collection Custom Aggregator A custom-written class that aggregates messages Custom Processor A custom-written message processor First Successful Iterate through message processors until one succeeds (added in 3.0.1) Message Chunk Aggregator Aggregate messages into a single message Message Chunk Splitter Split a message into fixed-size chunks Resequencer Reorder a list of messages Round Robin Round-robin among a list of message processors (added in 3.0.1) Splitter Split a message using an expression
  • 12. Scatter-Gather Scatter-Gather  A number of flow controls aggregate results from multiple routes.  Scatter-Gather sends the message to each route concurrently and returns a collections of all results.  Is often used with the combine collections transformer - Flattens a collection of collections into one collection. Eg: <scatter-gather doc:name="Scatter-Gather"> <flow-ref name="scatter-gather-demoFlow1" doc:name="scatter-gather-demoFlow1"/> <flow-ref name="scatter-gather-demoFlow2" doc:name="scatter-gather-demoFlow2"/> </scatter-gather>
  • 13. Choice Choice  The Choice message processor sends a message to the first message processor that matches. If none match and a message processor has been configured as "otherwise", the message is sent there. If none match and no otherwise message processor has been configured, an exception is thrown. Eg: <choice doc:name="Choice"> <when expression="#[payload == 'Main Flow']"> <flow-ref name="choice-demoFlow1" doc:name="choice-demoFlow1"/> </when> <when expression=""> <flow-ref name="choice-demoFlow2" doc:name="choice-demoFlow2"/> </when> <otherwise> <logger message="Default ::#[payload]" level="INFO" doc:name="Logger"/> </otherwise> </choice>
  • 14. Collection Aggregator  The Collection Aggregator groups incoming messages that have matching group IDs before forwarding them.  The group ID can come from the correlation ID or another property that links messages together. Eg: <collection-aggregator timeout="6000" failOnTimeout="false"/>
  • 15. Collection Splitter  The Collection Splitter acts on messages whose payload is a Collection type.  It sends each member of the collection to the next message processor as separate messages.  Attribute “enableCorrelation” to determine whether a correlation ID is set on each individual message. Eg: <collection-splitter enableCorrelation="IF_NOT_SET"/>
  • 16. Custom Aggregator  A Custom Aggregator is an instance of a user-written class that aggregates messages. This class must implement the interface MessageProcessor.  Often, it will be useful for it to subclass AbstractAggregator, which provides the skeleton of a thread-safe aggregator implementation, requiring only specific correlation logic. Eg: <custom-aggregator failOnTimeout="true" class="com.mycompany.utils.PurchaseOrderAggregator"/>
  • 17. First Successful  The First Successful message processor iterates through its list of child message processors, routing a received message to each of them in order until one processes the message successfully. If none succeed, an exception is thrown.  Success is defined as:  If the child message processor thows an exception, this is a failure.  Otherwise:  If the child message processor returns a message that contains an exception payload, this is a failure.  If the child message processor returns a message that does not contain an exception payload, this is a success.  If the child message processor does not return a message (e.g. is a one-way endpoint), this is a success. Eg: <first-successful> <http:outbound-endpoint address="http://localhost:6090/weather-forecast" /> <http :outbound-endpoint address="http://localhost:6091/weather-forecast" /> <http:outbound-endpoint address="http://localhost:6092/weather-forecast" /> <vm:outbound-endpoint path="dead-letter-queue" /> </first-successful>
  • 18. Resequencer  The Resequencer sorts a set of received messages by their correlation sequence property and issues them in the correct order. It uses the timeout and failOnTimeout attributes to determine when all the messages in the set have been received. Eg: <resequencer timeout="6000" failOnTimeout="false"/>
  • 19. Round Robin  The Round Robin message processor iterates through a list of child message processors in round-robin fashion: the first message received is routed to the first child, the second message to the second child, and so on. After a message has been routed to each child, the next is routed to the first child again, restarting the iteration. Eg: <round-robin> <http:outbound-endpoint address="http://localhost:6090/weather-forecast" /> <http:outbound-endpoint address="http://localhost:6091/weather-forecast" /> <http:outbound-endpoint address="http://localhost:6092/weather-forecast" /> </round-robin>
  • 20. Splitter  A Splitter uses an expression to split a message into pieces, all of which are then sent to the next message processor. Like other splitters, it can optionally specify non-default locations within the message for the message ID and correlation ID. Eg: <splitter expression="#[payload]" doc:name="Splitter"/>
  • 21. Example with Scatter Gather – Multicasting a Message
  • 22. Example with Choice– Routing Message Based on a Condition
  • 23. Filters  Determine whether a message can proceed in a mule flow - Keeps subsequent processors from receiving irrelevant or incomprehensible messages  Some implement basic logic operators(and,or,not)  Can be combined for more logical conditions  Can be defined as global filters and referenced for reuse  There are 12 bundled filters - And, Or ,Not apply Boolean logic - Message filter nests other filters - Idempotent ensures a message is not delivered more than once. - You can create a custom filter
  • 24. Filters Idempotent Filter  An idempotent filter checks the unique message ID of the incoming message to ensure that only unique messages are received by the flow.  The ID can be generated from the message using an expression defined in the idExpression attribute. By default, the expression used is #[message:id], which means the underlying endpoint must support unique message IDs for this to work. Otherwise, a UniqueIdNotSupportedException is thrown. Exception Filter  An Exception Filter matches on the type of an exception. You supply the class indicating the exception type to the Expected Type property.
  • 25. Filters Message Filter • The Message Filter is used to control whether a message is processed by using a filter. In addition to the filter, we can configure whether to throw an exception if the filter does not accept the message and an optional message processor to send unaccepted messages to. And/Or/Not Logic Filters  Logic filters apply the And/Or/Not logic to one or more nested filters that they enclose. When you use these logic filters, you add nested filters to them from within the And/Or/Not-filter nested pane.  Use the And Filter to combine two or more filters. The And Filter accepts the message and returns true only if all of its enclosed filters return true.  The Or Filter returns true if any of its enclosed child filters return true. That is, it accepts the message if the message matches the criteria of any of its filters.  The Not Filter inverts its enclosed filter. That is, the Not Filter accepts the message and returns true if the message does not match the filter criteria. For example, if the enclosed filter normally returns true for a specific message, when nested within the Not filter it returns false
  • 26. Example With Payload Filter – Filtering Messages