Chapter 1: Fundamental Mule 1 The Enterprise Service Bus 1 Mule Features .4 Enterprise vs. Community Edition .5 Anatomy of a Mule 6 Installing Mule as a Service (or Daemon) . 7 The Design-Time Container 8 Mule 2 Configuration File Structure . 8 Service Components 11 Configuring Service Components . 12 Endpoints . 13 Configuring Global Endpoints 16 Connectors . 17 Routers . 18 Transformers . 23 Complete Mule 2.0 Configuration File . 25 Summary 27 Chapter 2: Routers and Routing .29 Routing Patterns 29 Inbound Routing 30 The Response Routing Pattern 34 Inbound vs. Outbound . 35 Routing Options 38 Summary 47 ii Mule 2: A Developer’s Guide to ESB and Integration Platform Chapter 3: Modeling Applications .49 Real-World Scenario .49 Checking In . 50 Luggage Handling . 50 Airport Interaction . 51 Modeling the Solution . 51 Modeling Points 55 Implementing a Modeled Application . 56 Summary 56 Chapter 4: Creating a Mule Application .57 Core Tools and Components 57 Installing Mule 57 The Mule IDE 58 Creating Your Mule Application 59 Service Components 59 The Mule Configuration File . 61 Running Your Mule Application . 61 Installing Mule as a Service (or Daemon) . 62 Unit Tests .63 Testing Applications 63 Black Box Testing a Mule Server . 64 Creating a Test Case 65 Messages in Mule 67 Communicating with the Mule Server 70 Asserting Output 71 Testing Mule Using JUnit . 71 Summary 74 Mule 2: A Developer’s Guide to ESB and Integration Platform iii Chapter 5: Mule Transports .75 Transport Architecture .75 Connectors and Endpoints . 75 A Transport 76 The MessageReceiver Interface 77 The MessageDispatcher Interface . 77 Transport Overrides . 78 Service Descriptor File 78 Transports and Their Configuration 79 The Console Transport 79 The Virtual Machine (VM) Transport . 81 Processing Queues . 82 The File Transport . 83 The HTTP Transport . 87 The FTP Transport 90 The SMTP Transport . 92 The JMS Transport 95 The JDBC Transport . 100 Summary 103 Chapter 6: Web Services in Mule 105 Overview 105 Simple Object Access Protocol . 105 Mule and Web Services . 106 The CXF Transport .107 From XFire to CXF . 108 The CXF Connector 108 Attributes . 109 Hosting a CXF Web Service . 109 CXF Outbound Endpoint 113 iv Mule 2: A Developer’s Guide to ESB and Integration Platform The Axis Transport .114 Axis Connector Attributes . 115 Hosting an Axis Web Service . 116 Connecting to an Axis Web Service . 117 Invoking Non-Axis Web Services . 118 REST 120 Summary 121 Chapter 7: Extending Mule 123 Building a Transformer 123 Transforms: ESB or Service? 124 Introducing AbstractTransformer 124 Building a Filter 127 Overview . 128 Complex to Simple Filter 128 Creating a New Filter 130 Building a Router 131 Overview . 131 MuleEvent Methods 132 Inbound Routers 133 Outbound Routers 134 Extending a Router 135 An Idempotent Router . 135 Summary 137 Chapter 8: Resilient Mule Applications 139 Error Handling and Recovery 139 Mule’s Exception Strategy Classes . 140 Configuring Exception Strategies . 140 Flexible Exception Strategies 141 Mule 2: A Developer’s Guide to ESB and Integration Platform v Exception Strategies—Create Your Own . 144 Routing Patterns—Exception Router 144 Transactions in Mule 145 Single vs. XA Transactions . 146 The Transaction Manager 146 Transactional Endpoints 147 Poison Messages 149 Connection Strategies .150 Summary 150