mulesoft fundamentals esb online training part 1
TRANSCRIPT
ESB Training Online
Agenda Day 1
Key Concepts• Messages and Events• Mule Runtime• Flows• Mule Messages• Message Sources• Message Processors• DataSense• Mule Expression Language
Mule Message Structure• Messages Structure• Inbound properties• Outbound properties• Variables• Message Payload
Build a Mule Application • Build a Simple Project• Adding Loggers, Variables, Properties• Adding a Unit Test• Debugging Mule Application
Messages and Events
Messages and events
Mule applications accepts and process messages through a series of message processors plugged together in a flow.
A message can be initiated by an event like • A consumer request from a mobile device• A change to a data in database• The creation of a new customer ID in a SaaS application
Mule Runtime
A JVM Server that
Can handle many concurrent request for different Java (Mule) applications in a single JVM
Decouples point-to-point integrations by having all (non-Mule) applications talk to the bus (to a Mule runtime) instead directly to each other
Flows A typical flow has
• A Message Source• Message Processors
A Mule Application can consist of• A Single flow• Multiple flows• Multiple flows connected
together
Flows
Anypoint Studio
Creating Mule Application with Anypoint Studio
Anypoint Studio is an Eclipse-based integration development environment
Two-way editing between graphical and XML views Visual debugging Pre-built tooling to connect to
• Many popular services (Salesforce, Workday, Facebook, more!)• Many standard protocols (HTTP/HTTPS, FTP, File, SMTP, more!)• Any SOAP and RESTful API
Data transformation framework and language One click deployment of application Integration with maven for continous build process Embedded Mule Runtime
Anypoint Studio Anatomy
Walk Through DemoModule 01
Building a Mule Application
Message Sources
The first building block of the most flows is a receiver that receives new messages and places them into a queue for processing
Message Sources are usually Anypoint Connectors
Connectors provides connectivity to external resources• Such as databases, protocols, or APIs• Standard protocols like HTTP, FTP, SMTP, AMQP• Third-party APIs like Salesforce, twitter, or google
Message Processors
Connectors• Connects to an external
resources
Scopes• Wraps snippets of code to define
fine-grained behavior within a flow
Message Processors
Components• Executes specific logic upon a
message, including custom logic in java, JavaScript, Groovy, Python or Ruby
Transformers• Modify the values of part of a
message
Message Processors
Filters• Limit processing of messages
based on set criteria
Flow Controls• Direct messages through
different pathways in a application depending upon content or other criteria
Message Processors
Error Handling• Handle any errors that occur
during messge processing
Summary
Anypoint Studio can be used to build Mule applications for integrations
Mule applications accepts and process message through a series of message processors plugged together in a flow
Mule messages have inbound properties, outbound properties, a payload and attachments
Message processors include connectors, scope, components, transformers, filters, flow control, and error handling elements
DataSense is Anypoint Studio’s ability to proactively discover metadata from internal and external resources
DataSense
Add a Logger component to a flow and view its output in the Anypoint Studio console
Use the Anypoint Studio Visual Debugger
Use autocomplete when writing expressions in the Anypoint Studio Visual Editor
Other Ways to See Message Information
Use MEL to access and evaluate the data in the payload, properties, and variables of a Mule Message
MEL is a lightweight, Mule-specific expression language
Accessible and usable from within virtually every message processor in Mule
Easy to use with autocomplete
Mule Expression Language
#[]
Basic MEL Syntax
#[message]
#[message.payload]
Encapsulates all Mule Expressions
Holds a context object
Dot notation to access fields or methods
Mule Message
Mule Message
Set from the Message Source
Added by Message Processor
The core of the Message
Ancillary info to the Message
Properties
Inbound Properties
Set from Message Source Read-only access Persist throughout the flow
Reference in MEL as inboundProperties #[message.inboundProperties.foobar]
Outbound Properties
Added by Message Processor
Read/Write Access Can set, remove, copy
Reference in MEL as outboundProperties #[message.outboundProperties.foobar]
Inbound Properties
Outbound Properties
Variables
Flow Variables
Variables tied to themessage event as it moves through the flows
Reference in MEL as flowVars #[flowVars.foobar]
Session Variables
Also tied to the message event as it moves through flows, but they are persisted across some but not all transport barriers
Reference in MEL as sessionVars #[sessionVars.foobar]
Walk Through DemoModule 02
Adding Loggers, Variables, and Properties
Summary
Mule messages have and how they have inbound properties, outbound properties, a payload and attachments
The best way to view message data is to add breakpoints to a flow and use the Mule debugger
Use the set payload transformer to set the payload
Use the property transformer to set, remove, or copy message outbound properties
Use the logger component to display data in the console
Use the Mule Expression Language (MEL) to write expressions #[]
Use variable transformer to create flow variables