SlideShare a Scribd company logo
How to use Choice component
28-09-2014
Abstract
• The main motto of this PPT is how to use
Choice component in our applications.
Introduction
• The choice flow control dynamically routes
messages based on message payload or
properties. It adds conditional programming
to a flow, similar to an if/then/elsecode block.
Example
• .mflow
• <?xml version="1.0" encoding="UTF-8"?>
• <mule xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm" xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="EE-
3.4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-current.xsd
• http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
• http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd
• http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
• http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd">
• <flow name="MessagePropertiesFlow1" doc:name="MessagePropertiesFlow1">
• <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8089" path="choice" doc:name="HTTP"/>
• <message-properties-transformer scope="session" doc:name="Message Properties">
• <add-message-property key="property1" value="mule"/>
• </message-properties-transformer>
• <logger message="--flow1--#[sessionVars['property1']]" level="INFO" doc:name="Logger"/>
• <vm:outbound-endpoint exchange-pattern="request-response" path="messageproperties" doc:name="VM"/>
• </flow>
• <flow name="MessagePropertiesFlow2" doc:name="MessagePropertiesFlow2">
• <vm:inbound-endpoint exchange-pattern="request-response" path="messageproperties" doc:name="VM"/>
• <logger message="---flow2--#[sessionVars['property1']]" level="INFO" doc:name="Logger"/>
• <choice doc:name="Choice">
• <when expression="#[sessionVars['property1']=='mule']">
• <logger message="--the value of session property (property1) is 'mule'" level="INFO" doc:name="Logger"/>
• </when>
• <otherwise>
• <logger message="--the value of session property (property1) is not 'mule'" level="INFO" doc:name="Logger"/>
• </otherwise>
• </choice>
• </flow>
• </mule>
• Output:
• INFO 2015-10-03 16:00:23,705 [[messageproperties].config.change.14.thread.1] org.mule.DefaultMuleContext:
• **********************************************************************
• * Application: messageproperties *
• * OS encoding: Cp1252, Mule encoding: UTF-8 *
• * *
• * Agents Running: *
• * Clustering Agent *
• * JMX Agent *
• **********************************************************************
• INFO 2015-10-03 16:00:23,706 [[messageproperties].config.change.14.thread.1]
org.mule.module.launcher.MuleDeploymentService:
• ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
• + Started app 'messageproperties' +
• ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
• INFO 2015-10-03 16:00:26,480 [[messageproperties].connector.http.mule.default.receiver.02]
org.mule.api.processor.LoggerMessageProcessor: --flow1--mule--studio
• INFO 2015-10-03 16:00:26,482 [[messageproperties].connector.http.mule.default.receiver.02]
org.mule.lifecycle.AbstractLifecycleManager: Initialising: 'connector.VM.mule.default.dispatcher.771015974'.
Object is: VMMessageDispatcher
• INFO 2015-10-03 16:00:26,482 [[messageproperties].connector.http.mule.default.receiver.02]
org.mule.lifecycle.AbstractLifecycleManager: Starting: 'connector.VM.mule.default.dispatcher.771015974'. Object
is: VMMessageDispatcher
• INFO 2015-10-03 16:00:26,489 [[messageproperties].connector.http.mule.default.receiver.02]
org.mule.api.processor.LoggerMessageProcessor: ---flow2--mule--studio
• Flow of execution:
1. URL to trigger the service from browser
http://localhost:8089/choice
2. session property is created using message
property component In flow1
3. Service displays session properties in flow1,
flow2
4. In flow2 the choice component checks the value
of the session property is ‘mule’ or not, if true then
it displays “the value of session property
(property1) is 'mule” else it goes and displays data
in default component
References
• https://docs.mulesoft.com/mule-user-
guide/v/3.5/choice-flow-control-reference
Ad

More Related Content

What's hot (20)

Soa
SoaSoa
Soa
Manav Prasad
 
Mule esb beginner’s guide
Mule esb beginner’s guideMule esb beginner’s guide
Mule esb beginner’s guide
D.Rajesh Kumar
 
Mule concepts components
Mule concepts componentsMule concepts components
Mule concepts components
kunal vishe
 
