Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

Messaging makes its move, Part 1

Learn how to build your own Java-based messaging service

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone
Building enterprise applications around distributed architectures may solve some problems, but it introduces others. Consider for a moment a few of the ways in which communication can fail between components in a distributed application: a component can voluntarily, but unexpectedly, go offline; a component can unexpectedly terminate; a component can fail to respond to a request in a reasonable amount of time; or communication can be severed in the midst of a request. Given enough time, you could make this into a very long list!

I'm not advocating we turn away from distributed architectures, of course. None of the problems I mentioned above are insurmountable. Rather, I'm highlighting the need for a class of products that addresses the issues I raised above, preferably without burdening the application components with too many of the supporting details.

Messaging provides one possible solution to these problems. Messaging products allow distributed application components to communicate and coordinate their activity (via messages) by providing critical services such as message queuing, guaranteed once-and-only-once delivery, priority delivery, and transaction support.

In this column and the next, I will take you inside a messaging service and show you how it's put together. In the process, I'll highlight the Java Message Service (JMS) API, Sun's standard Java interface to messaging services, and teach you how to use it.

Roadmap

This column is the first in a series of two articles on the subject of messaging. In this column, I'll introduce the subject, discuss the JMS API, and show you how to build the underlying functionality. In next month's column, I'll show you how to add a JMS API specification-compliant interface. I don't plan on implementing the entire JMS API (writing a robust messaging service is far from trivial), but I do intend to provide you with a complete and fully functional subset of the API.

If you've never looked closely at messaging services before, you might want to begin by reading a brief introduction to them before plunging headlong into the code. I recommend my coverage of the JMS API specification (JavaWorld, January 1999).

Building a Java-based implementation of the JMS API

The JMS API specification defines the Java language interface to a messaging service. All current implementations of the JMS API wrap existing messaging products. There are at least two reasons for this:

  1. It's easier to write a new interface to an existing product than to create a product from scratch.

  2. Most potential customers are looking for products that will facilitate Java's integration into an existing enterprise application using an existing messaging service.


The result is a heavyweight implementation of the JMS API -- heavyweight because the implementation requires the support of an external, native messaging product.

It turns out that there are some practical reasons why one might want to provide a Java-based implementation of the JMS API. First, the implementation would be lightweight -- It wouldn't depend on external, non-Java resources. Second, it would provide true platform independence thus more fully realizing Java's write-once, run-anywhere promise.

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone
Comment
Login
Forgot your account info?
Add comment
Anonymous comments subject to approval. Register here for member benefits.
Have a JavaWorld account? Log in here. Register now for a free account.
Resources
  • Java Message Service home page http://www.javasoft.com/products/jms/
  • JMS Specification http://www.javasoft.com/products/jms/docs.html
  • Michael Shoffner's article on message-oriented middleware (MOMs) http://www.javaworld.com/javaworld/jw-05-1998/jw-05-step.html
  • Read Todd's previous How-To Java columns http://www.javaworld.com/topicalindex/jw-ti-howto.html