Create a Queue Session Create a Topic Session

5-6 Programming JMS for Oracle WebLogic Server For more information about the Session class, see Section 2.4.3, Session or the javax.jms.Session Javadoc, at http:java.sun.comjavaee5docsapijavaxjmsSession.html .

5.2.3.1 Create a Queue Session

The QueueConnection class defines the following method for creating a queue session: public QueueSession createQueueSession boolean transacted, int acknowledgeMode throws JMSException You must specify a boolean argument indicating whether the session will be transacted true or non-transacted false, and an integer that indicates the acknowledge mode for non-transacted sessions. The acknowledgeMode attribute is ignored for transacted sessions. In this case, messages are acknowledged when the transaction is committed using the commit method. For more information about the QueueConnection class methods, see the javax.jms.QueueConnection Javadoc, at http:java.sun.comjavaee5docsapijavaxjmsQueueConnection. html . For more information about the QueueSession class, see the javax.jms.QueueSession Javadoc, at http:java.sun.comjavaee5docsapijavaxjmsQueueSession.htm l .

5.2.3.2 Create a Topic Session

The TopicConnection class defines the following method for creating a topic session: public TopicSession createTopicSession boolean transacted, int acknowledgeMode throws JMSException You must specify a boolean argument indicating whether the session will be transacted true or non-transacted false, and an integer that indicates the acknowledge mode for non-transacted sessions. The acknowledgeMode attribute is ignored for transacted sessions. In this case, messages are acknowledged when the transaction is committed using the commit method. For more information about the TopicConnection class methods, see the javax.jms.TopicConnection Javadoc, at http:java.sun.comjavaee5docsapijavaxjmsTopicConnection. html . For more information about the TopicSession class, see the Note: A session and its message producers and consumers can only be accessed by one thread at a time. Their behavior is undefined if multiple threads access them simultaneously. WebLogic JMS does not support having both types of MessageConsumer QueueConsumer and TopicSubscriber for a single Session. However, it does support a single session with both a QueueSender and a TopicSubscriber and vice-versa: QueueConsumer and TopicPublisher, or with multiple MessageProducers of any type. Developing a Basic JMS Application 5-7 javax.jms.TopicSession Javadoc, at http:java.sun.comjavaee5docsapijavaxjmsTopicSession.htm l .

5.2.4 Step 4: Look Up a Destination Queue or Topic