Handling a string-based message
In this recipe, we will use a
TextMessage to send an order to an MDB. The
TextMessage interface uses a
String object to hold the order. We will use the
java.util.Scanner class to parse the order information from this string.
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
TextMessage which include:
- Creating a
- Creating a string containing the message
- Sending the message
How to do it...
Create a Queue named
jms/TextQueue and a
jms/TextFactoryPool as described in the introduction. Next, create a Java EE application called ...