background image

Connection Factory without Client ID

<< A Durable Subscription Example | Using JMS API Local Transactions >>
<< A Durable Subscription Example | Using JMS API Local Transactions >>

Connection Factory without Client ID

To run the program from the command line, follow these steps:
1. Go to the dist directory:
cd dist
2. Type the following command:
appclient -client durablesubscriberexample.jar
The output looks something like this:
Connection factory without client ID is jms/ConnectionFactory
Connection factory with client ID is jms/DurableConnectionFactory
Topic name is jms/Topic
Starting subscriber
PUBLISHER: Publishing message: Here is a message 1
SUBSCRIBER: Reading message: Here is a message 1
PUBLISHER: Publishing message: Here is a message 2
SUBSCRIBER: Reading message: Here is a message 2
PUBLISHER: Publishing message: Here is a message 3
SUBSCRIBER: Reading message: Here is a message 3
Closing subscriber
PUBLISHER: Publishing message: Here is a message 4
PUBLISHER: Publishing message: Here is a message 5
PUBLISHER: Publishing message: Here is a message 6
Starting subscriber
SUBSCRIBER: Reading message: Here is a message 4
SUBSCRIBER: Reading message: Here is a message 5
SUBSCRIBER: Reading message: Here is a message 6
Closing subscriber
Unsubscribing from durable subscription
After you run the program, you can delete the connection factory
jms/DurableConnectionFactory
. Go to the directory
tut-install/javaeetutorial5/examples/jms/advanced/durablesubscriberexample/ and
type the following command:
ant delete-durable-cf
To delete the class and JAR files for the program using NetBeans IDE, right-click the project and
choose Clean Project.
To delete the class and JAR files for the program using Ant, type the following:
ant clean
Creating Robust JMS Applications
The Java EE 5 Tutorial · September 2007
946