Contact Free trial Login

Orchestration Using Mule

Orchestration is how Mule facilitates the process of moving data through a Mule implementation based on flows. Orchestration can be seen as combining service calls to create higher-level, more useful composite services, and implies implementing business-level processes combining business-specific services across applications and information systems.

Orchestration and Flows

Orchestration involves decoupling point-to-point integration in favor of chains of operations that can be reused or changed as systems or business needs change. It involves moving beyond patterns into a service-based framework, where you wrap multiple components with sources to decouple them from protocols and routing requirements. This enables multiple services to work as one when implementation requirements demand it. Some common use cases that flows easily orchestrate include:

  • Simple integration

  • Scheduling data processing

  • Connecting cloud and on-premise applications

  • Event processing, where multiple services must be composed and must operate simultaneously

How Flows Enable the Implementation of Orchestration

Flows enable new ways to orchestrate service mediation. For example, you can combine an arbitrary number of sources, routers, and components that work together to achieve implementation requirements. Flows enable you to orchestrate new forms of data movement based on flow-specific routers. Orchestration enables you to create and reuse flows and component chains, chain together multiple components in one flow, and integrate sources or connectors anywhere in a flow.

When to Use Orchestration

Use orchestration when you need to combine existing services to meet business requirements. For example, you might use orchestration when you’re adding a new employee who needs to be entered in both the payroll system and HR system. You might also use orchestration for order processing. In this scenario, you can use orchestration to accept an order, make sure the order is in the inventory system., use a credit check system to ensure that you trust the customer’s credit, and enter the order into billing and shipping systems.

An Example of Orchestration

The following example of orchestration uses a flow to do the following:

  1. Transform the file’s contents into a standard format that contains one or more specific orders.

  2. Split out the orders for separate processing and filter out non-book orders.

  3. Call two services: one to check whether the book is in the inventory, and the other to create a customer order.

  4. Email the order to the customer and store it in a database.

If any step in this process fails, a message is placed in a JMS queue of failed orders. You can view, fix, and resubmit the affected orders.

<flow name="orderHandling">
  <file:listener directory="/myDirectory">
    <file:matcher filenamePattern="*.xml"/>
      <ee:set-payload resource="createBookOrdersTransformation.dwl"/>
  <foreach collection="#[payload.orders filterObject ((value, key, index) -> value.type == 'books')]">
      <http:request method="POST" path="/book/inventory"/>
      <http:request method="POST" path="/book/order"/>
      <email:send toAddresses="#[]">
        <email:body >
          <email:content ><![CDATA[#['Your order has been placed.']]]></email:content>
        <db:sql >INSERT INTO ORDERS(CUSTOMER, AMOUNT) VALUES (:id, :amount)</db:sql>
        <db:input-parameters><![CDATA[#[{ id :, amount: }]]]></db:input-parameters>
  <error-handler >
      <jms:publish destination="failedOrders"/>

Was this article helpful?

πŸ’™ Thanks for your feedback!

Edit on GitHub