DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. Get Started With Mule ESB

Get Started With Mule ESB

Mule is an Enterprise Service bus which can easily integrate existing systems. This article will start you off with the basic building blocks of Mule and get you ready to integrate.

SATHYARAJ REDDY user avatar by
SATHYARAJ REDDY
·
May. 24, 16 · Tutorial
Like (3)
Save
Tweet
Share
7.71K Views

Join the DZone community and get the full member experience.

Join For Free

What Is Mule ESB?

It's an Enterprise Service bus which can easily integrate existing systems, regardless of technology, service creation, or host reusable service. Mule ESB can be used to exchange data in various formats like REST, SOAP, etc.

Mule Building Blocks

Mule message processor: After Mule receives a message from a Message Source, it uses one or more message processors to process the message through a flow. 

Components: Components are highly flexible tools to perform any business logic using Java or any of a number of scripting languages.

MEL: MEL is a lightweight, Mule-specific expression language that you can use to access and evaluate the data in the payload, properties and variables of a Mule message. Accessible and usable from within virtually every message processor in Mule, MEL enables you to quickly and elegantly filter, route, or otherwise act upon the different parts of the Mule message object.

For example:

<logger message="The value in my first variable is #[flowVars.myVar1]" level="INFO"/>

Mule Message  

The Mule message is the data that passes through an application via one or more flows. It consists of two main parts:

  • The message header, which contains metadata about the message.
  • The message payload, which contains your business-specific data. 

message_object    







Connectors 

Anypoint Connectors receive or send messages between Mule and one or more external sources, such as files, databases, or Web services. Connectors can act as message sources by working as inbound endpoints, they can act as a message processor that performs an operation in the middle of a flow, or they can fall at the end of a flow and act as the recipient of the final payload data. 

Example: ActiveMQ connectors, Salesforce Connectors, JDBC connectors

Endpoints

Endpoints are used to connect flows. An endpoint is a specific channel on which a flow can send messages and from which another flow or external service can receive messages. For example, a purchasing component may receive an order request over HTTP. Once the order has been processed by the component, a JMS message may be sent over a topic to notify an auditing system, and a response can be sent back over HTTP.

Example : HTTP Endpoint, JMS Endpoint

Filters 

Filters determine whether or not a message processor should process an incoming event or message. You can use the On Unaccepted property to optionally specify the name of the message processor that should handle any unaccepted events. Check the Throw On Unaccepted box to throw an exception if a message or event is not handled. The default when not checked is to not throw an exception.

Example: Logic filters apply the And/Or/Not logic to one or more nested filters that they enclose. When you use these logic filters, you add nested filters to them from within the And/Or/Not-filter nested pane.

and_filter











Routers

Routers (Flow Controls in Anypoint Studio) route messages to various destinations in a Mule flow. Some routers incorporate logic to analyze and possibly transform messages before routing takes place. For example, various flow controls can:

  • Split a message into several segments, then route each segment to a different building block.
  • Combine several messages into a single message before sending it to the next building block in the flow.
  • Reorder a list of messages before sending it to the next building block.
  • Evaluate a message to determine which of several possible building blocks it should be routed to next.
  • Broadcast the same message to multiple building blocks

Example: Choice Routers

<choice>
  <when expression="payload=='foo'" evaluator="groovy">
    <append-string-transformer message=" Hello foo" />
  </when>
  <when expression="payload=='bar'" evaluator="groovy">
    <append-string-transformer message=" Hello bar" />
  </when>
  <otherwise>
    <append-string-transformer message=" Hello ?" />
  </otherwise>
</choice>

Error Handling

Mule ESB provides numerous options for handling errors. Faults that occur within Mule are referred to as exceptions; when an activity in your Mule instance fails, Mule throws an exception. To manage these exceptions, Mule allows you to configure exception strategies.

Mule’s default exception strategy — which implicitly applies to all Mule applications — manages errors (i.e. thrown exceptions) in Mule flows. When your flows require more sophisticated error management, you can implement one or more exception strategies to construct precise, efficient protocols for handling errors.

From a high-level perspective, errors that occur in Mule fall into one of two categories: System Exceptions, and Messaging Exceptions.

Example: Default Exception Strategy - Defined and implicitly applied by default to handle all messaging exceptions that are thrown in Mule applications.





   



Enterprise service bus Flow (web browser)

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Top 5 PHP REST API Frameworks
  • RabbitMQ vs. Memphis.dev
  • TDD: From Katas to Production Code
  • Implementing Adaptive Concurrency Limits

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: