The Peterson Group Review: How to Find the Best Headphone Splitter
How to use splitter component
-
Upload
sivachandra-mandalapu -
Category
Education
-
view
70 -
download
0
Transcript of How to use splitter component
How to use Splitter Component
21-12-2014
Abstract
• The main motto of this PPT is How to use Splitter Component in our applications.
Introduction• The Splitter Flow Control splits a message into separate fragments, then
sends these fragments one at a time to the next message processor in the flow. Segments are identified based on an expression parameter, usually written in Mule Expression Language (MEL), but other formats can be employed also. You can then use aCollection Aggregator Flow Control to reassemble the parts of the original message. You can also include a Resequencer Flow Control to put the parts back into the original sequence in case they are shuffled out of order.
• Splitting and aggregating the message is especially useful when you intend to process the split parts in asynchronous flows running on separate servers. Together, the splitter and aggregator flow controls allow you to share the workload among several servers and still be able to reassemble the message after it’s processed.
Example
.mflow• <?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" 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/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">• <flow name="SplitterPOCFlow1" doc:name="SplitterPOCFlow1">• <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8089" path="SplitterPOC"
doc:name="HTTP"/>• <logger message="--Entered into the flow" level="INFO" doc:name="Logger"/>• <set-payload value="<shiporder xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
orderid="555-66-7777"> <orderperson>Derek Adams</orderperson> <shipto> <name>Azaz Desai</name> <address>123 Test Drive</address> <city>Ahmedabad</city> <country>India</country> </shipto> <item> <title>Laptop</title> <note>Some piece of Mac crap!</note> <quantity>1</quantity> <price>99.97</price> </item> <item> <title>Memory Chips</title> <note>1 GB</note> <quantity>4</quantity> <price>49.99</price> </item> </shiporder>" doc:name="Set Payload"/>
• <splitter enableCorrelation="ALWAYS" expression="#[xpath:shiporder/item/title]" doc:name="Splitter"/>• <logger message="--After Splitter #[payload]" level="INFO" doc:name="Logger"/>• </flow>• </mule>
• Output:INFO 2015-12-21 11:23:06,695 [[SplitterPOC].config.change.2.thread.1] org.mule.DefaultMuleContext: *********************************************************************** Application: SplitterPOC ** OS encoding: Cp1252, Mule encoding: UTF-8 ** ** Agents Running: ** Clustering Agent ** JMX Agent ***********************************************************************INFO 2015-12-21 11:23:06,696 [[SplitterPOC].config.change.2.thread.1] org.mule.module.launcher.MuleDeploymentService: +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Started app 'SplitterPOC' +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++INFO 2015-12-21 11:23:13,044 [[SplitterPOC].connector.http.mule.default.receiver.02] org.mule.api.processor.LoggerMessageProcessor: --Entered into the flowINFO 2015-12-21 11:23:13,124 [[SplitterPOC].connector.http.mule.default.receiver.02] org.mule.api.processor.LoggerMessageProcessor: --After Splitter LaptopINFO 2015-12-21 11:23:13,127 [[SplitterPOC].connector.http.mule.default.receiver.02] org.mule.api.processor.LoggerMessageProcessor: --After Splitter Memory Chips
• Flow of execution:1. URL to trigger the service from browserhttp://localhost:8089/SplitterPOC 2.Splitter component splits the input request based on the given expression and displays the results in Console.
References
• https://docs.mulesoft.com/mule-user-guide/v/3.7/splitter-flow-control-reference