Appendix D. A sample Mule application

This appendix presents an example of a Mule application. It demonstrates a legacy modernization use case faced by Prancing Donkey, and integration with a partner. Prancing Donkey has recently partnered with Balin’s Stuff, Inc., a provider of accessories to facilitate and enhance the consumption of beer.

In order to sell Balin’s products, Prancing Donkey must periodically pull an XML file from an FTP site. The XML file contains the inventory of Balin’s products and their associated prices, shipping information, and so on.

To facilitate this, Prancing Donkey has developed a Mule application that does the following:

  • Polls an FTP site periodically for product information
  • Splits and transforms each product XML element to an instance of Product, part of a JPA domain model
  • Persists each Product object to a relational database using the JPA connector
  • Exposes the Products with a RESTful API using JAX-RS
Figure D.1. The Mule application in Mule Studio

We’ll now show the Mule configuration for this application as well as the supporting FunctionalTestCase implementation. The application is available in its entirety via GitHub at https://github.com/ddossot/mule-in-action-2e.

D.1. The Mule application configuration

The Mule Studio screenshot of the Mule application is shown in figure D.1, and the annotated listing of the Mule application is shown in listing D.1.

Listing D.1. The Mule application configuration

D.2. ProductImportFunctionalTestCase

The following is the FunctionalTestCase implementation for the application.

Listing D.2. The ProductImportFunctionalTestCase implementation

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset