WebLogic Server 6.0 Code Examples, BEA Systems, Inc.

examples.jms.queue
Class QueueReceiveInTx

java.lang.Object
  |
  +--examples.jms.queue.QueueReceiveInTx

public class QueueReceiveInTx
extends java.lang.Object

This example shows how to establish a connection to and receive messages from a JMS queue in a client-demarcated transaction. The classes in this package operate on the same JMS queue. Run the classes together to witness messages being sent and received, and to browse the queue for messages.

Author:
Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.

Field Summary
static java.lang.String JMS_FACTORY
          Defines the JMS connection factory for the queue.
static java.lang.String JNDI_FACTORY
          Defines the JNDI context factory.
static java.lang.String QUEUE
          Defines the queue.
 
Constructor Summary
QueueReceiveInTx()
           
 
Method Summary
 void close()
          Closes JMS objects.
 void init(javax.naming.Context ctx, java.lang.String queueName)
          Creates all the necessary objects for receiving messages from a JMS queue.
static void main(java.lang.String[] args)
          main() method.
 void receiveMessages()
          Receives message interface.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JMS_FACTORY

public static final java.lang.String JMS_FACTORY
Defines the JMS connection factory for the queue.

JNDI_FACTORY

public static final java.lang.String JNDI_FACTORY
Defines the JNDI context factory.

QUEUE

public static final java.lang.String QUEUE
Defines the queue.
Constructor Detail

QueueReceiveInTx

public QueueReceiveInTx()
Method Detail

close

public void close()
           throws javax.jms.JMSException
Closes JMS objects.
Throws:
javax.jms.JMSException - if JMS fails to close objects due to internal error

init

public void init(javax.naming.Context ctx,
                 java.lang.String queueName)
          throws javax.naming.NamingException,
                 javax.jms.JMSException
Creates all the necessary objects for receiving messages from a JMS queue.
Parameters:
ctx - JNDI initial context
queueName - name of queue
Throws:
javax.naming.NamingException - operation cannot be performed
javax.jms.JMSException - if JMS fails to initialize due to internal error

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
main() method.
Throws:
java.lang.Exception - if execution fails

receiveMessages

public void receiveMessages()
Receives message interface.

Documentation is available at
http://e-docs.bea.com/wls/docs60

Copyright © 2000 BEA Systems, Inc. All Rights Reserved.