SlideShare a Scribd company logo
How to use Request Reply Scope
29-05-2015
Abstract
• The main motto of this PPT is How to use
Request Reply Scope in our applications.
Introduction
• The Request-Reply scope enables you to embed
a "pocket" of asynchronous processing within a
Mule flow. This functionality enables you to
receive a response from an asynchronous flow
without hardcoding the destination of the
response. For example, you can use request-reply
to convert a one-way VM or JMS flow to
a request-response flow without having to
change it’s configuration. In other words, the
request-reply converts part of a synchronous
process into an asynchronous one.
Example
.mflow
• <?xml version="1.0" encoding="UTF-8"?>
• <mule 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"
• 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:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8097" doc:name="HTTP Listener Configuration"/>
• <flow name="RequestReplyFlow">
• <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
• <set-payload doc:name="Set Payload" value="Request"/>
• <request-reply doc:name="Request-Reply">
• <vm:outbound-endpoint exchange-pattern="one-way" path="req" doc:name="VM"/>
• <vm:inbound-endpoint exchange-pattern="one-way" path="res" doc:name="VM"/>
• </request-reply>
• <logger message="--Final Payload is #[payload]--" level="INFO" doc:name="Logger"/>
• </flow>
• <flow name="RequestReplyFlow1">
• <vm:inbound-endpoint exchange-pattern="one-way" path="req" doc:name="VM"/>
• <logger message="--request flow--#[payload]--" level="INFO" doc:name="Logger"/>
• <set-payload doc:name="Set Payload" value="#[payload]_Reply"/>
• <logger message="--2--#[payload]--" level="INFO" doc:name="Logger"/>
• <vm:outbound-endpoint exchange-pattern="one-way" path="res" doc:name="VM"/>
• </flow>
• </mule>
• Output:
• INFO 2016-05-29 07:15:37,972 [[RequestReply].HTTP_Listener_Configuration.worker.01] org.mule.lifecycle.AbstractLifecycleManager: Initialising:
'connector.VM.mule.default.dispatcher.1445751667'. Object is: VMMessageDispatcher
• INFO 2016-05-29 07:15:37,973 [[RequestReply].HTTP_Listener_Configuration.worker.01] org.mule.lifecycle.AbstractLifecycleManager: Starting:
'connector.VM.mule.default.dispatcher.1445751667'. Object is: VMMessageDispatcher
• INFO 2016-05-29 07:15:38,006 [[RequestReply].RequestReplyFlow1.stage1.02] org.mule.api.processor.LoggerMessageProcessor: --request flow--
Request--
• INFO 2016-05-29 07:15:38,008 [[RequestReply].RequestReplyFlow1.stage1.02] org.mule.api.processor.LoggerMessageProcessor: --2--
Request_Reply--
• INFO 2016-05-29 07:15:38,014 [[RequestReply].RequestReplyFlow1.stage1.02] org.mule.transport.DefaultReplyToHandler: reply to sent:
DefaultOutboundEndpoint{endpointUri=vm://res?connector=connector.VM.mule.default, connector=VMConnector
• {
• name=connector.VM.mule.default
• lifecycle=start
• this=705c6b57
• numberOfConcurrentTransactedReceivers=4
• createMultipleTransactedReceivers=true
• connected=true
• supportedProtocols=[vm]
• serviceOverrides=<none>
• }
• , name='endpoint.vm.res', mep=ONE_WAY, properties={connector=connector.VM.mule.default}, transactionConfig=Transaction{factory=null,
action=INDIFFERENT, timeout=0}, deleteUnacceptedMessages=false, initialState=started, responseTimeout=10000, endpointEncoding=UTF-8,
disableTransportTransformer=false}
• INFO 2016-05-29 07:15:38,015 [[RequestReply].connector.VM.mule.default.dispatcher.01] org.mule.lifecycle.AbstractLifecycleManager: Initialising:
'connector.VM.mule.default.dispatcher.408742592'. Object is: VMMessageDispatcher
• INFO 2016-05-29 07:15:38,015 [[RequestReply].connector.VM.mule.default.dispatcher.01] org.mule.lifecycle.AbstractLifecycleManager: Starting:
'connector.VM.mule.default.dispatcher.408742592'. Object is: VMMessageDispatcher
• INFO 2016-05-29 07:15:38,016 [[RequestReply].connector.VM.mule.default.dispatcher.02] org.mule.lifecycle.AbstractLifecycleManager: Initialising:
'connector.VM.mule.default.dispatcher.1982112397'. Object is: VMMessageDispatcher
• INFO 2016-05-29 07:15:38,016 [[RequestReply].connector.VM.mule.default.dispatcher.02] org.mule.lifecycle.AbstractLifecycleManager: Starting:
'connector.VM.mule.default.dispatcher.1982112397'. Object is: VMMessageDispatcher
• INFO 2016-05-29 07:15:38,022 [[RequestReply].HTTP_Listener_Configuration.worker.01] org.mule.api.processor.LoggerMessageProcessor: --Final
Payload is Request_Reply--
• Flow of execution:
1. URL to trigger the service from browser
http://localhost:8097
2. A. Flow1 will trigger flow2 with the VM in
Request block of Request_Reply scope and with
the payload as “Request”.
B. Flow2 sets the payload as “Request_Reply”
and calls the VM in Reply block of
Request_Reply scope in flow1 and at the end
POC displays the final payload in console and
also returns the same to Browser.
References
• https://docs.mulesoft.com/mule-user-
guide/v/3.6/request-reply-scope

