Scatter Gather Flow Control icon

Scatter Gather Flow Control

(0 reviews)

home

Learn how to use scatter-gather flow control to send a message to multiple processors in parallel.


Screenshot of the main flow in Anypoint Studio, view full image here

Description

This example shows us the usage of the scatter-gather flow control to send the same message to a logger and a gmail account in parallel.

Example Use Case

In this example a sample data in JSON format is received through an using the Java Object Transformer. Then the string representation of the JSON object is logged to the console and it is also sent to an email address using the SMTP connector. This example has been configured for gmail.

Set Up and Run this Example

  1. Open the project in the studio interface

  2. Navigate to src/main/app/scatter-gather.xml and edit Send an email via SMTP component as follows:

     # Basic settings
     Host: smtp.gmail.com
     Port: 587
     User: senderemailid%40gmail.com
     Password: senderpassword
    
     # Email information
     To: receiveremailid@gmail.com
     From: senderemailid@gmail.com
     Subject: Processing Finished Report
  3. Run the project as a Mule application

  4. Send a sample JSON data to your localhost server running your mule application.

     Sample JSON data: { "a": 3, "b": 4 }
  5. Login to receiveremailid@gmail.com to verify if the data was received via email. You could also verify the studio console to check if you received a message from the Logger Component as follows:

     INFO  2014-07-03 16:10:00,974 [[scatter-gather-master].ScatterGatherWorkManager.01] org.mule.api.processor.LoggerMessageProcessor: Processing finished: {a=3, b=4}

##Documentation
Read full documentation in GitHub

Examples to Try Next

If you understood this example
Importing Email Attachments using the POP3 Connector - Learn how to use the POP3 connector to transfer information via email.View
If you struggled with this example
HTTP Request Response with Logger - Learn how to use Mule to build a simple HTTP request-response application.View

Reviews

TypeExample
OrganizationMuleSoft
Published by
MuleSoft Organization
Published onJun 22, 2017
Asset overview

Asset versions for 1.3.x

Asset versions
VersionActions
1.3.3