SlideShare une entreprise Scribd logo
1  sur  8
How to use For Each Component
28-09-2014
Abstract
• The main motto of this PPT is how to use For
Each component in our applications.
Introduction
• The Foreach scope splits a collection into
elements and processes them iteratively
through the processors embedded in the
scope, then returns the original message to
the flow.
Example
• .mflow<?xml version="1.0" encoding="UTF-8"?>
• <mule xmlns:jdbc-ee="http://www.mulesoft.org/schema/mule/ee/jdbc" 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
• http://www.mulesoft.org/schema/mule/ee/jdbc http://www.mulesoft.org/schema/mule/ee/jdbc/current/mule-jdbc-ee.xsd">
• <jdbc-ee:mssql-data-source name="MS_SQL_Data_Source" user=“****" password=“****"
url="jdbc:sqlserver://localhost;databaseName=test1" transactionIsolation="UNSPECIFIED" doc:name="MS SQL Data Source"/>
• <jdbc-ee:connector name="Database" dataSource-ref="MS_SQL_Data_Source" validateConnections="true" queryTimeout="-1"
pollingFrequency="0" doc:name="Database"/>
• <flow name="Database_ComponentFlow1" doc:name="Database_ComponentFlow1">
• <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8087" path="database" doc:name="HTTP"/>
• <logger message="--main flow--" level="INFO" doc:name="Logger"/>
• <jdbc-ee:outbound-endpoint exchange-pattern="request-response" queryKey="select" queryTimeout="-1" connector-
ref="Database" doc:name="Database">
• <jdbc-ee:query key="select" value="select * from mytable"/>
• </jdbc-ee:outbound-endpoint>
• <foreach collection="#[payload]" doc:name="For Each">
• <logger message="--In foreach loop" level="INFO" doc:name="Logger"/>
• <logger message="--Result--#[payload]" level="INFO" doc:name="Logger"/>
• </foreach>
• </flow>
• </mule>
• Output:INFO 2015-10-03 17:50:45,299 [main] org.mule.DefaultMuleContext:
• **********************************************************************
• * Application: Database Component *
• * OS encoding: Cp1252, Mule encoding: UTF-8 *
• * *
• * Agents Running: *
• * Clustering Agent *
• * JMX Agent *
• **********************************************************************
• INFO 2015-10-03 17:50:45,300 [main] org.mule.module.launcher.MuleDeploymentService:
• ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
• + Started app 'Database Component' +
• ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
• INFO 2015-10-03 17:50:52,770 [[Database Component].connector.http.mule.default.receiver.02] org.mule.api.processor.LoggerMessageProcessor: -
-main flow--
• INFO 2015-10-03 17:50:52,778 [[Database Component].connector.http.mule.default.receiver.02] org.mule.lifecycle.AbstractLifecycleManager:
Initialising: 'Database.dispatcher.424429501'. Object is: EEJdbcMessageDispatcher
• INFO 2015-10-03 17:50:52,779 [[Database Component].connector.http.mule.default.receiver.02] org.mule.lifecycle.AbstractLifecycleManager:
Starting: 'Database.dispatcher.424429501'. Object is: EEJdbcMessageDispatcher
• INFO 2015-10-03 17:50:53,042 [[Database Component].connector.http.mule.default.receiver.02] org.mule.api.processor.LoggerMessageProcessor: -
-In foreach loop
• INFO 2015-10-03 17:50:53,046 [[Database Component].connector.http.mule.default.receiver.02] org.mule.api.processor.LoggerMessageProcessor: -
-Result--{subj=Hindi, marks=55, name=Ramesh, id=1}
• INFO 2015-10-03 17:50:53,047 [[Database Component].connector.http.mule.default.receiver.02] org.mule.api.processor.LoggerMessageProcessor: -
-In foreach loop
• INFO 2015-10-03 17:50:53,049 [[Database Component].connector.http.mule.default.receiver.02] org.mule.api.processor.LoggerMessageProcessor: -
-Result--{subj=English, marks=65, name=Mahesh, id=2}
• INFO 2015-10-03 17:50:53,050 [[Database Component].connector.http.mule.default.receiver.02] org.mule.api.processor.LoggerMessageProcessor: -
-In foreach loop
• INFO 2015-10-03 17:50:53,052 [[Database Component].connector.http.mule.default.receiver.02] org.mule.api.processor.LoggerMessageProcessor: -
-Result--{subj=science, marks=75, name=Pavan, id=3}
• INFO 2015-10-03 17:50:53,053 [[Database Component].connector.http.mule.default.receiver.02] org.mule.api.processor.LoggerMessageProcessor: -
-In foreach loop
• INFO 2015-10-03 17:50:53,056 [[Database Component].connector.http.mule.default.receiver.02] org.mule.api.processor.LoggerMessageProcessor: -
-Result--{subj=social, marks=45, name=Siva, id=4}
• Flow of execution:
1. URL to trigger the service from browser
http://localhost:8087/foreach
2. Database component connects to the specific
database, executes the select query and prints
the result (one by one) using for each
component
References
• https://docs.mulesoft.com/mule-user-
guide/v/3.7/foreach