Mule ESB
Mule ESBMule ESB
Mule ESB
niravn
 
Implementing an Esb using Mule
Implementing an Esb using MuleImplementing an Esb using Mule
Implementing an Esb using Mule
AbdulImrankhan7
 
Anypoint connector dev kit
Anypoint connector dev kitAnypoint connector dev kit
Anypoint connector dev kit
Son Nguyen
 
Webbinar slides
Webbinar slidesWebbinar slides
Webbinar slides
WSO2
 
Core concepts in mule
Core concepts in muleCore concepts in mule
Core concepts in mule
Sindhu VL
 
Webservice vm in mule
Webservice vm in muleWebservice vm in mule
Webservice vm in mule
Praneethchampion
 
Mule high availability (ha) cluster
Mule high availability (ha) clusterMule high availability (ha) cluster
Mule high availability (ha) cluster
Achyuta Lakshmi
 
Mulesoft idempotent Message Filter
Mulesoft idempotent Message FilterMulesoft idempotent Message Filter
Mulesoft idempotent Message Filter
kumar gaurav
 
Wso2 esb
Wso2 esbWso2 esb
Wso2 esb
Kevin Jeremy Valdez Navarrete
 
Mule real-world-old
Mule real-world-oldMule real-world-old
Mule real-world-old
F K
 
Anypoint mq (mulesoft) introduction
Anypoint mq (mulesoft)  introductionAnypoint mq (mulesoft)  introduction
Anypoint mq (mulesoft) introduction
removed_34be96619b7b4fcc8ecd9495ad92d40b
 
Mule soa
Mule soaMule soa
Mule soa
D.Rajesh Kumar
 
Mule Complete Training
Mule Complete TrainingMule Complete Training
Mule Complete Training
sourabh aggarwal
 
Mule Request Reply
Mule Request ReplyMule Request Reply
Mule Request Reply
Ram Bavireddi
 
Mule requester
Mule requesterMule requester
Mule requester
Sindhu VL
 
Service orchestration and soa
Service orchestration and soaService orchestration and soa
Service orchestration and soa
D.Rajesh Kumar
 
Mule esb
Mule esbMule esb
Mule esb
Naresh Naidu
 

Viewers also liked (12)

Trade unions
Trade unionsTrade unions
Trade unions
Sharon Mansoor
 
Speed worksheet
Speed worksheetSpeed worksheet
Speed worksheet
mariaalmarcha2002
 
Juárez dijo no. Historieta Histórica
Juárez dijo no. Historieta HistóricaJuárez dijo no. Historieta Histórica
Juárez dijo no. Historieta Histórica
avitiadgo
 
Untitled6
Untitled6Untitled6
Untitled6
hpenny3
 
Dispositivos inteligentes
Dispositivos inteligentes Dispositivos inteligentes
Dispositivos inteligentes
cr-peinado
 
NACD CERTIFICATION 6-5-2014
NACD CERTIFICATION 6-5-2014NACD CERTIFICATION 6-5-2014
NACD CERTIFICATION 6-5-2014
Lila Salem
 
Tatuajes
TatuajesTatuajes
Tatuajes
patolina2390
 
Oh my good tapas, oferta los jueves
Oh my good tapas, oferta los juevesOh my good tapas, oferta los jueves
Oh my good tapas, oferta los jueves
Oh my good tapas
 
Resume
ResumeResume
Resume
Zach Roper
 
Mapa conceptual del plan y programas 2011. pag 41-48
Mapa conceptual del plan y programas 2011. pag 41-48Mapa conceptual del plan y programas 2011. pag 41-48
Mapa conceptual del plan y programas 2011. pag 41-48
Antonieta Valdez Cardenas
 
Sharplan 40C CO2 Laser
Sharplan 40C CO2 LaserSharplan 40C CO2 Laser
Sharplan 40C CO2 Laser
nissim_shaked
 
Future of management
Future of managementFuture of management
Future of management
Sharon Mansoor
 
Juárez dijo no. Historieta Histórica
Juárez dijo no. Historieta HistóricaJuárez dijo no. Historieta Histórica
Juárez dijo no. Historieta Histórica
avitiadgo
 
