Flow Scope in Mule
Flow scope is component for grouping together a sequence of other Core components and operations (provided by connectors and modules) to help automate integration processes. The Flow component is fundamental to a Mule app. Because all Mule apps must contain at least one flow, Anypoint Studio and Flow Designer automatically provide the first Flow component in your Mule app.
Basically in mule flow consist of two things :
1. Message Source
2. Message Processor
Message Source : A message source receives or generates new messages to be processed by Mule. Mule supports the following types of message sources:
Inbound Endpoints
Polls
Custom Message Source
Message Processor : Message Processors are used with in flows to control how messages are sent and received with in that flow.
flow scope structure : Left side is reserved for message source and right side of empty flow is used for message processors.
flow example :
Here HTTP is message source which listens http call and set payload is message processor which is used to set any payload.
URL : http://localhost:8085/api/flow
Method : GET
when you hit url you will get below output :
URL : http://localhost:8085/api/flow
Method : GET
when you hit url you will get below output :
XML project code :
<?xml version="1.0" encoding="UTF-8"?>
<mule 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:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8085" basePath="/api" doc:name="HTTP Listener Configuration"/>
<flow name="test_flowFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/flow" doc:name="HTTP"/>
<set-payload value="Hello Himanshu" doc:name="Set Payload"/>
</flow>
</mule>
No comments:
Post a Comment