Contenu connexe

Tendances

Kubernetes: Wie Chefkoch.de mit Containern arbeitet
Kubernetes: Wie Chefkoch.de mit Containern arbeitetKubernetes: Wie Chefkoch.de mit Containern arbeitet
Kubernetes: Wie Chefkoch.de mit Containern arbeitetPer Bernhardt
 
UniProt REST API
UniProt REST APIUniProt REST API
UniProt REST APIEric Jain
 
Compress and decompress
Compress and decompressCompress and decompress
Compress and decompressSon Nguyen
 
#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...탑크리에듀(구로디지털단지역3번출구 2분거리)
 
Running PHP on a Java container
Running PHP on a Java containerRunning PHP on a Java container
Running PHP on a Java containernetinhoteixeira
 
Spring Boot Actuator
Spring Boot ActuatorSpring Boot Actuator
Spring Boot ActuatorRowell Belen
 
Mule with spring security manager
Mule with spring security managerMule with spring security manager
Mule with spring security managerSon Nguyen
 
Solbase & Real-time Activity
Solbase & Real-time ActivitySolbase & Real-time Activity
Solbase & Real-time ActivityRon White
 
Deploy Rails Application by Capistrano
Deploy Rails Application by CapistranoDeploy Rails Application by Capistrano
Deploy Rails Application by CapistranoTasawr Interactive
 
Edge Side Include Injection: Abusing Caching Servers into SSRF and Transparen...
Edge Side Include Injection: Abusing Caching Servers into SSRF and Transparen...Edge Side Include Injection: Abusing Caching Servers into SSRF and Transparen...
Edge Side Include Injection: Abusing Caching Servers into SSRF and Transparen...Priyanka Aash
 

Tendances (10)

Kubernetes: Wie Chefkoch.de mit Containern arbeitet
Kubernetes: Wie Chefkoch.de mit Containern arbeitetKubernetes: Wie Chefkoch.de mit Containern arbeitet
Kubernetes: Wie Chefkoch.de mit Containern arbeitet
 
UniProt REST API
UniProt REST APIUniProt REST API
UniProt REST API
 
Compress and decompress
Compress and decompressCompress and decompress
Compress and decompress
 
#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
 
Running PHP on a Java container
Running PHP on a Java containerRunning PHP on a Java container
Running PHP on a Java container
 
Spring Boot Actuator
Spring Boot ActuatorSpring Boot Actuator
Spring Boot Actuator
 
Mule with spring security manager
Mule with spring security managerMule with spring security manager
Mule with spring security manager
 
Solbase & Real-time Activity
Solbase & Real-time ActivitySolbase & Real-time Activity
Solbase & Real-time Activity
 
Deploy Rails Application by Capistrano
Deploy Rails Application by CapistranoDeploy Rails Application by Capistrano
Deploy Rails Application by Capistrano
 
Edge Side Include Injection: Abusing Caching Servers into SSRF and Transparen...
Edge Side Include Injection: Abusing Caching Servers into SSRF and Transparen...Edge Side Include Injection: Abusing Caching Servers into SSRF and Transparen...
Edge Side Include Injection: Abusing Caching Servers into SSRF and Transparen...
 

En vedette

How to use data mapper transformer
How to use data mapper transformerHow to use data mapper transformer
How to use data mapper transformermaheshtheapex
 
LED reflektor 70W teplá bílá
LED reflektor 70W teplá bíláLED reflektor 70W teplá bílá
LED reflektor 70W teplá bíláRoel Adriaan Ramp
 
ерөнхий мэдлэгийн тест 11-р анги
ерөнхий мэдлэгийн тест 11-р ангиерөнхий мэдлэгийн тест 11-р анги
ерөнхий мэдлэгийн тест 11-р ангиGanbat Narantsetseg
 
I parassiti intestinali del cane
I parassiti intestinali del caneI parassiti intestinali del cane
I parassiti intestinali del caneClinicaBorgarello
 
shaikh aleem ahmed
shaikh aleem ahmedshaikh aleem ahmed
shaikh aleem ahmedindianwhc
 
Concept symposia 2017
Concept symposia 2017Concept symposia 2017
Concept symposia 2017DIB ULIM
 
BREAK - Basic Real Estate - A Knowledge
BREAK - Basic Real Estate - A KnowledgeBREAK - Basic Real Estate - A Knowledge
BREAK - Basic Real Estate - A KnowledgeChristopher Balbuena
 
Naslednost i variranje osobina kod ljudi i nasledne bolesti čoveka
Naslednost i variranje osobina kod ljudi i nasledne bolesti čovekaNaslednost i variranje osobina kod ljudi i nasledne bolesti čoveka
Naslednost i variranje osobina kod ljudi i nasledne bolesti čovekaAdisboss
 
утицај средине на изазивање наследних промена
утицај средине на изазивање наследних променаутицај средине на изазивање наследних промена
утицај средине на изазивање наследних променаAdisboss
 
С.ЭНХТУЯА - ХЭРЭГЛЭГЧТЭЙ ХАРИЛЦАХ УДИРДЛАГЫН СИСТЕМ
С.ЭНХТУЯА - ХЭРЭГЛЭГЧТЭЙ ХАРИЛЦАХ УДИРДЛАГЫН СИСТЕМС.ЭНХТУЯА - ХЭРЭГЛЭГЧТЭЙ ХАРИЛЦАХ УДИРДЛАГЫН СИСТЕМ
С.ЭНХТУЯА - ХЭРЭГЛЭГЧТЭЙ ХАРИЛЦАХ УДИРДЛАГЫН СИСТЕМbatnasanb
 
8 Arts and Entertaiment
8 Arts and Entertaiment8 Arts and Entertaiment
8 Arts and EntertaimentMartina Baca
 

En vedette (13)

LOGAN
LOGANLOGAN
LOGAN
 
How to use data mapper transformer
How to use data mapper transformerHow to use data mapper transformer
How to use data mapper transformer
 
LED reflektor 70W teplá bílá
LED reflektor 70W teplá bíláLED reflektor 70W teplá bílá
LED reflektor 70W teplá bílá
 
ерөнхий мэдлэгийн тест 11-р анги
ерөнхий мэдлэгийн тест 11-р ангиерөнхий мэдлэгийн тест 11-р анги
ерөнхий мэдлэгийн тест 11-р анги
 
I parassiti intestinali del cane
I parassiti intestinali del caneI parassiti intestinali del cane
I parassiti intestinali del cane
 
shaikh aleem ahmed
shaikh aleem ahmedshaikh aleem ahmed
shaikh aleem ahmed
 
Ravi_Nelluri_QA
Ravi_Nelluri_QARavi_Nelluri_QA
Ravi_Nelluri_QA
 
Concept symposia 2017
Concept symposia 2017Concept symposia 2017
Concept symposia 2017
 
BREAK - Basic Real Estate - A Knowledge
BREAK - Basic Real Estate - A KnowledgeBREAK - Basic Real Estate - A Knowledge
BREAK - Basic Real Estate - A Knowledge
 
Naslednost i variranje osobina kod ljudi i nasledne bolesti čoveka
Naslednost i variranje osobina kod ljudi i nasledne bolesti čovekaNaslednost i variranje osobina kod ljudi i nasledne bolesti čoveka
Naslednost i variranje osobina kod ljudi i nasledne bolesti čoveka
 
утицај средине на изазивање наследних промена
утицај средине на изазивање наследних променаутицај средине на изазивање наследних промена
утицај средине на изазивање наследних промена
 
