Thinking in Transformations
A transformation is easier to understand when you can account for every value it produces.
Learn the transformation language one step at a time: values and functions, collections and reports, then formats, dates and a tested order pipeline. Twenty-four chapters build from Hello World to a complete transformation, with advanced workshops in four appendices.
Download as an EPUB 29 chapters — read offline on any e-reader
A transformation is easier to understand when you can account for every value it produces.
Start with a script whose entire result you can see before running it.
The order header in chapter 1 was fixed in the source.
An order line gives us a price and a quantity.
The order service offers free delivery at a stated threshold.
The same multiplication now appears in several results.
So far, each input has been one record.
We can calculate an amount for every line.
The report now contains lines from two orders.
A report can preserve each order with its own lines, or flatten all the lines into one list.
So far, we have named output fields directly.
The category report needs a total for each group of lines.
An order knows which SKU was bought; the catalogue knows its current display name.
A sum gives us the final order amount.
A helper used by several transformations needs a clear input contract.
The line-total calculation is now useful in an order summary, a category report and an enriched report.
A supplier label, a field name and a product code all arrive as strings, but each needs a different operation.
The body builds model values.
A CSV reader gives us an array of row objects, so the mapping techniques are familiar.
The order now arrives as XML.
The basic XML order is working.
A date-shaped string is still a string.
A date identifies a calendar day.
The shipping partner sends a namespaced XML batch.
The report works on a small batch.
Use this reference when a lesson needs another input binding, a module path or a command-line run.
Read this workshop after the collection chapters.
These independent workshops apply the reader/writer model to Java, fixed-width records, Excel and multipart, then place checks around a Mule flow.
This reference collects the detailed conversion, selection, scope and library investigations that are useful once you can follow the main examples.