Oracle Fusion Middleware
Oracle WebLogic Server API Reference
11g Release 1 (10.3.5)

Part Number E13941-05

weblogic.jms.extensions
Interface WLSession

All Known Subinterfaces:
WLQueueSession, WLTopicSession

public interface WLSession

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

WLSession provides methods for the following:

WLSession also supports NO_ACKNOWLEDGE and MULTICAST_NO_ACKNOWLEDGE acknowledge modes.

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.
 
Method Summary
 void acknowledge()
          Acknowledge all the messages received by this session.
 void acknowledge(Message message)
          Acknowledge all the messages received by this session.
 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()
          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()
          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.
 void unsubscribe(Topic topic, String name)
          Unsubscribe a durable subscription on a particular topic or distributed topic member.
 

Field Detail

NO_ACKNOWLEDGE

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

MULTICAST_NO_ACKNOWLEDGE

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

KEEP_OLD

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

KEEP_NEW

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
Method Detail

createXMLMessage

XMLMessage createXMLMessage()
                            throws JMSException
Create an XMLMessage. An XMLMessage is used to send a message containing XML content.

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

createXMLMessage

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:
javax.jms.JMSException - if a JMS error occurs.
JMSException
See Also:
WLSession.createXMLMessage()

createXMLMessage

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.

Parameters:
xml - The XML content represented as a DOM Document
Throws:
javax.jms.JMSException - if a JMS error occurs.
JMSException
See Also:
WLSession.createXMLMessage()

setExceptionListener

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:
javax.jms.JMSException - general exception if JMS implementation fails to set the exception listener for this session.
JMSException

getMessagesMaximum

int getMessagesMaximum()
                       throws JMSException
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.
JMSException
See Also:
WLSession.setMessagesMaximum(int)

setMessagesMaximum

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, 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:
javax.jms.JMSException - if a JMS error occurs.
JMSException
See Also:
WLSession.getMessagesMaximum()

getOverrunPolicy

int getOverrunPolicy()
                     throws JMSException
Get overrun policy for multicast sessions.

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

setOverrunPolicy

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:

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.
JMSException
See Also:
WLSession.getOverrunPolicy()

getRedeliveryDelay

long getRedeliveryDelay()
                        throws JMSException
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.
JMSException
See Also:
WLSession.setRedeliveryDelay(long)

setRedeliveryDelay

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:
javax.jms.JMSException - if a JMS error occurs.
JMSException
See Also:
WLSession.getRedeliveryDelay()

acknowledge

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:
javax.jms.JMSException - if a JMS error occurs
JMSException

acknowledge

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

unsubscribe

void unsubscribe(Topic topic,
                 String name)
                 throws JMSException
Unsubscribe a durable subscription on a particular topic or distributed topic member.

Although this API can be used for both Unrestricted and Restricted Client ID cases, if a subscription is created using an Unrestricted Client ID, it can only be unsubscribed using this method from a session that has the same Unrestricted Client ID.

Parameters:
topic - the topic or distributed topic member that the subscription is on
name - the name used to identify this subscription
Throws:
JMSException - if the session fails to unsubscribe to the durable subscription due to some internal error.
InvalidDestinationException - if an invalid subscription name, a null topic, or a distributed topic is specified.

Copyright 1996, 2011, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Oracle Fusion Middleware
Oracle WebLogic Server API Reference
11g Release 1 (10.3.5)

Part Number E13941-05