Java Reference
In-Depth Information
Ignore the message that states that the application is deployed at a URL.
b. To run the client, type the following:
appclient -client client-jar/synchconsumerClient.jar queue
The output of the program looks like this (along with some additional output):
Click here to view code image
Destination type is queue
Reading message: This is message 1 from producer
Reading message: This is message 2 from producer
Reading message: This is message 3 from producer
Undeploying and Cleaning the Simple JMS Examples
After you finish running the examples, you can undeploy them and remove the build arti-
facts.
You can also use the asadmin delete-jms-resource command to delete the des-
tinations and connection factories you created. However, it is recommended that you keep
them, because they will be used in most of the examples later in this chapter. After you
have created them, they will be available whenever you restart the GlassFish Server.
Writing Robust JMS Applications
The following examples show how to use some of the more advanced features of the JMS
API.
A Message Acknowledgment Example
The AckEquivExample.java client shows how both of the following scenarios en-
sure that a message will not be acknowledged until processing of it is complete:
Using
an
asynchronous
message
consumer
(a
message
listener)
in
an
AUTO_ACKNOWLEDGE session
• Using a synchronous receiver in a CLIENT_ACKNOWLEDGE session
Search WWH ::




Custom Search