Java Reference
In-Depth Information
Note
In the Java EE platform, message listeners and
CLIENT_ACKNOWLEDGE sessions can be used only in application cli-
ents, as in this example.
With a message listener, the automatic acknowledgment happens when the onMessage
method returns (that is, after message processing has finished). With a synchronous re-
ceiver, the client acknowledges the message after processing is complete. If you use
AUTO_ACKNOWLEDGE with a synchronous receive, the acknowledgment happens imme-
diately after the receive call; if any subsequent processing steps fail, the message can-
not be redelivered.
The example is in the following directory:
tut-install /examples/jms/advanced/ackequivexample/src/java/
The example contains an AsynchSubscriber class with a TextListener class,
a MultiplePublisher class, a SynchReceiver class, a SynchSender class, a
main method, and a method that runs the other classes' threads.
The example uses the following objects:
jms/ConnectionFactory , jms/Queue , and jms/Topic : resources that
you created for A Simple Example of Synchronous Message Receives ” on page
378 .
jms/ControlQueue : an additional queue
jms/DurableConnectionFactory : a connection factory with a client ID
(see “ Creating Durable Subscriptions ” on page 364 for more information)
The new queue and connection factory are created at deployment time.
You can use either NetBeans IDE or Ant to build, package, deploy, and run ack-
equivexample .
To Run ackequivexample Using NetBeans IDE
1. To build and package the client, follow these steps.
a. From the File menu, choose Open Project.
b. In the Open Project dialog, navigate to:
tut-install /examples/jms/advanced/
c. Select the ackequivexample folder.
Search WWH ::




Custom Search