To build, package, deploy, and run the MessageBrowser example using Ant, follow these steps.
You also need the Producer example to send the message to the queue, and one of the consumer clients to consume the messages after you inspect them. If you did not do so already, package these examples.
To run the clients, you need two terminal windows.
In a terminal window, go to the messagebrowser directory.
cd ../messagebrowser |
Type the following command:
ant |
The targets place the application client JAR file in the dist directory for the example.
Go to the producer directory.
Run the Producer client, sending one message to the queue:
appclient -client client-jar/producerClient.jar queue |
The output of the client looks like this (along with some application client container output):
Destination type is queue Sending message: This is message 1 from producer |
Go to the messagebrowser directory.
Deploy the client JAR file to the GlassFish Server, then retrieve the client stubs:
ant getclient |
Ignore the message that states that the application is deployed at a URL.
Because this example takes no command-line arguments, you can run the MessageBrowser client using the following command:
ant run |
Alternatively, you can type the following command:
appclient -client client-jar/messagebrowserClient.jar |
The output of the client looks like this (along with some application client container output):
Message: Text: This is message 1 from producer Class: com.sun.messaging.jmq.jmsclient.TextMessageImpl getJMSMessageID(): ID:12-129.148.71.199(8c:34:4a:1a:1b:b8)-40883-1255980521747 getJMSTimestamp(): 1255980521747 getJMSCorrelationID(): null JMSReplyTo: null JMSDestination: PhysicalQueue getJMSDeliveryMode(): PERSISTENT getJMSRedelivered(): false getJMSType(): null getJMSExpiration(): 0 getJMSPriority(): 4 Properties: null Message: Class: com.sun.messaging.jmq.jmsclient.MessageImpl getJMSMessageID(): ID:13-129.148.71.199(8c:34:4a:1a:1b:b8)-40883-1255980521767 getJMSTimestamp(): 1255980521767 getJMSCorrelationID(): null JMSReplyTo: null JMSDestination: PhysicalQueue getJMSDeliveryMode(): PERSISTENT getJMSRedelivered(): false getJMSType(): null getJMSExpiration(): 0 getJMSPriority(): 4 Properties: null |
The first message is the TextMessage, and the second is the non-text control message.
Go to the synchconsumer directory.
Run the SynchConsumer client to consume the messages:
appclient -client client-jar/synchconsumerClient.jar queue |
The output of the client looks like this (along with some application client container output):
Destination type is queue Reading message: This is message 1 from producer |