С.ЭНХТУЯА - ХЭРЭГЛЭГЧТЭЙ ХАРИЛЦАХ УДИРДЛАГЫН СИСТЕМ
С.ЭНХТУЯА - ХЭРЭГЛЭГЧТЭЙ ХАРИЛЦАХ УДИРДЛАГЫН СИСТЕМС.ЭНХТУЯА - ХЭРЭГЛЭГЧТЭЙ ХАРИЛЦАХ УДИРДЛАГЫН СИСТЕМ
С.ЭНХТУЯА - ХЭРЭГЛЭГЧТЭЙ ХАРИЛЦАХ УДИРДЛАГЫН СИСТЕМ
 
8 Arts and Entertaiment
8 Arts and Entertaiment8 Arts and Entertaiment
8 Arts and Entertaiment
 

Similaire à Use For Each Loop Iterate Database Records

For each component
For each component For each component
For each component F K
 
For each component in mule
For each component in muleFor each component in mule
For each component in mulejaveed_mhd
 
For each component in mule demo
For each component in mule demoFor each component in mule demo
For each component in mule demoSudha Ch
 
How to use choice component
How to use choice componentHow to use choice component
How to use choice componentmaheshtheapex
 
Mule-choice component
Mule-choice componentMule-choice component
Mule-choice componentDivyaSree1391
 
Choice component
Choice component Choice component
Choice component F K
 
Choice component in mule
Choice component in muleChoice component in mule
Choice component in mulejaveed_mhd
 
How to use database component using stored procedure call
How to use database component using stored procedure callHow to use database component using stored procedure call
How to use database component using stored procedure callprathyusha vadla
 
Howtouseforeachcomponent
HowtouseforeachcomponentHowtouseforeachcomponent
Howtouseforeachcomponentakshay yeluru
 
How to use message properties component
How to use message properties componentHow to use message properties component
How to use message properties componentmaheshtheapex
 
Message properties component
Message properties component Message properties component
Message properties component Sunil Komarapu
 
Message properties component
Message properties componentMessage properties component
Message properties componentF K
 
Message properties component in mule
Message properties component in muleMessage properties component in mule
Message properties component in mulejaveed_mhd
 

Similaire à Use For Each Loop Iterate Database Records (20)

For each component
For each component For each component
For each component
 
For each component
For each component For each component
For each component
 
For each component in mule
For each component in muleFor each component in mule
For each component in mule
 
For each component
For each component For each component
For each component
 
For each component in mule demo
For each component in mule demoFor each component in mule demo
For each component in mule demo
 
How to use choice component
How to use choice componentHow to use choice component
How to use choice component
 
Mule-choice component
Mule-choice componentMule-choice component
Mule-choice component
 
Choice component
Choice component Choice component
Choice component
 
Mule Choice component
Mule Choice component Mule Choice component
Mule Choice component
 
Choice component
Choice component Choice component
Choice component
 
Choice component in mule
Choice component in muleChoice component in mule
Choice component in mule
 
How to use message enricher
How to use message enricherHow to use message enricher
How to use message enricher
 
How to use database component using stored procedure call
How to use database component using stored procedure callHow to use database component using stored procedure call
How to use database component using stored procedure call
 
Mule Message Properties Component
Mule Message Properties ComponentMule Message Properties Component
Mule Message Properties Component
 
Howtouseforeachcomponent
HowtouseforeachcomponentHowtouseforeachcomponent
Howtouseforeachcomponent
 
How to use message properties component
How to use message properties componentHow to use message properties component
How to use message properties component
 
Collection aggregator
Collection aggregatorCollection aggregator
Collection aggregator
 
Message properties component
Message properties component Message properties component
Message properties component
 
Message properties component
Message properties componentMessage properties component
Message properties component
 
Message properties component in mule
Message properties component in muleMessage properties component in mule
Message properties component in mule
 

Dernier

Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 

Dernier (20)

Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 