Untitled6
Untitled6Untitled6
Untitled6
hpenny3
 
Dispositivos inteligentes
Dispositivos inteligentes Dispositivos inteligentes
Dispositivos inteligentes
cr-peinado
 
NACD CERTIFICATION 6-5-2014
NACD CERTIFICATION 6-5-2014NACD CERTIFICATION 6-5-2014
NACD CERTIFICATION 6-5-2014
Lila Salem
 
Oh my good tapas, oferta los jueves
Oh my good tapas, oferta los juevesOh my good tapas, oferta los jueves
Oh my good tapas, oferta los jueves
Oh my good tapas
 
Mapa conceptual del plan y programas 2011. pag 41-48
Mapa conceptual del plan y programas 2011. pag 41-48Mapa conceptual del plan y programas 2011. pag 41-48
Mapa conceptual del plan y programas 2011. pag 41-48
Antonieta Valdez Cardenas
 
Sharplan 40C CO2 Laser
Sharplan 40C CO2 LaserSharplan 40C CO2 Laser
Sharplan 40C CO2 Laser
nissim_shaked
 
Ad

Similar to Mule-choice component (20)

Mule Choice component
Mule Choice component Mule Choice component
Mule Choice component
AbdulImrankhan7
 
Choice component
Choice component Choice component
Choice component
F K
 
Choice component in mule
Choice component in muleChoice component in mule
Choice component in mule
javeed_mhd
 
Choice component
Choice component Choice component
Choice component
Sunil Komarapu
 
Choice component in mule
Choice component in mule Choice component in mule
Choice component in mule
Rajkattamuri
 
For Each Component
For Each ComponentFor Each Component
For Each Component
Durga Prasad Kakarla
 
How to use for each component
How to use for each componentHow to use for each component
How to use for each component
maheshtheapex
 
For each component
For each component For each component
For each component
AbdulImrankhan7
 
For each component
For each component For each component
For each component
F K
 
For each component in mule
For each component in muleFor each component in mule
For each component in mule
Rajkattamuri
 
For each component
For each component For each component
For each component
Sunil Komarapu
 
For each component in mule
For each component in muleFor each component in mule
For each component in mule
javeed_mhd
 
For each component in mule demo
For each component in mule demoFor each component in mule demo
For each component in mule demo
Sudha Ch
 
How to use database component using stored procedure call
How to use database component using stored procedure callHow to use database component using stored procedure call
How to use database component using stored procedure call
prathyusha vadla
 
How to use message properties component
How to use message properties componentHow to use message properties component
How to use message properties component
maheshtheapex
 
Message properties component
Message properties component Message properties component
Message properties component
Sunil Komarapu
 
Message properties component in mule
Message properties component in muleMessage properties component in mule
Message properties component in mule
javeed_mhd
 
Message properties component
Message properties componentMessage properties component
Message properties component
F K
 
How to use message properties component
How to use message properties componentHow to use message properties component
How to use message properties component
mdfkhan625
 
How to use message properties component
How to use message properties componentHow to use message properties component
How to use message properties component
princeirfancivil
 
Choice component
Choice component Choice component
Choice component
F K
 
Choice component in mule
Choice component in muleChoice component in mule
Choice component in mule
javeed_mhd
 
Choice component in mule
Choice component in mule Choice component in mule
Choice component in mule
Rajkattamuri
 
How to use for each component
How to use for each componentHow to use for each component
How to use for each component
maheshtheapex
 
For each component
For each component For each component
For each component
F K
 
For each component in mule
For each component in muleFor each component in mule
For each component in mule
Rajkattamuri
 
For each component in mule
For each component in muleFor each component in mule
For each component in mule
javeed_mhd
 
For each component in mule demo
For each component in mule demoFor each component in mule demo
For each component in mule demo
Sudha Ch
 
How to use database component using stored procedure call
How to use database component using stored procedure callHow to use database component using stored procedure call
How to use database component using stored procedure call
prathyusha vadla
 
How to use message properties component
How to use message properties componentHow to use message properties component
How to use message properties component
maheshtheapex
 
Message properties component
Message properties component Message properties component
Message properties component
Sunil Komarapu
 
Message properties component in mule
Message properties component in muleMessage properties component in mule
Message properties component in mule
javeed_mhd
 
Message properties component
Message properties componentMessage properties component
Message properties component
F K
 
How to use message properties component
How to use message properties componentHow to use message properties component
How to use message properties component
mdfkhan625
 
How to use message properties component
How to use message properties componentHow to use message properties component
How to use message properties component
princeirfancivil
 
Ad

Recently uploaded (20)

Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 

Mule-choice component

  • 1. How to use Choice component 28-09-2014
  • 2. Abstract • The main motto of this PPT is how to use Choice component in our applications.
  • 3. Introduction • The choice flow control dynamically routes messages based on message payload or properties. It adds conditional programming to a flow, similar to an if/then/elsecode block.
  • 5. • .mflow • <?xml version="1.0" encoding="UTF-8"?> • <mule xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:vm="http://www.mulesoft.org/schema/mule/vm" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="EE- 3.4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd • http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd • http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd • http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd • http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd"> • <flow name="MessagePropertiesFlow1" doc:name="MessagePropertiesFlow1"> • <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8089" path="choice" doc:name="HTTP"/> • <message-properties-transformer scope="session" doc:name="Message Properties"> • <add-message-property key="property1" value="mule"/> • </message-properties-transformer> • <logger message="--flow1--#[sessionVars['property1']]" level="INFO" doc:name="Logger"/> • <vm:outbound-endpoint exchange-pattern="request-response" path="messageproperties" doc:name="VM"/> • </flow> • <flow name="MessagePropertiesFlow2" doc:name="MessagePropertiesFlow2"> • <vm:inbound-endpoint exchange-pattern="request-response" path="messageproperties" doc:name="VM"/> • <logger message="---flow2--#[sessionVars['property1']]" level="INFO" doc:name="Logger"/> • <choice doc:name="Choice"> • <when expression="#[sessionVars['property1']=='mule']"> • <logger message="--the value of session property (property1) is 'mule'" level="INFO" doc:name="Logger"/> • </when> • <otherwise> • <logger message="--the value of session property (property1) is not 'mule'" level="INFO" doc:name="Logger"/> • </otherwise> • </choice> • </flow> • </mule>
  • 6. • Output: • INFO 2015-10-03 16:00:23,705 [[messageproperties].config.change.14.thread.1] org.mule.DefaultMuleContext: • ********************************************************************** • * Application: messageproperties * • * OS encoding: Cp1252, Mule encoding: UTF-8 * • * * • * Agents Running: * • * Clustering Agent * • * JMX Agent * • ********************************************************************** • INFO 2015-10-03 16:00:23,706 [[messageproperties].config.change.14.thread.1] org.mule.module.launcher.MuleDeploymentService: • ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ • + Started app 'messageproperties' + • ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ • INFO 2015-10-03 16:00:26,480 [[messageproperties].connector.http.mule.default.receiver.02] org.mule.api.processor.LoggerMessageProcessor: --flow1--mule--studio • INFO 2015-10-03 16:00:26,482 [[messageproperties].connector.http.mule.default.receiver.02] org.mule.lifecycle.AbstractLifecycleManager: Initialising: 'connector.VM.mule.default.dispatcher.771015974'. Object is: VMMessageDispatcher • INFO 2015-10-03 16:00:26,482 [[messageproperties].connector.http.mule.default.receiver.02] org.mule.lifecycle.AbstractLifecycleManager: Starting: 'connector.VM.mule.default.dispatcher.771015974'. Object is: VMMessageDispatcher • INFO 2015-10-03 16:00:26,489 [[messageproperties].connector.http.mule.default.receiver.02] org.mule.api.processor.LoggerMessageProcessor: ---flow2--mule--studio
  • 7. • Flow of execution: 1. URL to trigger the service from browser http://localhost:8089/choice 2. session property is created using message property component In flow1 3. Service displays session properties in flow1, flow2 4. In flow2 the choice component checks the value of the session property is ‘mule’ or not, if true then it displays “the value of session property (property1) is 'mule” else it goes and displays data in default component