More Related Content

PPTX
Quartz component in mule demo
PPTX
For each component in mule
PPTX
Quartz component in mule
PPTX
Mulesoft vm transport reference
PPTX
Mulesoft Using Groovy Component
PPTX
How to get http query parameters in mule
PPTX
Choice component in mule
PPT
Introduction to es bs mule
Quartz component in mule demo
For each component in mule
Quartz component in mule
Mulesoft vm transport reference
Mulesoft Using Groovy Component
How to get http query parameters in mule
Choice component in mule
Introduction to es bs mule

What's hot (18)

PPTX
Mule quartz hari_gatadi
PPT
Maven introduction in Mule
PPTX
Basic example using choice component
PPTX
Vm component in mule
PPTX
Filter expression in mule demo
PPTX
Mule with stored procedure
PPTX
Compress and decompress
PPT
Mule security - spring security manager
PPTX
Timer Interceptor in Mule part 2
PPTX
How to use until successful component
PPTX
Mule message processor or routers
PPTX
How to use splitter component
PPTX
Until Successful Component
PPT
Simple VM in Mule
PPTX
Junit in mule demo
PPTX
Basic example using database component
PPTX
Groovy example in mule
PPTX
Mule xml java
Mule quartz hari_gatadi
Maven introduction in Mule
Basic example using choice component
Vm component in mule
Filter expression in mule demo
Mule with stored procedure
Compress and decompress
Mule security - spring security manager
Timer Interceptor in Mule part 2
How to use until successful component
Mule message processor or routers
How to use splitter component
Until Successful Component
Simple VM in Mule
Junit in mule demo
Basic example using database component
Groovy example in mule
Mule xml java
Ad

Viewers also liked (20)

DOCX
Mumtaz Mehmood CV
PDF
Ankur (Bestseller Marathi Poetry) Dr. Shriiwas Kashalikar
PDF
abbreviations in merchant seamen's records
PPTX
Rest Component
PDF
H2S awareness Mulholland
PDF
Сантехника Incea – Сделано в Италии от Stockist Italy – информация на 07 мая ...
PPTX
Disciplina Marketing e Turismo (IFSP Campus Cubatao) (aula 04)
PDF
hazardous locations
PDF
Maulan muhammad umar ichravi ki ilmi khidmat by hamda shahid
PPTX
How to use jms inbound endpoint
PPSX
The summary of my beloved Prophet Hazrat Muhammad ﷺ.
PPTX
WaveCrest Inc Profile 4May2016new
DOCX
Laudo resistencia aterramento suzano
PPTX
Property place holder
PPTX
Reference exception strategy
PPTX
Deployment options for mule applications
PDF
Lessons From Sharding Solr At Etsy: Presented by Gregg Donovan, Etsy
Mumtaz Mehmood CV
Ankur (Bestseller Marathi Poetry) Dr. Shriiwas Kashalikar
abbreviations in merchant seamen's records
Rest Component
H2S awareness Mulholland
Сантехника Incea – Сделано в Италии от Stockist Italy – информация на 07 мая ...
Disciplina Marketing e Turismo (IFSP Campus Cubatao) (aula 04)
hazardous locations
Maulan muhammad umar ichravi ki ilmi khidmat by hamda shahid
How to use jms inbound endpoint
The summary of my beloved Prophet Hazrat Muhammad ﷺ.
WaveCrest Inc Profile 4May2016new
Laudo resistencia aterramento suzano
Property place holder
Reference exception strategy
Deployment options for mule applications
Lessons From Sharding Solr At Etsy: Presented by Gregg Donovan, Etsy
Ad

