HomeDigital EditionSys-Con RadioSearch Java Cd
Advanced Java AWT Book Reviews/Excerpts Client Server Corba Editorials Embedded Java Enterprise Java IDE's Industry Watch Integration Interviews Java Applet Java & Databases Java & Web Services Java Fundamentals Java Native Interface Java Servlets Java Beans J2ME Libraries .NET Object Orientation Observations/IMHO Product Reviews Scalability & Performance Security Server Side Source Code Straight Talking Swing Threads Using Java with others Wireless XML

"Using the Java Message Service with BEA/WEBLOGIC"
Volume: 5 Issue: 1, p.14

Download files assoicated with this article


Listing 1:

public final String JMS_FACTORY = "javax.jms.QueueConnectionFactory";
public final String QUEUE = "jdj.article.queue.sender";
private void initializeJMS(boolean transacted)
    if (initCtx != null)
        // Look up the default QueueCon-
     // nectionFactory...
     queueFx = (QueueConnectionFactory)

     // Create a QueueConnection from
     // the Connection Factory...
     conn = queueFx.createQueueConnec-

     // Create a QueueSession from the
     // QueueConnection. The first
     // parameter is a boolean that
     // specifies transacted or not
     // transacted. The second param
     // specifies that our Session will
     // automatically Acknowledge a
     // client's receipt of a message.
     session = conn.createQueueSes-

     // Look up the Destination we want
     // to use for our Consumers and
     // Producers for this session. In
     // this case a Queue called
     // "jdj.article.queue.sender".
     queue = (Queue) initCtx.lookup(QUEUE);


Listing 2:

// create a Sender
if (sender == null)
    sender = session.createSender(queue);

TextMessage msg = session.createTextMessage();

// Override default, to insure it's
// using persistent delivery...

// Set ReplyTo to temporary queue...

// Send the message...


All Rights Reserved
Copyright ©  2004 SYS-CON Media, Inc.
  E-mail: [email protected]

Java and Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. SYS-CON Publications, Inc. is independent of Sun Microsystems, Inc.