Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Implementing an Enterprise Service Bus in Java : Page 4

Using the open source Mule project, you can build a highly customized Enterprise Service Bus (ESB) that meets your specific needs.


advertisement
Implementation of the ESB
Using the interfaces designed and discussed above, you can construct an implementation for a simple ESB. The rest of this article describes the classes required for a simple HTTP-based ESB. Building it involves using a servlet as the ESB implementation class.
 
Figure 4. Control Flow: The diagram shows how control flows from an HTTP-based client to the ESB servlet and back.
Figure 4 shows how control flows from an HTTP-based client to the ESB servlet and back.

As illustrated in Figure 4:

  1. A browser transmits an HTTP request to the ESB servlet.
  2. The ESB servlet dispatches the message contained in the request to the runtime engine.
  3. The runtime engine hands the message off to the mediator.
  4. The mediator performs any necessary augmentation, transformation, and security on the message.
  5. The mediator routes the message to the destination belonging to a ServiceProvider (in this case, an instance of the MuleEchoMessageService class).
If all goes well, the ESB propagates a success value back up the chain and a passes a success response back to the client.

Here are the primary classes for the HTTP-based ESB, along with links to listings showing the source code. You can download the source to the sample project to experiment with it on your machine.

  • HTTPESB—Encapsulates the data and behavior for an HTTP request/response service bus. HTTPESB contains a RuntimeEngine instance that interacts between service requesters and service providers (see Listing 1).
  • SimpleRuntimeEngine—Encapsulates the data and behavior of the ESB and uses mediators to transform, augment, and secure messages and to route service interactions between service requesters and service providers (see Listing 2).
  • MuleMessageManagerFactory—Creates/returns an instance of MuleMessageManager (see Listing 3).
  • MuleMediator—Encapsulates the data and behavior for a Mule-based mediator (see Listing 4).
  • MuleMessageClient—Encapsulates the data and behavior for a Mule-based message transmitter and service registry (see Listing 5).
  • MuleEchoMessageService—Encapsulates the data and behavior for a Mule UMO that simply holds and echoes a message (see Listing 6).
Installing and Deploying the ESB Web Application
To deploy an ESB Web application you must download and install a J2SE Development Kit (JDK), version 1.4 or greater, from Sun, download the latest version of Mule, download and install a servlet container, and create the necessary files and directories for the Web application. The following sections explain these steps.


Downloading and Installing a JDK
The following steps will walk you through downloading and installing a JDK:

  1. Download a version 1.4 or greater of the JDK from http://java.sun.com/j2se/.
  2. Unpack the downloaded archives to the directories of your choosing.
Downloading and Installing Mule
Follow these steps will to download and install Mule:

  1. Download the latest version of the full Mule distribution and the Mini-Mule distribution from http://mule.codehaus.org/Download.
  2. Unpack the downloaded archives and/or install the JDK to the directories of your choosing.
Downloading and Installing the Tomcat Servlet Container
To download and install a servlet container:
  1. Download a version 5.x or greater of the Tomcat servlet container from http://jakarta.apache.org/tomcat/index.html.
  2. Unpack the downloaded archives and/or install Tomcat to the directories of your choosing.


Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap