Lyndsey has posted 139 posts at DZone. View Full User Profile

Book Giveaway & Exclusive Chapter Download: Mule In Action

07.24.2009
| 12536 views |
  • submit to reddit

DZone and Manning Publications have partnered to bring you an exclusive chapter from 'Mule in Action' (by Dave Dossot and John D'Emic). This chapter covers the major transports the Mule Enterprise Service Bus (ESB) supports and provides working configurations of them in action. It covers specific transports, such as SOAP or email, and examines how you can use them to send and receive data.

Sending and Receiving Messages with Mule ESB

Can you remember the last trip you took? You probably used more than one means of transportation to get to where you were going. You may have taken a passenger jet somewhere first, then hopped in a taxi. Or you may have ridden a bike somewhere, locked it up, and then walked across the street. Perhaps you parachuted out of a plane, then drove home. In any case, you likely weren’t teleported from one place to another.

Transporting data isn’t much different than transporting people. While it would be nice if systems could magically move data between themselves, this isn’t often the case. One system might only support SOAP, while your system may only supports REST. Perhaps you need to get data from an FTP site into a database. Or maybe you need to receive JMS messages and save their payloads to a file.

We introduced Clood, Inc., at the end of the last chapter. In this chapter, and throughout the rest of this book, we’ll be using Clood’s integration activities as a reference point for some of our discussions and examples. Being a modern, cloud-based service provider, Clood is forced to integrate with a variety of disparate systems and services as part of its daily business. Clood also makes extensive internal use of open source technologies and tools. Let’s start off by considering an integration scenario recently faced by Clood.

Clood, Inc., uses Nagios, a popular open source monitoring tool, to perform URL monitoring of its customers’ cloud-hosted applications. When a URL check fails, Nagios sends an email to the Clood call center where subsequent action is taken. You’ve been tasked to store these alerts in a database so management can run reports on the data—with the stipulation that you can’t modify the Nagios installation. Since the reports will only be run once a day, you decide your best approach is to periodically download messages from the mail server, perform some analysis on them, and save the results into a relational database. Without using Mule, you might consider the following strategy:

  • Implement an IMAP client using the Java Mail API.
  • Schedule the client to download the messages at some interval.
  • Write code to parse the email message.
  • Use JDBC to insert the data into the database. 

This approach will work, but an awful amount of effort is spent “plumbing”—writing things such as IMAP clients, JDBC clients, and schedulers. Wouldn’t it be nice to worry about the business problem at hand—parsing the email data—and let Mule handle the details of moving the data around?

We’ll see in this chapter how Mule reduces this plumbing work to a few lines of XML. We’ll cover the major transports Mule supports and provide working configurations of them in action. In each section, we’ll discuss a specific transport, such as SOAP or email, and examine how you can use it to send and receive data.

As moving data around is such an important part of using Mule, expect to make heavy use of the techniques in this chapter. After all, you’ll need to get data into and out of Mule before you can do anything useful with it!

Click here to download the entire chapter


The above introductory excerpt was taken from Mule in Action, published in July 2009. It is being reproduced here by permission from Manning Publications. Manning early access books and ebooks are sold exclusively through Manning. Visit the book's page for more information.

 

AttachmentSize
MuleInAction_Chapter3.zip519.44 KB
book_contest_muleinaction.jpg23.91 KB
Published at DZone with permission of its author, Lyndsey Clevesy.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Andrew Perepelytsya replied on Fri, 2009/07/24 - 11:09am

Folks, please fix the link in Tweet this. The one you put in a tweet is then forwarding to an outlaw design blog. Bad bad joke.

Lyndsey Clevesy replied on Fri, 2009/07/24 - 12:20pm in response to: Andrew Perepelytsya

Sorry about that. It works now when you tweet it. Thanks so much for letting us know.

Eric Elzinga replied on Sat, 2009/07/25 - 7:01am

Great! looking forward to read the book. Doing a lot lately with the osb, time to get some knowledge on this opensource esb

 

-- http://eelzinga.wordpress.com

Christian Voller replied on Mon, 2009/07/27 - 2:00am

Free chapter was interesting to read - want more :-))!

Zaheer Paracha replied on Tue, 2009/07/28 - 4:42pm

Sounds interesting.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.