Overview | Package | Class | Use | Tree | Deprecated | Index | Help
|  | BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## BEA WebLogic Server 9.0 API Reference

## weblogic.jms.extensions
Interface WLSession

All Superinterfaces:
  Runnable, Session

All Known Subinterfaces:
  WLQueueSession, WLTopicSession

public interface WLSession
extends Session

A WLSession provides fields and methods that are not supported by javax.jms.Session.

WLSession provides methods for the following:

- Creating XMLMessages
- Defining a Session exception listener
- Setting or displaying the maximum number of messages allowed
- Setting or displaying the multicast session overrun policy that is applied when the message maximum is reached

WLSession also supports NO_ACKNOWLEDGE and MULTICAST_NO_ACKNOWLEDGE acknowledge modes.

See Also:
  `Session`, `QueueSession`, `TopicSession`

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

Field Summary
`static int` | `KEEP_NEW` Multicast overrun policy specifying that the most recent messages should be saved and the oldest ones discarded, as needed, so as not to exceed the message maximum.
`static int` | `KEEP_OLD` Multicast overrun policy specifying that the oldest messages should be saved and the most recent ones discarded, as needed, so as not to exceed the message maximum.
`static int` | `MULTICAST_NO_ACKNOWLEDGE` Multicast mode with no acknowledge required.
`static int` | `NO_ACKNOWLEDGE` No acknowledge is required.

Fields inherited from interface javax.jms.Session
`AUTO_ACKNOWLEDGE, CLIENT_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE, SESSION_TRANSACTED`

Method Summary
`void` | `acknowledge()` Acknowledge all the messages received by this session.
`void` | `acknowledge(Message message)`
`XMLMessage` | `createXMLMessage()` Create an XMLMessage.
`XMLMessage` | `createXMLMessage(Document doc)` Create an initialized XMLMessage from a DOM Document containing XML.
`XMLMessage` | `createXMLMessage(String xml)` Create an initialized XMLMessage from a String containing XML.
`int` | `getMessagesMaximum()` Get the maximum number of messages that may exist for an asynchronous session, which have not yet been passed to the message listener.
`int` | `getOverrunPolicy()` Get overrun policy for multicast sessions.
`long` | `getRedeliveryDelay()` Get the redelivery delay for this session; this defines the delay in milliseconds before rolled back or recovered messages are redelivered.
`void` | `setExceptionListener(ExceptionListener exceptionListener)` Set an exception listener for this session.
`void` | `setMessagesMaximum(int messagesMaximum)` Set the maximum number of messages that may exist for an asynchronous session, which have not yet been passed to the message listener.
`void` | `setOverrunPolicy(int policy)` Set overrun policy for multicast sessions.
`void` | `setRedeliveryDelay(long redeliveryDelay)` Set the redelivery delay for this consumer; this defines the delay in milliseconds before rolled back or recovered messages are redelivered.

Methods inherited from interface javax.jms.Session
`close, commit, createBrowser, createBrowser, createBytesMessage, createConsumer, createConsumer, createConsumer, createDurableSubscriber, createDurableSubscriber, createMapMessage, createMessage, createObjectMessage, createObjectMessage, createProducer, createQueue, createStreamMessage, createTemporaryQueue, createTemporaryTopic, createTextMessage, createTextMessage, createTopic, getAcknowledgeMode, getMessageListener, getTransacted, recover, rollback, run, setMessageListener, unsubscribe`

Field Detail

### KEEP_NEW

    public static final int KEEP_NEW

  Multicast overrun policy specifying that the most recent messages should be saved and the oldest ones discarded, as needed, so as not to exceed the message maximum.

  See Also:
    Constant Field Values

### KEEP_OLD

    public static final int KEEP_OLD

  Multicast overrun policy specifying that the oldest messages should be saved and the most recent ones discarded, as needed, so as not to exceed the message maximum.

  See Also:
    Constant Field Values

### MULTICAST_NO_ACKNOWLEDGE

    public static final int MULTICAST_NO_ACKNOWLEDGE

  Multicast mode with no acknowledge required.

  Messages sent to a MULTICAST_NO_ACKNOWLEDGE session share the same characteristics as NO_ACKNOWLEDGE mode.

  This mode is supported for applications that want to support multicasting, and that do not require the quality of service provided by session acknowledge.

  You should avoid using this mode if your application is unable to handle duplicate messages, which can occur if a message fails to be delivered during the first attempt.

  See Also:
    Constant Field Values

### NO_ACKNOWLEDGE

    public static final int NO_ACKNOWLEDGE

  No acknowledge is required.

  Messages sent to a NO_ACKNOWLEDGE session are immediately deleted from the server. Messages received in this mode are not recovered, and as a result messages may be lost and/or a duplicate message may be delivered if an initial attempt to deliver a message fails.

  This mode is supported for applications that do not require the quality of service provided by session acknowledge, and that do not want to incur the associated overhead.

  You should avoid using this mode if your application cannot handle duplicate messages.

  See Also:
    Constant Field Values

Method Detail

### acknowledge

    public void acknowledge()
                     throws JMSException

  Acknowledge all the messages received by this session. This is similar to the method Message.acknowledge(), except it can be called from the session. This is for users who set their connection factory AcknowledgePolicy to "Previous" so they may acknowledge "All" messages received by this session.

  Throws:
    `JMSException` - if a JMS error occurs

### acknowledge

    public void acknowledge(Message message)
                     throws JMSException

  Throws:
    `JMSException`

### createXMLMessage

    public XMLMessage createXMLMessage()
                                throws JMSException

  Create an XMLMessage. An XMLMessage is used to send a message containing XML content.

  Throws:
    `JMSException` - if a JMS error occurs.
  See Also:
    `createXMLMessage(String)`