Similar to How to use Request Reply scope (20)

PPTX
Mule scopes request_response_scope
PPTX
Mule Request Reply
PPTX
Vm component in mule demo
PPTX
Vm Component
PPTX
Vm component
 
PPTX
Vm component
PPTX
How to use vm component
PPTX
How to use poll scope
PPTX
PPTX
Mule message
ODP
Mule scopes&amp;error handling
PPT
Rest service in mule
PPT
Rest Service In Mule
PPTX
Mule requestor component
PPTX
Mule esb mule message
PPTX
Mule requesterdemo
PPTX
For each component in mule demo
PPTX
Mule integration
PDF
Mule ESB
PPTX
How to use processor chain
Mule scopes request_response_scope
Mule Request Reply
Vm component in mule demo
Vm Component
Vm component
 
Vm component
How to use vm component
How to use poll scope
Mule message
Mule scopes&amp;error handling
Rest service in mule
Rest Service In Mule
Mule requestor component
Mule esb mule message
Mule requesterdemo
For each component in mule demo
Mule integration
Mule ESB
How to use processor chain

More from sivachandra mandalapu (20)

PPTX
Mock component in munit
PPTX
Jms selector
PPTX
PPTX
Object store
PPTX
How to use SFTP
PPTX
How to use secure property placeholder
PPTX
Specifying a default exception strategy
PPTX
Defining global exception strategies
PPTX
Validate json schema
PPTX
PPTX
Collection aggregator
PPTX
Cloud hub deployment
PPTX
Securing api with_o_auth2
PPTX
Setting up organization with api access
PPTX
API gateway setup
PPTX
PPTX
PPTX
Bean as Datasource
PPTX
Synchronous communication using jms back channel
Mock component in munit
Jms selector
Object store
How to use SFTP
How to use secure property placeholder
Specifying a default exception strategy
Defining global exception strategies
Validate json schema
Collection aggregator
Cloud hub deployment
Securing api with_o_auth2
Setting up organization with api access
API gateway setup
Bean as Datasource
Synchronous communication using jms back channel

Recently uploaded (20)

PDF
01-Introduction-to-Information-Management.pdf
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PPTX
Week 4 Term 3 Study Techniques revisited.pptx
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
RMMM.pdf make it easy to upload and study
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
Complications of Minimal Access Surgery at WLH
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
master seminar digital applications in india
PDF
TR - Agricultural Crops Production NC III.pdf
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
01-Introduction-to-Information-Management.pdf
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
Week 4 Term 3 Study Techniques revisited.pptx
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Anesthesia in Laparoscopic Surgery in India
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Supply Chain Operations Speaking Notes -ICLT Program
RMMM.pdf make it easy to upload and study
Module 4: Burden of Disease Tutorial Slides S2 2025
Complications of Minimal Access Surgery at WLH
Abdominal Access Techniques with Prof. Dr. R K Mishra
master seminar digital applications in india
TR - Agricultural Crops Production NC III.pdf
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Mark Klimek Lecture Notes_240423 revision books _173037.pdf

