Well it worked for Motorcycle Maintenance and Archery…
After the deal had been signed, requirements were drawn up, everybody went through training, and all the software had been download, the developers and architects new to Mule ESB often puzzle themselves with this question, “Ok, what do I do now?” With all the tools and options provided by our products, taking that proverbial first step toward go-live Nirvana can indeed come across as a daunting task for Mule implementation virgins. As the pseudo-scholar of Eastern Religions, a doctor of philosophy, as well as the most monkish employee at MuleSoft, I hope to illustrate how meditating on Zen principles can help get implementations started and bring good karma to successful project completions.
Garden of Stones
The stone gardens are the ultimate crystallization of Zen philosophies. In a stone garden, there are no sculptures, no statues, and no flowers. At the same time, the garden can represent different sceneries to different people. The most famous example is the karesansui (枯山水) garden at the Ryōan-ji (龍安寺) in Kyoto, Japan, where many visitors have claimed that the stones there depict tiger cubs swimming across a river.
Similarly, the choices presented by the palettes in Mule Studio are just like the stones in the garden. It is unlikely a standard message processor would be exactly the same as one of the steps required in your algorithm. What Studio provides out of the box though, are just like the stones in the garden. It is entirely up to you how you want to utilize them to suit your purpose. For example, Mule Studio will never have a “filter out zero amount order line” transformer when mapping an archetypal sales order with header and lines. However, using the tools already provided, e.g. DataMapper, the requirement can be easily implemented. In our example here, we are mapping a sales order from Handshake, a popular mobile order taking app, to QuickBooks Windows. The business use case calls for lines with zero amount not to be mapped. Using the DataMapper, this can easily be done by first mapping all the fields normally in the visual editor:
Then by switching to the Script Editor to enclose all the mapping for the line level into an “if” block, the desired filtering is archived.
The Logic of Reincarnation
Zen philosophy is a school of Buddhism, this it also accepts the concept of reincarnation. A good analogy for reincarnation in programming is recursive flow reference, which Mule fully supports but is not obvious from the Mule user interface. Many common use cases can be best solved with recursive flow reference. For example, many popular systems use name as unique record identifier, such as QuickBooks with customer name. When conflict occurs, the common business rule is to append an incremental number to the name to resolve duplication. Recursive flow offers the easiest option to find the right number.
In the above example, vm-endpoint is used. Recursion can also be implemented via flow-ref. An excellent example by our Support Engineer Alberto Aresca can be found here.
Zen philosophy adores symmetry. The philosophy puts a heavy emphasis on striking the right balance. For every Kinkaku-ji (金閣寺),there is a Ginkaku-ji (銀閣寺). There is a thread that ties the two together in eternity.
A mule is an asymmetric animal by nature, with a horse mother and a donkey father. Mule ESB leans toward asymmetry as well, with default one-way exchange pattern and implicit queued-asynchronous process strategy. From time to time though, a synchronous behaviour may be desired, for example, often exception handling should be processed by the same thread as the flow that encountered error. In these cases, either specific processing strategy to be synchronous for a flow or simply use a sub-flow. An example of how sub-flow is used for exception handling is shown below. In this scenario, the thread that is processing the flow will also process the error response.
I hope you find this blog post helpful to your Mule endeavors and it boosts your the zenergy to kick start your implementation. Thank you for reading and Peace Out.
Follow us on Twitter to get all the latest updates!