### createXMLMessage

    public XMLMessage createXMLMessage(Document doc)
                                throws JMSException

  Create an initialized XMLMessage from a DOM Document containing XML. An XMLMessage is used to send a message containing XML content.

  Throws:
    `JMSException` - if a JMS error occurs.
  See Also:
    `createXMLMessage()`

### createXMLMessage

    public XMLMessage createXMLMessage(String xml)
                                throws JMSException

  Create an initialized XMLMessage from a String containing XML. An XMLMessage is used to send a message containing XML content.

  Parameters:
    `xml` - The XML content represented as a string
  Throws:
    `JMSException` - if a JMS error occurs.
  See Also:
    `createXMLMessage()`

### getMessagesMaximum

    public int getMessagesMaximum()
                           throws JMSException

  Get the maximum number of messages that may exist for an asynchronous session, which have not yet been passed to the message listener.

  A value of -1 indicates that there is no limit on the number of messages. In this case, however, the limit is set to the amount of remaining virtual memory.

  Returns:
    The message maximum set for this session.
  Throws:
    `JMSException` - if a JMS error occurs.
  See Also:
    `setMessagesMaximum(int)`

### getOverrunPolicy

    public int getOverrunPolicy()
                         throws JMSException

  Get overrun policy for multicast sessions.

  Returns:
    The overrun policy set for this session.
  Throws:
    `JMSException` - general exception if the JMS implementation fails to set the exception listener for this session.
  See Also:
    `setOverrunPolicy(int)`

### getRedeliveryDelay

    public long getRedeliveryDelay()
                            throws JMSException

  Get the redelivery delay for this session; this defines the delay in milliseconds before rolled back or recovered messages are redelivered. The default redelivery delay is obtained from the configuration of the connection factory used to create this consumer. If the time to deliver on the session is explicitly set to -1 via WLSession.setRedliveryDelay(), then this method will return the connection factory setting; if it is set to any other value, then this method will return that value.

  Returns:
    Redelivery delay for this session.
  Throws:
    `JMSException` - if a JMS error occurs.
  See Also:
    `setRedeliveryDelay(long)`

### setExceptionListener

    public void setExceptionListener(ExceptionListener exceptionListener)
                              throws JMSException

  Set an exception listener for this session.

  If a JMS provider detects a serious problem with a session, it will inform the session's exception listener, if one has been registered. It informs the exception listener by calling the listener's onException() method and passing a JMSException describing the problem.

  The exception listener allows a client to be asynchronously notified of a problem. Some sessions only consume messages, so they would have no other way to learn that the session has failed.

  A session serializes execution of its exception listener.

  A JMS provider should attempt to resolve session problems prior to notifying the client.

  Parameters:
    `exceptionListener` - The exception listener.
  Throws:
    `JMSException` - general exception if JMS implementation fails to set the exception listener for this session.

### setMessagesMaximum

    public void setMessagesMaximum(int messagesMaximum)
                            throws JMSException

  Set the maximum number of messages that may exist for an asynchronous session, which have not yet been passed to the message listener.

  A value of -1 indicates that there is no limit on the number of messages. In this case, however, the limit is set to the amount of remaining virtual memory.

  When the number of messages reaches the specified value, the following occurs:

  - For multicast sessions, new messages are discarded according to the specified overrun policy, and a DataOverrunException is thrown.
  - For non-multicast sessions, new messages are flow-controlled, or retained on the server until the application can accomodate the messages.

  For multicast sessions, when a connection is stopped, messages will continue to be accumulated, but only until the specified maximum value is reached. Once this value is reached, messages will be discarded based on the overrun policy.

  Parameters:
    `messagesMaximum` - The maximum number of messages allowed, valid values are -1, and 1 through 2^63-1 (default is 10).
  Throws:
    `JMSException` - if a JMS error occurs.
  See Also:
    `getMessagesMaximum()`

### setOverrunPolicy

    public void setOverrunPolicy(int policy)
                          throws JMSException

  Set overrun policy for multicast sessions.

  When the number of messages reaches the message maximum, messages are discarded based on the specified policy, as follows:

  - If set to KeepNew, the most recent messages are given priority over the oldest messages, and the oldest messages are discarded, as needed.
  - If set to KeepOld, the oldest messages are given priority over the most recent messages, and the most recent messages are discarded, as needed.

  Message age is defined by the order of receipt, not by the JMSTimestamp value.

  Parameters:
    `policy` - The overrun policy.
  Throws:
    `JMSException` - general exception if JMS implementation fails to set the exception listener for this session.
  See Also:
    `getOverrunPolicy()`

### setRedeliveryDelay

    public void setRedeliveryDelay(long redeliveryDelay)
                            throws JMSException

  Set the redelivery delay for this consumer; this defines the delay in milliseconds before rolled back or recovered messages are redelivered. The default redeliver delay is 0; this default may be changed by modifying the configuration of the connection factory used to create this consumer. Setting the redelivery delay to -1 forces the use of this default. Setting it to anything greater than or equal to 0 overrides this default. If this method is not called, then the connection factory setting is used.

  Performance Note: If any consumers for remote destinations already exist on this session, calling this method results in a network call(s) in order to disseminate the changed delay value to them.

  Parameters:
    `redeliveryDelay` - Redelivery delay for this session.
  Throws:
    `JMSException` - if a JMS error occurs.
  See Also:
    `#getTimeToDeliver()`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Documentation is available at http://e-docs.bea.com/wls/docs90 Copyright 2005 BEA Systems Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD