WebLogic JMS Session Guidelines Session Subclasses Non-Transacted Session

2-10 Programming JMS for Oracle WebLogic Server Connections support concurrent use, enabling multiple threads to access the object simultaneously. The following table describes the Connection subclasses. To learn how to use the Connection class within an application, see Chapter 5, Developing a Basic JMS Application, or the javax.jms.Connection Javadoc at http:java.sun.comjavaee5docsapijavaxjmsConnection.html .

2.4.3 Session

A Session object defines a serial order for the messages produced and consumed, and can create multiple message producers and message consumers. The same thread can be used for producing and consuming messages. If an application wants to have a separate thread for producing and consuming messages, the application should create a separate session for each function. A Session is created by a Connection see Section 2.4.2, Connection .

2.4.3.1 WebLogic JMS Session Guidelines

The JMS 1.1 Specification, at http:java.sun.comproductsjmsdocs.html , allows for a generic session to have a MessageConsumer for any type of Destination object. However, WebLogic JMS does not support having both types of MessageConsumer QueueConsumer and TopicSubscriber for a single session. In addition, having multiple consumers for a single session is not a common practice. The following commonly-used scenarios are supported, however: ■ Using a single session with both a QueueSender and a TopicSubscriber and vice-versa: QueueConsumer and TopicPublisher. ■ Multiple MessageProducers of any type.

2.4.3.2 Session Subclasses

The following table describes the Session subclasses. Note: For this release, you can use the JMS Version 1.1 specification connection objects or you can choose to use the subclasses. Table 2–5 Connection Subclasses Subclass. . . In Messaging Model. . . Is Used to Create. . . QueueConnection PTP QueueSessions, and consists of a connection to a JMS PTP provider created by QueueConnectionFactory. TopicConnection Pubsub TopicSessions, and consists of a connection to a JMS pubsub provider created by TopicConnectionFactory. 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. Understanding WebLogic JMS 2-11 To learn how to use the Session class within an application, see Chapter 5, Developing a Basic JMS Application, or the javax.jms.Session, at http:java.sun.comjavaee5docsapijavaxjmsSession.html , and weblogic.jms.extensions.WLSession javadocs.

2.4.3.3 Non-Transacted Session

In a non-transacted session, the application creating the session selects one of the five acknowledge modes defined in the following table. Table 2–6 Session Subclasses Subclass. . . In Messaging Model. . . Provides a Context for. . . QueueSession PTP Producing and consuming messages for a JMS PTP provider. Created by QueueConnection. TopicSession Pubsub Producing and consuming messages for a JMS pubsub provider. Created by TopicConnection. Table 2–7 Acknowledge Modes Used for Non-Transacted Sessions Acknowledge Mode Description AUTO_ACKNOWLEDGE The Session object acknowledges receipt of a message once the receiving application method has returned from processing it. CLIENT_ACKNOWLEDGE The Session object relies on the application to call an acknowledge method on a received message. Once the method is called, the session acknowledges all messages received since the last acknowledge. This mode allows an application to receive, process, and acknowledge a batch of messages with one call. Note: In the Administration Console, if the Acknowledge Policy attribute on the connection factory is set to Previous, but you want to acknowledge all received messages for a given session, then use the last message to invoke the acknowledge method. For more information on the Acknowledge Policy attribute, see JMS Connection Factory: Configuration: General in the Oracle WebLogic Server Administration Console Help. DUPS_OK_ACKNOWLEDGE The Session object acknowledges receipt of a message once the receiving application method has returned from processing it; duplicate acknowledges are permitted. This mode is most efficient in terms of resource usage. Note: You should avoid using this mode if your application cannot handle duplicate messages. Duplicate messages may be sent if an initial attempt to deliver a message fails. 2-12 Programming JMS for Oracle WebLogic Server

2.4.3.4 Transacted Session