Collection Aggregator
Abstract
• The main motto of this PPT is How to use
Collection Aggregator in our applications.
Example
.mflow
• <?xml version="1.0" encoding="UTF-8"?>
• <mule xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata" xmlns:json="http://www.mulesoft.org/schema/mule/json"
xmlns:validation="http://www.mulesoft.org/schema/mule/validation" xmlns:context="http://www.springframework.org/schema/context"
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.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-current.xsd
• http://www.mulesoft.org/schema/mule/validation http://www.mulesoft.org/schema/mule/validation/current/mule-validation.xsd
• http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd">
• <http:listener-config name="HTTP_Listener_Configuration" host="${host}" port="${port}" doc:name="HTTP Listener Configuration"/>
• <context:property-placeholder location="myfile-${env}.properties"/>
• <flow name="PropertyPlaceHolderFlow">
• <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
• <splitter expression="#[xpath:shiporder/item/title]" doc:name="Splitter"/>
• <collection-aggregator failOnTimeout="true" doc:name="Collection Aggregator"/>
• <logger message="--Hello---#[payload]-----" level="INFO" doc:name="Logger"/>
• <json:object-to-json-transformer doc:name="Object to JSON"/>
• </flow>
• </mule>
• Output:
• WARN 2016-12-21 12:28:44,693
[[PropertyPlaceHolder].HTTP_Listener_Configuration.w
orker.01]
org.mule.module.xml.expression.AbstractXPathExpress
ionEvaluator: The xpath: expression evaluator has been
deprecated in Mule 3.6.0 and will be removed in 4.0.
Please use the xpath3() MEL function instead
• INFO 2016-12-21 12:28:44,745
[[PropertyPlaceHolder].HTTP_Listener_Configuration.w
orker.01]
org.mule.api.processor.LoggerMessageProcessor: --
Hello---[Laptop, Memory Chips]-----
• Flow of execution:
1. URL to trigger the service from browser
http://localhost:8086/
Note:
1. Create myfile-DEV.proerties file in
src/main/resources folder
2. Specify the env name in mule-app.properties
file
References
• https://docs.mulesoft.com/mule-user-
guide/v/3.6/splitter-flow-control-reference

Collection aggregator

  • 1.
  • 2.
    Abstract • The mainmotto of this PPT is How to use Collection Aggregator in our applications.
  • 3.
  • 5.
    .mflow • <?xml version="1.0"encoding="UTF-8"?> • <mule xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata" xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:validation="http://www.mulesoft.org/schema/mule/validation" xmlns:context="http://www.springframework.org/schema/context" 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.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-current.xsd • http://www.mulesoft.org/schema/mule/validation http://www.mulesoft.org/schema/mule/validation/current/mule-validation.xsd • http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd"> • <http:listener-config name="HTTP_Listener_Configuration" host="${host}" port="${port}" doc:name="HTTP Listener Configuration"/> • <context:property-placeholder location="myfile-${env}.properties"/> • <flow name="PropertyPlaceHolderFlow"> • <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/> • <splitter expression="#[xpath:shiporder/item/title]" doc:name="Splitter"/> • <collection-aggregator failOnTimeout="true" doc:name="Collection Aggregator"/> • <logger message="--Hello---#[payload]-----" level="INFO" doc:name="Logger"/> • <json:object-to-json-transformer doc:name="Object to JSON"/> • </flow> • </mule>
  • 6.
    • Output: • WARN2016-12-21 12:28:44,693 [[PropertyPlaceHolder].HTTP_Listener_Configuration.w orker.01] org.mule.module.xml.expression.AbstractXPathExpress ionEvaluator: The xpath: expression evaluator has been deprecated in Mule 3.6.0 and will be removed in 4.0. Please use the xpath3() MEL function instead • INFO 2016-12-21 12:28:44,745 [[PropertyPlaceHolder].HTTP_Listener_Configuration.w orker.01] org.mule.api.processor.LoggerMessageProcessor: -- Hello---[Laptop, Memory Chips]-----
  • 8.
    • Flow ofexecution: 1. URL to trigger the service from browser http://localhost:8086/ Note: 1. Create myfile-DEV.proerties file in src/main/resources folder 2. Specify the env name in mule-app.properties file
  • 9.