WebLogic Messaging API Class Library |

# ISession Methods

The methods of the ISession interface are listed below. For a complete list of ISession interface members, see the ISession Members topic.

#### Public Instance Methods

Close | Closes the session. Since JMS allocates resources on behalf of a session outside the JVM, clients should Close the resources when they are not needed. Relying on garbage collection to eventually reclaim these resources may not be timely enough. There is no need to Close the producers and consumers of a closed session. Similarly, there is no need to Close a session if its parent connection is closed or if its parent context has been closed with CloseAll. This call will block until a `Receive` call or message listener in progress has completed. A blocked message consumer `Receive` call returns `null` when this session is closed. Closing a transacted session rolls back the transaction in progress. This method is the only `ISession` method that can be called concurrently. Invoking any other `ISession` method on a closed session throws a `MessageException.IllegalStateException`. Closing a closed session does not not throw an exception.
Commit | In a transacted session, this method commits all messages sent or received in this transaction and releases any locks currently held. If the commit succeeds, any messages sent during the transaction become visible to consumers, while any messages received during the transaction are deleted so as to prevent redelivery. A transaction is completed using either its session's `Commit` method or its session's `Rollback` method. The completion of a session's current transaction automatically begins the next. The result is that a transacted session always has a current transaction within which its work is done. If a `Commit` call throws an ambiguous exception, then the result of the transaction is ambiguous: either all operations within the transaction succeeded, or all operations rolled back.
CreateBytesMessage | Creates an `IBytesMessage` object. An `IBytesMessage` object is used to send a message containing a stream of uninterpreted bytes.
CreateConsumer | Overloaded. Creates an `IMessageConsumer` for the specified destination. Since `IQueue` and `ITopic` both inherit from `IDestination`, they can be used in the destination parameter to create an `IMessageConsumer`.
CreateDurableSubscriber | Overloaded. Creates a durable subscriber to the specified topic. If a client needs to receive all the messages published on a topic, including the ones published while the subscriber is inactive, it uses a durable `IMessageConsumer`. The JMS server retains a record of this durable subscription and insures that all messages from the topic's publishers are retained until they are acknowledged by this durable subscriber or they have expired.Sessions with durable subscribers must always provide the same client identifier. In addition, each client must specify a name that uniquely identifies (within client identifier) each durable subscription it creates. Only one session at a time can have an `IMessageConsumer` for a particular durable subscription. A client can change an existing durable subscription by creating a durable `IMessageConsumer` with the same name and a new topic and/or message selector. Changing a durable subscriber is equivalent to unsubscribing (deleting) the old one and creating a new one. In some cases, a connection may both publish and subscribe to a topic. The subscriber `NoLocal` attribute allows a subscriber to inhibit the delivery of messages published by its own connection. The default value for this attribute is false.
CreateMapMessage | Creates an `IMapMessage` object. An `IMapMessage` object is used to send a self-defining set of name-value pairs, where names are `String` objects and values are primitive values in the Java programming language.
CreateMessage | Creates an `IMessage` object. The `IMessage` interface is the root interface of all JMS messages. An `IMessage` object holds all the standard message header information. It can be sent when a message containing only header information is sufficient.
CreateObjectMessage | Overloaded. Creates an `IObjectMessage` object. An `IObjectMessage` is used to send an Object that either specifies a `System.Serializable` attribute or implements the `System.Runtime.Serialization.ISerializable` interface.
CreateProducer | Creates an `IMessageProducer` to send messages to the specified destination. A client uses an `IMessageProducer` object to send messages to a destination. Since `IQueue` and `ITopic` both inherit from `IDestination`, they can be used in the destination parameter to create a `IMessageProducer` object.
CreateQueue | Creates a queue identity given a `IQueue` name. This facility is provided for the rare cases where clients need to dynamically manipulate queue identity. It allows the creation of a queue identity with a provider-specific name. Clients that depend on this ability are not portable. Note that this method is not for creating the physical queue. The physical creation of queues is an administrative task and is not initiated by the JMS API.
CreateStreamMessage | Creates an `IStreamMessage` object. A n `IStreamMessage` object is used to send a self-defining stream of primitive values.
CreateTextMessage | Overloaded. Creates an `ITextMessage` object. An `ITextMessage` object is used to send a message containing a `String` object.
CreateTopic | Creates a topic identity given a `ITopic` name. This facility is provided for the rare cases where clients need to dynamically manipulate topic identity. This allows the creation of a topic identity with a provider-specific name. Clients that depend on this ability are not portable. Note that this method is not for creating the physical topic. The physical creation of topics is an administrative task and is not initiated by the JMS API.
Recover | In a non-transacted session, this method forces redelivery of unackowledged messages. All consumers receive delivered messages in a serial order. Acknowledging a received message automatically acknowledges all messages that have been delivered to the client. This method causes a session to take the following actions: Stop message delivery Mark all messages that might have been delivered but not acknowledged as "redelivered" Restart the delivery sequence including all unacknowledged messages that had been previously delivered. Redelivered messages do not have to be delivered in exactly their original delivery order and may be delivered to different sessions (see the WebLogic .NET JMS developer guide documentation for information on ordered redelivery using the unit-of-order feature).
Rollback | In a transacted session, this method rolls back any messages done in this transaction and releases any locks currently held. Messages produced under the transaction are deleted, while messages received under the transaction are released for redelivery.
Unsubscribe | Unsubscribes a durable subscription that has been created by a client. This method deletes the state being maintained on behalf of the subscriber by the JMS system. It is erroneous for a client to Delete a durable subscription while there is an active `IMessageConsumer` for the subscription, or while a consumed message is part of a pending transaction or has not been acknowledged in the session.

#### See Also

ISession Interface | WebLogic.Messaging Namespace | IConnection.CreateSession | IMessage