EDITING BOARD
RO
EN
×
▼ BROWSE ISSUES ▼
Issue 13

Book review: Java Message Service

Silviu Dumitrescu
Line manager@Telenav
OTHERS

Java Messaging Service and associated architectures are an alternative to traditional communication methods and associated architectures such as RPC and distributed systems. The level of trust, flexibility, extensibility and modularity of an application are much higher when using these architectures instead of the classic ways, previously mentioned.

Some of the advatages of useing Message Service are listed below:

  • Integrating heterogeneous platforms, for example ActiveMQ platforms and IBM WebSphere MQ, but also non-Java clients such as those developed in C and C + +
  • Hybrid architectures, which are a combination of centralized and decentralized architectures
  • Patterns of messages, point to point and publish-and-subscribe. This means that a message is addressed either to a single producer consumer or to a group of consumers

The development of messaging service had many milestones during the last 10 years. The emergence of new techniques and technologies such as Message Driven Bean (MDB), Spring messaging framework, Event Driven Architecture, Service-Oriented Architecture, RESTful JMS interfaces and Enterprise Service Bus (ESB) are just some of the important marks in this development.

The Message Service is managed by an API, now in version 1.1. This is actually the second version of the specifications, after the initial 1.0 version. Java Enterprise Platform, 7th version, which is close to being officially launched, brings a new version of JMS specifications: 2.0. Improvements are plentiful, most of them on the simplification of the code and adjustments to new technology developments (sending messages asynchronously, introducing factory, etc.)

The book which I submit for review this edition of TSM, Java Message Service, second edition, having Mark Richards, Richard Monson-Haefel and David A. Chappell as authors, represents a complete guide for using messages and architectures based on these messages.

Divided into 11 chapters, the book presents step by step aspects related to achieving performance when using Java Message Service.

If the first chapter approaches general aspects of messages, such as considerations and parallel with other architectures, in chapters two, three, four and five the authors present everything that a beginner should know about this architecture. The structure of a message consists of three major parts: headers, properties and types of messages. Then, using point-to-point and publish-and-subscribe messaging are described with discussions on possible methods of implementation. Each of these chapters is fully illustrated with strong examples. From a classic chat application up to a loan and lenders application, all emphasize the theoretical aspects presented in the book.

Section 6 covers the message filtering aspect. Filtration of a queue or a topic in the message is made using message selectors. Message selectors apply to message consumers. Consumers will receive only those messages that meet the filter conditions. Selectors will use properties and message headers to test conditional expressions of filters. The chapter concludes with aspects regarding the design of applications that use filters.

The seventh chapter is divided into two related subparts, the first one is about how to verify messages, and thus the consumption of messages and the second one is associated with transactions. JMS transactions are determined by the different perspective that producers and consumers have upon a message. The producer has a contract with the messaging server that ensures that the message will be delivered to the server. The server has a contract with the consumer which ensures that the message will be delivered to him. The two operations are distinct, which is an indisputable benefit for asynchronous messaging. Transactions follow this separation of send and receive operations, but it groups messages which means that either they get all or none to the server. JMS transactions, although similar to JTA (Java Transaction API) are managed by the messaging provider.

Chapter eight presents a major step forward in the optimal management of this architecture: Message-Driven Beans (MDB). MDB"s are logical components that are automatically instantiated by the container and which waits and consumes messages from various producers. The advantages are significant for the entire life cycle is managed by the container and the asynchronous processes receive a considerable support. The chapter concludes with best practices for using MDB, which is facade pattern.

Chapter nine presents the support provided by Spring for developing applications based on JMS.

Chapter ten is focused on resources used by the JMS architectures.

The last chapter is based on messaging design with specific discussions related to internal or external destinations, messaging request/reply design, anti-patterns in the messaging design.

The book includes four appendix related to JMS API, message headers, message properties, installation and configuration of ActiveMQ"s.

In my opinion, the messaging service offered by Java is not used, probably because it is not known enough, at its true potential. The major advantages highlighted at the beginning of this review together with the improvements brought by version 2.0, makes this service worth a lot more interest than the current one. I think that, at a backend level, regarding asynchronous communication, JMS and MDB are excellent solutions.

As always, I look forward to discussion related to the topic of the book.

Enjoy the reading !

VIDEO: ISSUE 97 LAUNCH EVENT

Sponsors

  • comply advantage
  • ntt data
  • Betfair
  • Accenture
  • Siemens
  • Bosch
  • FlowTraders
  • MHP
  • Connatix
  • Cognizant Softvision
  • BoatyardX
  • Colors in projects