Login | Register   
LinkedIn
Google+
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 5

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


advertisement
Creating the HTTPESB Web Application
The HTTPESB demo Web application is composed of one HTML file, the HTTPESB servlet, and the ESB implementation classes.

Create the Web Application Directory Structure
  1. Create a directory in your servlet container's webapps directory named httpesb.
  2. Create a child directory of httpesb named WEB-INF.
  3. Create a child directory of WEB-INF named classes.
  4. Create a child directory of WEB-INF named lib.
Populate the Web Application Directory Structure
  1. Copy the Mule jar file and DTD file from the Mini-Mule dist directory to the WEB-INF/lib directory.
  2. Copy all the jar files from the Mini-Mule lib directory to the WEB-INF/lib directory.
  3. Compile all the Java files for the ESB to the WEB-INF/classes directory.
  4. Create a text file named web.xml in the "WEB-INF" directory and populate the file as shown in Listing 7.
  5. Create a text file named index.html in the httpesb directory and populate the file as shown below.

<html> <head> <title>HTTP ESB</title> </head> <body> <form ACTION="/httpesb/actions? ServiceRequesterID=http://localhost/httpesb& ServiceProviderID=MyServiceCo& <!&#151;NOTE: The following URI should be a single line. ServiceAddress=com.jeffhanson.businesstier.impl.mule. MuleEchoMessageService&ActionName=SendMessage" METHOD="POST" NAME="NewMessageForm"> <table> <tr><td> Message:<br/><textarea name="Message" cols=60 rows=10></textarea> </td></tr> <tr><td> <input type="submit" value="Send Message"> </td></tr> </table> </form> </body> </html>

Testing the ESB

Figure 5. Testing the ESB: After installing and configuring Mule and the sample application, when you run it, you'll see a page that looks like this.
 
Figure 6. A Successful Message: When you send a message successfully, you'll see a page similar to the one shown here.

After installing and configuring the application, to test it from your browser, type the following URL into the address field:

http://localhost:8080/httpesb

You'll see a page similar to Figure 5.

Type "Hello world!" into the message box and hit the "Send Message" button. You should now see a page similar to Figure 6.



If you now look at the console window for your application server, you should see more detailed messages—something similar to Figure 7.

 
Figure 7. Detailed Output: The sample application displays detailed messages in the console window.
To integrate old and new components and services using a service-oriented architecture requires an infrastructure that can connect any component or service, regardless of location, messaging protocol, and message format. An enterprise service bus fulfills these requirements with a centralized, scalable, fault-tolerant, service-messaging framework. An ESB provides a transparent means for communicating with heterogeneous services over a diverse set of message protocols.

Mule is an ESB messaging platform based on a staged event-driven architecture (SEDA). Mule can send and receive messages using asynchronous, synchronous, and request/response processing models. You can use Mule alone or as a simple messaging framework to build a robust, advanced enterprise service bus.



Jeff Hanson has more than 18 years of experience in the software industry. He has worked as senior engineer for the Windows OpenDoc port and as lead architect for the Route 66 framework at Novell. He is currently Chief Architect for eReinsure, which specializes in providing frameworks and platforms for J2EE-based reinsurance systems. Jeff has also authored numerous articles and books.
Comment and Contribute

 

 

 

 

 


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

 

 

Sitemap