Java Reference
In-Depth Information
standalone.sh -c standalone-full.xml
Note
Remember, when switching to another server configuration, you will need to recreate all
the example resources, such as data sources, that were set up initially for your standalone
configuration.
Now deploy your application using either Eclipse's Server view or Maven and access the
application at http://localhost:8080/ticket-agency-jms/ .
Everything should work just like the earlier JPA project; however, in your application
server console, you should notice the messages that confirm a seat has been booked.
Specifying which message to receive using selectors
Message selectors allow an MDB to be more selective about the messages it receives from
a particular topic or queue. Message selectors use message properties as criteria in condi-
tional expressions. Message properties, upon which message selectors are based, are addi-
tional headers that can be assigned to a message. They give the application developer the
ability to attach more information to a message. This information can be stored using sev-
eral primitive values ( boolean , byte , short , int , long , float , and double ) or
as String .
For example, let's suppose that we want to process two kinds of messages with the same
queue:
• A trace message indicating that a user has booked a seat
• A warning message indicating that an error has occurred
Hence, our sendMessage method can be changed slightly to include a String prop-
erty that can be attached to the message:
@ApplicationScoped
public class BookingQueueProducer {
@Inject
private JMSContext context;
@Inject
Search WWH ::




Custom Search