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

## weblogic.jms.extensions
Interface WLSession

All Known Subinterfaces:
  WLQueueSession, WLTopicSession

public interface WLSession
extends javax.jms.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.

Author:
  Copyright (c) 2000 by BEA Systems, Inc., All Rights Reserved.
See Also:
  `Session`, `QueueSession`, `TopicSession`

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 class javax.jms.Session
`AUTO_ACKNOWLEDGE, CLIENT_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE`

Method Summary
`void` | `acknowledge()` Acknowledge all the messages received by this session.
`XMLMessage` | `createXMLMessage()` Create an XMLMessage.
`XMLMessage` | `createXMLMessage(java.lang.String string)` Create an initialized XMLMessage.
`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(javax.jms.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, createBytesMessage, createMapMessage, createMessage, createObjectMessage, createObjectMessage, createStreamMessage, createTextMessage, createTextMessage, getMessageListener, getTransacted, recover, rollback, run, setMessageListener`

Field Detail

### 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.

### 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.

### 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.

### 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.

Method Detail

### createXMLMessage

    public XMLMessage createXMLMessage()
                                throws javax.jms.JMSException

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

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

### createXMLMessage

    public XMLMessage createXMLMessage(java.lang.String string)
                                throws javax.jms.JMSException

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

  Parameters:
    `string` - Tthe string used to initialize the message.
  Throws:
    javax.jms.JMSException - if a JMS error occurs.
  See Also:
    `createXMLMessage()`

### setExceptionListener

    public void setExceptionListener(javax.jms.ExceptionListener exceptionListener)
                              throws javax.jms.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:
    javax.jms.JMSException - general exception if JMS implementation fails to set the exception listener for this session.

### getMessagesMaximum

    public int getMessagesMaximum()
                           throws javax.jms.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:
    javax.jms.JMSException - if a JMS error occurs.
  See Also:
    `setMessagesMaximum(int)`

### setMessagesMaximum

    public void setMessagesMaximum(int messagesMaximum)
                            throws javax.jms.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 delivered, 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:
    javax.jms.JMSException - if a JMS error occurs.
  See Also:
    `getMessagesMaximum()`

### getOverrunPolicy

    public int getOverrunPolicy()
                         throws javax.jms.JMSException

  Get overrun policy for multicast sessions.

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

### setOverrunPolicy

    public void setOverrunPolicy(int policy)
                          throws javax.jms.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:
    javax.jms.JMSException - general exception if JMS implementation fails to set the exception listener for this session.
  See Also:
    `getOverrunPolicy()`

### getRedeliveryDelay

    public long getRedeliveryDelay()
                            throws javax.jms.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:
    javax.jms.JMSException - if a JMS error occurs.
  See Also:
    `setRedeliveryDelay(long)`

### setRedeliveryDelay

    public void setRedeliveryDelay(long redeliveryDelay)
                            throws javax.jms.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:
    javax.jms.JMSException - if a JMS error occurs.
  See Also:
    `#getTimeToDeliver()`

### acknowledge

    public void acknowledge()
                     throws javax.jms.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:
    javax.jms.JMSException - if a JMS error occurs

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Documentation is available at http://e-docs.bea.com/wls/docs70
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004 BEA Systems, Inc. All Rights Reserved.
WebLogic Server 7.0 API Reference