Request Reply Scope in Mule
The Request Reply message processor receives a message on one channel, allows the back-end process to be forked to invoke other flows asynchronously, and accepts the asynchronous result on another channel.
flow of request reply scope :
URL : http://localhost:8085/api/reqreply
Method : POST
Input :
Output :
XML project code :
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:vm="http://www.mulesoft.org/schema/mule/vm" xmlns:http="http://www.mulesoft.org/schema/mule/http" 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/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd">
<vm:connector name="VM" validateConnections="true" doc:name="VM"/>
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8085" basePath="/api" doc:name="HTTP Listener Configuration"/>
<flow name="test_reqreplyFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/reqreply" doc:name="HTTP"/>
<request-reply doc:name="Request-Reply">
<vm:outbound-endpoint exchange-pattern="one-way" path="transientQueue" connector-ref="VM" doc:name="VM"/>
<vm:inbound-endpoint exchange-pattern="one-way" path="persistentQueue" doc:name="VM"/>
</request-reply>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
</flow>
<flow name="test_reqreplyFlow1">
<vm:inbound-endpoint exchange-pattern="one-way" path="transientQueue" doc:name="VM"/>
<logger message="Payload is : #[payload]" level="INFO" doc:name="Logger"/>
<vm:outbound-endpoint exchange-pattern="one-way" path="persistentQueue" doc:name="VM"/>
</flow>
</mule>
No comments:
Post a Comment