• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

AckEquivExample.javaH A D28-Jan-201916.5 KiB433280

AsynchQueueExample.javaH A D28-Jan-20193.1 KiB9355

AsynchTopicExample.javaH A D28-Jan-201910.2 KiB276165

BytesMessages.javaH A D28-Jan-20194.8 KiB13280

DurableSubscriberExample.javaH A D28-Jan-201910.1 KiB285165

MessageConversion.javaH A D28-Jan-20195.4 KiB13576

MessageFormats.javaH A D28-Jan-20196.2 KiB15992

MessageHeadersTopic.javaH A D28-Jan-201918.9 KiB473323

ObjectMessages.javaH A D28-Jan-20194 KiB11273

READMEH A D28-Jan-201926.9 KiB694490

RequestReplyQueue.javaH A D28-Jan-20198.9 KiB232148

SampleUtilities.javaH A D28-Jan-201912 KiB345183

SenderToQueue.javaH A D28-Jan-20193.6 KiB10565

SynchQueueExample.javaH A D28-Jan-20193.4 KiB10861

SynchTopicExample.javaH A D28-Jan-20198.8 KiB242136

TextListener.javaH A D28-Jan-20191.5 KiB4517

TopicSelectors.javaH A D28-Jan-201914.4 KiB364218

TransactedExample.javaH A D28-Jan-201936 KiB877504

XMLMessageExample.javaH A D28-Jan-20197.8 KiB235157

sample.dtdH A D28-Jan-2019930 3819

sample.xmlH A D28-Jan-20191.1 KiB4321

README