Use For Each Loop Iterate Database Records

  • 1. How to use For Each Component 28-09-2014
  • 2. Abstract • The main motto of this PPT is how to use For Each component in our applications.
  • 3. Introduction • The Foreach scope splits a collection into elements and processes them iteratively through the processors embedded in the scope, then returns the original message to the flow.
  • 5. • .mflow<?xml version="1.0" encoding="UTF-8"?> • <mule xmlns:jdbc-ee="http://www.mulesoft.org/schema/mule/ee/jdbc" 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 • http://www.mulesoft.org/schema/mule/ee/jdbc http://www.mulesoft.org/schema/mule/ee/jdbc/current/mule-jdbc-ee.xsd"> • <jdbc-ee:mssql-data-source name="MS_SQL_Data_Source" user=“****" password=“****" url="jdbc:sqlserver://localhost;databaseName=test1" transactionIsolation="UNSPECIFIED" doc:name="MS SQL Data Source"/> • <jdbc-ee:connector name="Database" dataSource-ref="MS_SQL_Data_Source" validateConnections="true" queryTimeout="-1" pollingFrequency="0" doc:name="Database"/> • <flow name="Database_ComponentFlow1" doc:name="Database_ComponentFlow1"> • <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8087" path="database" doc:name="HTTP"/> • <logger message="--main flow--" level="INFO" doc:name="Logger"/> • <jdbc-ee:outbound-endpoint exchange-pattern="request-response" queryKey="select" queryTimeout="-1" connector- ref="Database" doc:name="Database"> • <jdbc-ee:query key="select" value="select * from mytable"/> • </jdbc-ee:outbound-endpoint> • <foreach collection="#[payload]" doc:name="For Each"> • <logger message="--In foreach loop" level="INFO" doc:name="Logger"/> • <logger message="--Result--#[payload]" level="INFO" doc:name="Logger"/> • </foreach> • </flow> • </mule>
  • 6. • Output:INFO 2015-10-03 17:50:45,299 [main] org.mule.DefaultMuleContext: • ********************************************************************** • * Application: Database Component * • * OS encoding: Cp1252, Mule encoding: UTF-8 * • * * • * Agents Running: * • * Clustering Agent * • * JMX Agent * • ********************************************************************** • INFO 2015-10-03 17:50:45,300 [main] org.mule.module.launcher.MuleDeploymentService: • ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ • + Started app 'Database Component' + • ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ • INFO 2015-10-03 17:50:52,770 [[Database Component].connector.http.mule.default.receiver.02] org.mule.api.processor.LoggerMessageProcessor: - -main flow-- • INFO 2015-10-03 17:50:52,778 [[Database Component].connector.http.mule.default.receiver.02] org.mule.lifecycle.AbstractLifecycleManager: Initialising: 'Database.dispatcher.424429501'. Object is: EEJdbcMessageDispatcher • INFO 2015-10-03 17:50:52,779 [[Database Component].connector.http.mule.default.receiver.02] org.mule.lifecycle.AbstractLifecycleManager: Starting: 'Database.dispatcher.424429501'. Object is: EEJdbcMessageDispatcher • INFO 2015-10-03 17:50:53,042 [[Database Component].connector.http.mule.default.receiver.02] org.mule.api.processor.LoggerMessageProcessor: - -In foreach loop • INFO 2015-10-03 17:50:53,046 [[Database Component].connector.http.mule.default.receiver.02] org.mule.api.processor.LoggerMessageProcessor: - -Result--{subj=Hindi, marks=55, name=Ramesh, id=1} • INFO 2015-10-03 17:50:53,047 [[Database Component].connector.http.mule.default.receiver.02] org.mule.api.processor.LoggerMessageProcessor: - -In foreach loop • INFO 2015-10-03 17:50:53,049 [[Database Component].connector.http.mule.default.receiver.02] org.mule.api.processor.LoggerMessageProcessor: - -Result--{subj=English, marks=65, name=Mahesh, id=2} • INFO 2015-10-03 17:50:53,050 [[Database Component].connector.http.mule.default.receiver.02] org.mule.api.processor.LoggerMessageProcessor: - -In foreach loop • INFO 2015-10-03 17:50:53,052 [[Database Component].connector.http.mule.default.receiver.02] org.mule.api.processor.LoggerMessageProcessor: - -Result--{subj=science, marks=75, name=Pavan, id=3} • INFO 2015-10-03 17:50:53,053 [[Database Component].connector.http.mule.default.receiver.02] org.mule.api.processor.LoggerMessageProcessor: - -In foreach loop • INFO 2015-10-03 17:50:53,056 [[Database Component].connector.http.mule.default.receiver.02] org.mule.api.processor.LoggerMessageProcessor: - -Result--{subj=social, marks=45, name=Siva, id=4}
  • 7. • Flow of execution: 1. URL to trigger the service from browser http://localhost:8087/foreach 2. Database component connects to the specific database, executes the select query and prints the result (one by one) using for each component