2. In the Basic Studio Tutorial, you got to know
Anypoint Studio and built a simple "Hello, World"
application.
This tutorial walks you through how to use
Anypoint Studio to build a slightly more complex
"Hello, World" application that routes messages
according to their content. After creating and
running the example in this tutorial locally, you
should be able to apply what you have learned to
create more complex applications.
3. Assumptions :
This tutorial assumes that you have downloaded
and installed Anypoint Studio.
If you do not have any previous experience with
Eclipse or an Eclipse-based IDE, please review
the brief introduction to the Anypoint Studio
interface or complete the Basic Studio Tutorial.
4. Goals :
In this tutorial, your goals are to:
1. Create an application in Anypoint Studio that routes
messages according to the logic you supply in a Choice
Router.
2. Set and invoke flow variables using Mule Expression
Language.
3. Run the application on a local runtime embedded in
Anypoint Studio.
4. Test the application using a browser.
5. Adjust the application while it is running, effectively invoking
a "hot deployment."
6. Edit the application to move some processing into a Subflow.
7. (Optional) Apply your knowledge to an extra credit
challenge.
5. Modeling a Flow with Choice Routing :
Launch Anypoint Studio and create a new Mule Project
named CBR Tutorial. If you need more directions on
launching Studio and creating a project, refer to the Basic
Studio Tutorial.
Next, use the building blocks in the Studio palette to model
an application that:
1. Receives an HTTP request
2. Filters out any "favicon.ico" browser requests
3. Transforms an inbound property into a flow variable
4. Routes the message according to the flow variable
associated with the message
5. Sets a new payload based on the routing logic
6. Supplies that payload as an HTTP response
7. Logs a summary of the results to the console
6. You can model this application using
these building blocks in Studio :
HTTP Connector
Expression Filter
Variable Transformer
Choice Router
Set Payload Transformer
Logger
7. HTTP Connector : Expression Filter :
Allows your Mule
application to connect to
Web resources through
the HTTP or HTTPS
protocol. Find this in the
Connectors section of
the palette.
Filters messages
according to a Mule
expression. Find this
message processor in
the Filters section of the
palette.
8. Variable Transformer : Choice Router :
Sets a flow variable on
the message that can
be invoked elsewhere in
the flow. Find this
message processor in
the Transformers
section of the palette.
Routes incoming
messages according to
configured logic. Find
this in the Flow Controls
section of the palette.
9. Set Payload Transformer : Logger :
Modifies your payload
into a different
message, depending on
the results of the choice
routing. Find this in the
Transformers section of
the palette.
Logs messages or
activity based on the
value of a Mule
expression. Find this in
the Components section
of the palette.
10. Drag and drop these building blocks into place
on the canvas to visually construct, or model, a
flow, as shown.