1Java(TM) Message Service (JMS) CODE EXAMPLES
2
3Notes for use with Oracle GlassFish(tm) Server Message Queue
4------------------------------------------------------------
5
6These notes describe the example applications provided in this
7directory and explain how to use these examples in a Oracle GlassFish(tm)
8Server Message Queue environment.  The examples consist of the fifteen
9JMS examples included in the JMS Sample Programs bundle available
10from the JMS website and four additional examples supplied by the
11Oracle GlassFish(tm) Server Message Queue product.
12
13For the most part, the following notes preserve the text that
14accompanies the JMS Sample Programs; however, new sections have
15been added to provide information specific to Oacle GlassFish(tm)
16Server Message Queue.
17
18A detailed guideline on configuring your enrivonment and setting CLASSPATH
19is found in the top-level README file of the examples (demo) directory of
20the Message Queue installation (<IMQ_HOME>/examples/README) as well as in
21the "Quick Start Tutorial" in the Oracle GlassFish(tm) Server Message Queue
22Developer's Guide.
23
24For running a client application that uses JNDI with File System
25Provider, fscontext.jar should be added to the CLASSPATH.
26
27Additional CLASSPATH requirements (if any) are noted with the
28description of each example in these notes.
29
30The material in these notes is organized into the following sections:
31
321. List of example applications
332. Using JMS examples in a Oracle GlassFish(tm) Server Message Queue
34environment
35   - Modification of JMS Sample Programs
36   - Using Oracle GlassFish(tm) Server Message Queue administered objects and JNDI
37   - Automatic destination creation
383. JMS Sample Programs
394. Oracle GlassFish(tm) Server Message Queue supplied examples
40
41===============================
421. List of Example Applications
43===============================
44
45The example applications consist of the fifteen JMS examples
46included in the JMS Sample Programs bundle available from the
47JMS website and four additional examples supplied by
48Oracle GlassFish(tm) Server Message Queue.
49
50
51JMS Sample Programs
52===================
53
54The JMS Sample Programs bundle can be downloaded in original form
55from the JMS website at http://mq.dev.java.net/
56
57The example applications included in the JMS Sample Programs are
58the following:
59- SenderToQueue
60- SynchQueueExample
61- SynchTopicExample
62- AsynchQueueExample
63- AsynchTopicExample
64- MessageFormats
65- MessageConversion
66- ObjectMessages
67- BytesMessages
68- MessageHeadersTopic
69- TopicSelectors
70- DurableSubscriberExample
71- AckEquivExample
72- TransactedExample
73- RequestReplyQueue
74These examples are described in Section 3 of these notes:
75"JMS Sample Programs."
76
77Additional examples supplied by Oracle GlassFish(tm) Server Message Queue
78=========================================================================
79
80The additional examples supplied by Oracle GlassFish(tm) Server Message Queue
81are the following:
82- XMLMessageExample
83These examples are described below, in Section 4 of these notes:
84"Additional examples supplied by Oracle GlassFish(tm) Server Message Queue."
85
86
87================================================================================
882. Using JMS Examples in a Oracle GlassFish(tm) Server Message Queue environment
89================================================================================
90
91This section provides information you need to run the JMS example
92applications in a Oracle GlassFish(tm) Server Message Queue environment.
93
94
95Modifications to JMS Sample Programs
96====================================
97
98All of the examples in JMS Sample Programs use the utility class
99SampleUtilities.java to obtain the ConnectionFactory and Destination
100administered objects needed by a JMS client application.
101
102As originally written, SampleUtilities.java uses the Java Naming and Directory
103Interface (JNDI) to look up these administered objects, thus making the
104example applications provider-independent.
105
106In the interest of not requiring JNDI in order to run the example
107applications, however, the SampleUtilities.java default behavior has been
108modified to directly instantiate Oracle GlassFish(tm) SErver Message Queue
109ConnectionFactory and Destination administered objects, rather than use a
110JNDI lookup. This means you can run the example applications without having
111to first add Oracle GlassFish(tm) Server Message Queue administered objects to a JNDI
112directory service.
113
114If you prefer, instead, to use a JNDI lookup, you have to first populate a
115JNDI directory service with the required administered objects. Then, when
116running an example application, you set the system property USE_JNDI to "true"
117on the command line, as shown below:
118  % java -DUSE_JNDI=true <-D JNDI_Initial_Context_Properties...> \
119    <example_application> <parameters>
120
121See the section "Using Oracle GlassFish(tm) Server Message Queue Administered Objects
122and JNDI," below, for more details on running these examples with JNDI, including
123example values of the JNDI_Initial_Context_Properties.
124
125
126Using Oracle GlassFish(tm) Server Message Queue Administered Objects and JNDI
127=====================================================================
128
129When running the example programs using a JNDI lookup to access Sun
130Java(tm) System Message Queue administered objects, you have to perform
131the following steps:
132
1331. Add the required Oracle GlassFish(tm) Server Message Queue administered objects
134to an object store.  Oracle GlassFish(tm) Server Message Queue supports both a file
135system service provider and an LDAP service provider.
136
1372. Run the example applications using the appropriate system properties for the JNDI service provider you are using
138
139These steps are described in more detail below.
140
141STEP 1:
142Adding the required Oracle GlassFish(tm) Server Message Queue administered objects to
143an object store.
144-----------------------------------------------------------------------
145
146The examples assume that the lookup name is prefixed with "cn="  that is, for
147example, the Queue named "controlQueue" is stored under the lookup name
148"cn=controlQueue"
149
150This prefix is meant to satisfy the default Java Schema on most LDAP servers.
151If you are using an LDAP server that is configured differently, you have to
152modify SampleUtilities.java accordingly.
153
154The examples expect the following Oracle GlassFish(tm) Server Message Queue Objects to
155have been created and stored using either a file system or LDAP directory service
156provider for JNDI:
157
1581. cn=ConnectionFactory               a ConnectionFactory object
1592. cn=QueueConnectionFactory          a QueueConnectionFactory object
1603. cn=TopicConnectionFactory          a TopicConnectionFactory object
1614. cn=controlQueue                    a Queue object
1625. cn=A                               a Queue object
1636. cn=B                               a Queue object
1647. cn=C                               a Queue object
1658. cn=D                               a Queue object
1669. cn=E                               a Queue object
167
168  (Other Queue and Topic objects of your choice might also be needed
169   as parameters in running some of the example applications.)
170
171Oracle GlassFish(tm) Server Message Queue administered object support includes both a
172command line object manager utility (imqobjmgr) and a GUI tool (the Admin Console).
173You use these tools, as described in the Oracle GlassFish(tm) Server Message Queue
174Administrator's Guide, to create and manage Oracle GlassFish(tm) Server Message Queue
175administered objects. You can find examples in the <IMQ_HOME>/examples/imqobjmgr
176directory.
177
178The paragraphs below provide examples how to use imqobjmgr to create
179administered objects using the following Oracle GlassFish(tm) Server Message
180Queue implementations:
181- a file system JNDI service provider (A)
182- an LDAP JNDI service provider (B).
183
184A) Using the File System Service Provider
185
186   The imqobjmgr command is run from the <IMQ_HOME>/bin directory.
187   On the Solaris Platform Edition, imqobjmgr is in the /usr/bin/ directory.
188   Objects are stored in a directory specified by java.naming.provider.url.
189
190   Use the following imqobjmgr command to add an ConnectionFactory
191   object to the file=based object store.
192   The lookup name specified is "cn=ConnectionFactory".
193   Other attributes assume the default connection factory configuration.
194
195     % imqobjmgr add -t cf -l cn=ConnectionFactory \
196       -j "java.naming.factory.initial=com.sun.jndi.fscontext.RefFSContextFactory" \
197       -j "java.naming.provider.url=file:///var/imq/imq_admin_objects"
198
199     When running on Windows the value of the "java.naming.provider.url"
200     property would change to a win32 file url of the form
201     "file:///C:/imq_admin_objects" which includes the drive letter and full
202     directory name.
203
204   Use the following imqobjmgr command to add a Queue object to the object
205   store. The lookup name specified is "cn=Queue".
206   The queue destination name set to "Queue1".
207   Note: Always use the "JNDI lookup name" for a lookup and not the
208         "imqDestinationName" that was assigned to the destination object.
209
210     % imqobjmgr add -t q -l cn=Queue -o "imqDestinationName=Queue1" \
211       -j "java.naming.factory.initial=com.sun.jndi.fscontext.RefFSContextFactory" \
212       -j "java.naming.provider.url=file:///var/imq/imq_admin_objects"
213
214B) Using the LDAP Service Provider
215
216   The imqobjmgr command is run from the <IMQ_HOME>/bin directory.
217   On the Solaris Platform Edition, imqobjmgr is in the /usr/bin/ directory.
218   Objects are stored in an LDAP url specified by java.naming.provider.url.
219
220   Use the following imqobjmgr command to add a ConnectionFactory
221   object to the LDAP object store.
222   The lookup name specified is "cn=ConnectionFactory".
223   Other attributes assume the default connection factory configuration.
224
225     % imqobjmgr add -t cf -l cn=ConnectionFactory \
226       -j "java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory" \
227       -j "java.naming.provider.url=ldap://<servername>:389/ou=JMSObj, ou=xxx, \
228           o=JMQ" \
229       -j "java.naming.security.authentication=simple" \
230       -j "java.naming.security.principal=uid=xxx, ou=People, o=JMQ" \
231       -j "java.naming.security.credentials=xxx"
232   Substitute the <servername>, principal, and credential as appropriate.for
233   Your LDAP installation.
234
235STEP 2:
236Run the example using the appropriate JNDI System properties
237------------------------------------------------------------
238
239An example of running SenderToQueue (the first JMS example application) with
240both the file system (A) and LDAP (B) service providers is included below.
241
242A) Running SenderToQueue with the file system JNDI service provider:
243
244   % java -DUSE_JNDI=true \
245     -Djava.naming.factory.initial=com.sun.jndi.fscontext.RefFSContextFactory \
246     -Djava.naming.provider.url=file:///var/imq/imq_admin_objects \
247     SenderToQueue Queue
248
249B) Running SenderToQueue with the LDAP JNDI service provider.
250
251   % java -DUSE_JNDI=true \
252     -D"java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory" \
253     -D"java.naming.provider.url=ldap://<servername>:389/ou=JMSObj, ou=xxx, o=JMQ" \
254     -D"java.naming.security.authentication=simple" \
255     -D"java.naming.security.principal=uid=xxx, ou=People, o=JMQ" \
256     -D"java.naming.security.credentials=xxx" SenderToQueue cn=Queue
257   Substitute the <servername>, principal and credentials as appropriate for
258   your LDAP installation.
259
260Automatic Destination Creation
261==============================
262
263By default, physical destinations for Topics and Queues are "auto-created" by
264a broker when a message producer or a message consumer is created, or when
265messages are first produced for a destination. Hence, to run the examples,
266there is no need to manually create destinations using an administrative tool
267(per the JMS Sample Programs instructions in Section 3).
268
269(The "auto-create" behavior can be changed by modifying the Broker properties
270"imq.autocreate.queue" and "imq.autocreate.topic".
271
272
273======================
2743. JMS Sample Programs
275======================
276
277The Java Message Service (JMS) code examples show how to write a simple
278application using JMS.  They demonstrate most of the important features of JMS.
279
280The JMS examples are divided into three groups:
281
282 - Basic examples provide a simple introduction to JMS.  They show how to send
283   and synchronously receive a single message using either a queue or a topic.
284
285 - Intermediate examples demonstrate somewhat more complex features of JMS:
286     - using message listeners for asynchronous receiving of messages
287     - using the five supported message formats
288
289 - Advanced examples demonstrate still more advanced features of JMS:
290     - using message headers
291     - using message selectors
292     - using durable subscriptions
293     - using acknowledgement modes
294     - using transactions
295     - using the request/reply facility
296
297You can run the simpler queue examples in pairs, each program in a separate
298terminal window.  This allows you to simulate two separate applications, one
299sending a message, the other receiving it.
300
301For the other examples, the producer and consumer (or the publisher and the
302subscriber, for topic examples) are each a separate class within the overall
303program class.  When you run these examples, the two classes use threads to
304send and receive messages within the same program.
305
306
307Before You Start
308================
309
310Before you begin, follow the JMS Provider's instructions for starting up the
311system.  Then create a queue and a topic.  Most of the examples take either a
312queue name or a topic name as an argument.  To run some of the examples, you
313should also create a queue named "controlQueue".
314
315Compile the sample programs individually if you wish, or all at once by using
316the command
317
318  javac *.java
319
320
321What All the Examples Have in Common
322====================================
323
324All the examples use the utility class SampleUtilities.java.  It contains the
325following methods:
326
327  - The methods getConnectionFactory, getQueueConnectionFactory,
328    getTopicConnectionFactory, getQueue,and getTopic, which obtain a
329    connection factory or destination either by directly instantiating
330    Oracle GlassFish(tm) Server Message Queue Administered Objects or, if you
331    choose to use JNDI, by calling the method jndiLookup.
332
333  - The methods sendSynchronizeMessage and receiveSynchronizeMessages, which
334    are used to ensure that a publisher does not publish messages until its
335    subscriber or subscribers are ready for message delivery.  These methods
336    use a queue named "controlQueue".
337
338  - The class DoneLatch, which allows a program to synchronize between an
339    asynchronous consumer and another thread in the receiving class.
340
341  - An exit method that all the examples call.
342
343Most of the JMS examples execute the same basic setup steps:
344
345  1.  They read a topic or queue name from the command line.
346      See "Automatic Destination Creation" in Section 2 of these for
347      information about automatic destination creation in Oracle GlassFish(tm)
348      Server Message Queue.
349
350  2.  They directly instantiate Oracle GlassFish(tm) Server Message Queue connection
351      factory objects unless the System property USE_JNDI is set to true in
352      which case they look them up using the jndiLookup method in the class
353      SampleUtilities.
354
355  3.  They use the connection factory to create a connection.
356
357  4.  They use the connection to create a session.
358
359  5.  They use the session to create message producers and/or consumers for
360      the topic or queue.
361
362The publish/subscribe examples begin by calling the sendSynchronizeMessage and
363receiveSynchronizeMessages methods to ensure that the consumer gets all the
364messages the producer sends.  The consumer calls sendSynchronizeMessage
365when it is ready to receive messages.  The producer waits for the synchronize
366message; when the message arrives, the producer starts sending its messages.
367
368Most of the message-producing examples send an empty message at the end of the
369program to indicate that they have finished sending messages.  The
370message-consuming examples use this message as a signal to stop reading
371messages.  The asynchronous message consumers use the DoneLatch class to pass
372this signal from the message listener to the consuming class.
373
374Each example contains comments that provide details on what it does and how it
375works.
376
377
378Basic Examples
379==============
380
381The most basic JMS examples do the following:
382
383  - SenderToQueue.java and SynchQueueExample.java can be used to send and
384    synchronously receive a single text message using a queue.
385
386    If you run these programs in two different windows, the order in which you
387    start them does not matter.  If you run them in the same window, run
388    SenderToQueue first.  Each program takes a queue name as a command-line
389    argument.
390
391    The output of SenderToQueue looks like this (the queue name is SQ):
392
393      % java SenderToQueue SQ
394      Queue name is SQ
395      Sending message: Here is a message 1
396
397     If you use JNDI, the destination name parameter is required to be the
398     JNDI lookup name and the command line would be:
399
400       % java -DUSE_JNDI=true \
401         <-D JNDI_Initial_Context_Properties...> SenderToQueue <queue_name>
402
403     Note that <queue_name> is used without the "cn=" prefix.
404
405     The output of SynchQueueReceiver looks like this:
406
407       % java SynchQueueExample SQ
408       Queue name is SQ
409       Reading message: Here is a message
410
411     If you use JNDI, the command line would be:
412
413       % java -DUSE_JNDI=true \
414         <-D JNDI_Initial_Context_Properties...> SynchQueueExample
415         <queue_name>
416
417     Note that <queue_name> is used without the "cn=" prefix.
418
419
420  - SynchTopicExample.java uses a producer class and a consumer class to
421    publish and synchronously receive a single text message using a topic.
422    The program takes a topic name as a command-line argument.
423
424    The output of SynchTopicExample looks like this (the topic name is ST):
425
426      % java SynchTopicExample ST
427      Topic name is ST
428      PRODUCER THREAD: Publishing message: Here is a message 1
429      CONSUMER THREAD: Reading message: Here is a message 1
430
431     If you use JNDI, the command line would be:
432
433       % java -DUSE_JNDI=true \
434         <-D JNDI_Initial_Context_Properties...> SynchTopicExample
435         <topic_name>
436
437     Note that <topic_name> is used without the "cn=" prefix.
438
439These examples contain more detailed explanatory comments than the others.
440
441
442Intermediate Examples
443=====================
444
445The intermediate JMS examples do the following:
446
447  - SenderToQueue.java and AsynchQueueExample.java send a specified number of
448    text messages to a queue and asynchronously receive them using a message
449    listener (TextListener), which is in the file TextListener.java.
450
451    To use SenderToQueue to send more than one message, specify a number after
452    the queue name when you run the program.  For example:
453
454      % java SenderToQueue SQ 3
455
456     If you use JNDI, the command line would be:
457
458       % java -DUSE_JNDI=true \
459         <-D JNDI_Initial_Context_Properties...> SenderToQueue <queue_name>
460         <number>
461
462     Note that <queue_name> is used without the "cn=" prefix.
463
464    If you run these programs in two different windows, the order in which you
465    start them does not matter.  If you run them in the same window, run
466    SenderToQueue first.
467
468
469  - AsynchTopicExample.java uses a producer class and a consumer class to
470    publish five text messages to a topic and asynchronously get them using a
471    message listener (TextListener).
472
473      % java AsynchTopicExample <topic_name>
474
475     If you use JNDI, the command line would be:
476
477       % java -DUSE_JNDI=true \
478         <-D JNDI_Initial_Context_Properties...> AsynchTopicExample
479         <topic_name>
480
481     Note that <topic_name> is used without the "cn=" prefix.
482     Also, the example expects to find the control queue using the lookup name
483     "cn=controlQueue".
484
485
486  - MessageFormats.java writes and reads messages in the five supported message
487    formats.  The messages are not sent, so you do not need to specify a queue
488    or topic argument when you run the program.
489
490      % java MessageFormats
491
492     If you use JNDI, the command line would be:
493
494       % java -DUSE_JNDI=true <-D JNDI_Initial_Context_Properties...>
495         MessageFormats
496
497
498  - MessageConversion.java shows that for some message formats, you can write
499    a message using one data type and read it using another.  The
500    StreamMessage format allows conversion between String objects and other
501    data types.  The BytesMessage format allows more limited conversions.  You
502    do not need to specify a queue or topic argument.
503
504      % java MessageConversion
505
506     If you use JNDI, the command line would be:
507
508       % java -DUSE_JNDI=true <-D JNDI_Initial_Context_Properties...>
509         MessageConversion
510
511
512  - ObjectMessages.java shows that objects are copied into messages, not
513    passed by reference: once you create a message from a given object, you
514    can change the original object, but the contents of the message do not
515    change.  You do not need to specify a queue or topic argument.
516
517      % java ObjectMessages
518
519     If you use JNDI, the command line would be:
520
521       % java -DUSE_JNDI=true <-D JNDI_Initial_Context_Properties...>
522         ObjectMessages
523
524
525  - BytesMessages.java shows how to write, then read, a BytesMessage of
526    indeterminate length.  It reads the message content from a text file, but
527    the same basic technique can be used with any kind of file, including a
528    binary one.  Specify a text file on the command line when you run the
529    program:
530
531      % java BytesMessages <filename>
532
533     If you use JNDI, the command line would be:
534
535       % java -DUSE_JNDI=true \
536         <-D JNDI_Initial_Context_Properties...> BytesMessages <filename>
537
538
539Advanced Examples
540=================
541
542The advanced examples do the following:
543
544  - MessageHeadersTopic.java illustrates the use of the JMS message header
545    fields.  It displays the values of the header fields both before and after
546    a message is sent, and shows how the send method sets the fields.
547
548      % java MessageHeadersTopic <topic_name>
549
550     If you use JNDI, the command line would be:
551
552       % java -DUSE_JNDI=true \
553         <-D JNDI_Initial_Context_Properties...> MessageHeadersTopic
554         <topic_name>
555
556     Note that <topic_name> is used without the "cn=" prefix.
557     Also, the example expects to find the control queue using the lookup name
558     "cn=controlQueue".
559
560
561  - TopicSelectors.java shows how to use message header fields as message
562    selectors.  The program consists of one publisher and several subscribers.
563    Each subscriber uses a message selector to receive a subset of the
564    messages sent by the publisher.
565
566      % java TopicSelectors <topic_name>
567
568     If you use JNDI, the command line would be:
569
570       % java -DUSE_JNDI=true \
571         <-D JNDI_Initial_Context_Properties...> TopicSelectors <topic_name>
572
573     Note that <topic_name> is used without the "cn=" prefix.
574     Also, the example expects to find the control queue using the lookup name
575     "cn=controlQueue".
576
577
578  - DurableSubscriberExample.java shows how you can create a durable
579    subscriber that retains messages published to a topic while the subscriber
580    is inactive.
581
582      % java DurableSubscriberExample <topic_name>
583
584     If you use JNDI, the command line would be:
585
586       % java -DUSE_JNDI=true \
587         <-D JNDI_Initial_Context_Properties...> DurableSubscriberExample \
588         <topic_name>
589
590     Note that <topic_name> is used without the "cn=" prefix.
591
592
593  - AckEquivExample.java shows that to ensure that a message will not be
594    acknowledged until processing is complete, you can use either of the
595    following methods:
596
597    * An asynchronous receiver (message listener) in an AUTO_ACKNOWLEDGE
598      session
599    * A synchronous receiver in a CLIENT_ACKNOWLEDGE session
600
601    This example takes both a queue name and a topic name as arguments.
602
603      % java AckEquivExample <queue_name> <topic_name>
604
605     If you use JNDI, the command line would be:
606
607       % java -DUSE_JNDI=true \
608         <-D JNDI_Initial_Context_Properties...> AckEquivExample <queue_name> \
609         <topic_name>
610
611     Note that <queue_name> and <topic_name> is used without the "cn=" prefix.
612     Also, the example expects to find the control queue using the lookup name
613     "cn=controlQueue".
614
615
616  - TransactedExample.java demonstrates the use of transactions in a simulated
617    e-commerce application.  The classes within the example commit a transaction
618    only after they have received messages they were expecting and have sent
619    appropriate messages as a result.  This example takes an integer argument
620    (the number of items being ordered).  It uses five queues named A, B, C,
621    D, and E, which you must create in order to run the program.
622
623      % java TransactedExample <integer>
624
625     If you use JNDI, the command line would be:
626
627       % java -DUSE_JNDI=true \
628         <-D JNDI_Initial_Context_Properties...> TransactedExample <integer>
629
630     Note that in this case, the lookup names "cn=A", "cn=B", "cn=C", "cn=D",
631     and "cn=E" are expected to be available from JNDI.
632
633
634  - RequestReplyQueue.java uses the JMS request/reply facility, which supports
635    situations in which every message sent requires a response.  The sending
636    application creates a QueueRequestor, which encapsulates the creation and
637    use of a destination where a reply is sent.
638
639      % java RequestReplyQueue <queue_name>
640
641     If you use JNDI, the command line would be:
642
643       % java -DUSE_JNDI=true \
644         <-D JNDI_Initial_Context_Properties...> RequestReplyQueue
645         <queue_name>
646
647     Note that <queue_name> is used without the "cn=" prefix.
648
649============================================================================
6504. Additional examples supplied by Oracle GlassFish(tm) Server Message Queue
651============================================================================
652
653The additional examples supplied by Oracle GlassFish(tm) Server Message Queue are
654the following:
655
656  - XMLMessageExample.java reads an XML document from a file and uses the
657    standard JMS API to send it to a queue. It then uses a receiver to process
658    the message from the queue as an XML document and convert it to a DOM
659    object using the JAXP API.
660
661    To compile and run the example with JDK1.4 or later, no additional jar libraries are
662    required.
663
664       % java XMLMessageExample <queue_name> <xml_filename> [<systemid_url>]
665
666     <queue_name> is the JMS queue to send the message to.
667     <xml_filename> is the file containing the XML document.
668     <systemid_url> is the url to use to resolve relative URLs present in the
669               input source (i.e. the XML Document)
670
671     There is a sample XML file (sample.xml) and its DTD file (sample.dtd)
672     provided.
673
674     for example on a Unix platform -
675
676       % java XMLMessageExample myxmlqueue sample.xml file:///<directory>/
677       Queue name is myxmlqueue
678       Write 771 bytes into message
679       Read 771 bytes from message
680       Root element of the doc is slideshow
681
682     If you use JNDI, the command line would be:
683
684       % java -DUSE_JNDI=true \
685         <-D JNDI_Initial_Context_Properties...> XMLMessageExample
686         <queue_name> <xml_filename> [<systemid_url>]
687
688After You Finish
689================
690
691After you run the examples, you can delete the topic and queues you created
692and shut down the broker.
693
694