How to use Request Reply scope

  • 1. How to use Request Reply Scope 29-05-2015
  • 2. Abstract • The main motto of this PPT is How to use Request Reply Scope in our applications.
  • 3. Introduction • The Request-Reply scope enables you to embed a "pocket" of asynchronous processing within a Mule flow. This functionality enables you to receive a response from an asynchronous flow without hardcoding the destination of the response. For example, you can use request-reply to convert a one-way VM or JMS flow to a request-response flow without having to change it’s configuration. In other words, the request-reply converts part of a synchronous process into an asynchronous one.
  • 5. .mflow • <?xml version="1.0" encoding="UTF-8"?> • <mule 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" • 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:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8097" doc:name="HTTP Listener Configuration"/> • <flow name="RequestReplyFlow"> • <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/> • <set-payload doc:name="Set Payload" value="Request"/> • <request-reply doc:name="Request-Reply"> • <vm:outbound-endpoint exchange-pattern="one-way" path="req" doc:name="VM"/> • <vm:inbound-endpoint exchange-pattern="one-way" path="res" doc:name="VM"/> • </request-reply> • <logger message="--Final Payload is #[payload]--" level="INFO" doc:name="Logger"/> • </flow> • <flow name="RequestReplyFlow1"> • <vm:inbound-endpoint exchange-pattern="one-way" path="req" doc:name="VM"/> • <logger message="--request flow--#[payload]--" level="INFO" doc:name="Logger"/> • <set-payload doc:name="Set Payload" value="#[payload]_Reply"/> • <logger message="--2--#[payload]--" level="INFO" doc:name="Logger"/> • <vm:outbound-endpoint exchange-pattern="one-way" path="res" doc:name="VM"/> • </flow> • </mule>
  • 6. • Output: • INFO 2016-05-29 07:15:37,972 [[RequestReply].HTTP_Listener_Configuration.worker.01] org.mule.lifecycle.AbstractLifecycleManager: Initialising: 'connector.VM.mule.default.dispatcher.1445751667'. Object is: VMMessageDispatcher • INFO 2016-05-29 07:15:37,973 [[RequestReply].HTTP_Listener_Configuration.worker.01] org.mule.lifecycle.AbstractLifecycleManager: Starting: 'connector.VM.mule.default.dispatcher.1445751667'. Object is: VMMessageDispatcher • INFO 2016-05-29 07:15:38,006 [[RequestReply].RequestReplyFlow1.stage1.02] org.mule.api.processor.LoggerMessageProcessor: --request flow-- Request-- • INFO 2016-05-29 07:15:38,008 [[RequestReply].RequestReplyFlow1.stage1.02] org.mule.api.processor.LoggerMessageProcessor: --2-- Request_Reply-- • INFO 2016-05-29 07:15:38,014 [[RequestReply].RequestReplyFlow1.stage1.02] org.mule.transport.DefaultReplyToHandler: reply to sent: DefaultOutboundEndpoint{endpointUri=vm://res?connector=connector.VM.mule.default, connector=VMConnector • { • name=connector.VM.mule.default • lifecycle=start • this=705c6b57 • numberOfConcurrentTransactedReceivers=4 • createMultipleTransactedReceivers=true • connected=true • supportedProtocols=[vm] • serviceOverrides=<none> • } • , name='endpoint.vm.res', mep=ONE_WAY, properties={connector=connector.VM.mule.default}, transactionConfig=Transaction{factory=null, action=INDIFFERENT, timeout=0}, deleteUnacceptedMessages=false, initialState=started, responseTimeout=10000, endpointEncoding=UTF-8, disableTransportTransformer=false} • INFO 2016-05-29 07:15:38,015 [[RequestReply].connector.VM.mule.default.dispatcher.01] org.mule.lifecycle.AbstractLifecycleManager: Initialising: 'connector.VM.mule.default.dispatcher.408742592'. Object is: VMMessageDispatcher • INFO 2016-05-29 07:15:38,015 [[RequestReply].connector.VM.mule.default.dispatcher.01] org.mule.lifecycle.AbstractLifecycleManager: Starting: 'connector.VM.mule.default.dispatcher.408742592'. Object is: VMMessageDispatcher • INFO 2016-05-29 07:15:38,016 [[RequestReply].connector.VM.mule.default.dispatcher.02] org.mule.lifecycle.AbstractLifecycleManager: Initialising: 'connector.VM.mule.default.dispatcher.1982112397'. Object is: VMMessageDispatcher • INFO 2016-05-29 07:15:38,016 [[RequestReply].connector.VM.mule.default.dispatcher.02] org.mule.lifecycle.AbstractLifecycleManager: Starting: 'connector.VM.mule.default.dispatcher.1982112397'. Object is: VMMessageDispatcher • INFO 2016-05-29 07:15:38,022 [[RequestReply].HTTP_Listener_Configuration.worker.01] org.mule.api.processor.LoggerMessageProcessor: --Final Payload is Request_Reply--
  • 7. • Flow of execution: 1. URL to trigger the service from browser http://localhost:8097 2. A. Flow1 will trigger flow2 with the VM in Request block of Request_Reply scope and with the payload as “Request”. B. Flow2 sets the payload as “Request_Reply” and calls the VM in Reply block of Request_Reply scope in flow1 and at the end POC displays the final payload in console and also returns the same to Browser.