O'Reilly logo

EJB 3.1 Cookbook by Richard M. Reese

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Handling a map-based message

The MapMessage interface supports a message consisting of a set of mapped key/value pairs. This is similar to the Java HashMap class where a key, such as a name, can be assigned a value, such as a telephone number. It allows this type of information to be transferred as a set of key/value pairs. In this recipe we will develop an application that illustrates their use.

Getting ready

The essential structure of a servlet used to generate a message was introduced in the introduction. Here we will address the unique elements of creating and using a MapMessage which include:

  1. Creating a MapMessage using the createMapMessage method
  2. Writing key/value pairs to the MapMessage
  3. Sending the message

How to do it...

Create a Queue named ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required