Interface ISession
Represents a single unit of work on an IConnection.
So the ISession can be used to perform transactional receive and sends
Inherited Members
System.IDisposable.Dispose()
Assembly: Apache.NMS.dll
Syntax
public interface ISession : IDisposable
Properties
AcknowledgementMode
Declaration
AcknowledgementMode AcknowledgementMode { get; }
Property Value
A Delegate that is called each time a Message is dispatched to allow the client to do
any necessary transformations on the received message before it is delivered.
The Session instance sets the delegate on each Consumer it creates.
Declaration
ConsumerTransformerDelegate ConsumerTransformer { get; set; }
Property Value
A delegate that is called each time a Message is sent from this Producer which allows
the application to perform any needed transformations on the Message before it is sent.
The Session instance sets the delegate on each Producer it creates.
Declaration
ProducerTransformerDelegate ProducerTransformer { get; set; }
Property Value
RequestTimeout
Declaration
TimeSpan RequestTimeout { get; set; }
Property Value
Type |
Description |
System.TimeSpan |
|
Transacted
Declaration
Property Value
Type |
Description |
System.Boolean |
|
Methods
Close()
Closes the session. There is no need to close the producers and consumers
of a closed session.
Declaration
Commit()
If this is a transactional session then commit all message
send and acknowledgements for producers and consumers in this session
Declaration
CreateBrowser(IQueue)
Creates a QueueBrowser object to peek at the messages on the specified queue.
Declaration
IQueueBrowser CreateBrowser(IQueue queue)
Parameters
Returns
Exceptions
Type |
Condition |
System.NotSupportedException |
If the Prodiver does not support creation of Queue Browsers.
|
CreateBrowser(IQueue, String)
Creates a QueueBrowser object to peek at the messages on the specified queue
using a message selector.
Declaration
IQueueBrowser CreateBrowser(IQueue queue, string selector)
Parameters
Type |
Name |
Description |
IQueue |
queue |
A IQueue
|
System.String |
selector |
A System.String
|
Returns
Exceptions
Type |
Condition |
System.NotSupportedException |
If the Prodiver does not support creation of Queue Browsers.
|
CreateBytesMessage()
Creates a new binary message
Declaration
IBytesMessage CreateBytesMessage()
Returns
CreateBytesMessage(Byte[])
Creates a new binary message with the given body
Declaration
IBytesMessage CreateBytesMessage(byte[] body)
Parameters
Type |
Name |
Description |
System.Byte[] |
body |
|
Returns
CreateConsumer(IDestination)
Creates a consumer of messages on a given destination
Declaration
IMessageConsumer CreateConsumer(IDestination destination)
Parameters
Returns
CreateConsumer(IDestination, String)
Creates a consumer of messages on a given destination with a selector
Declaration
IMessageConsumer CreateConsumer(IDestination destination, string selector)
Parameters
Type |
Name |
Description |
IDestination |
destination |
|
System.String |
selector |
|
Returns
CreateConsumer(IDestination, String, Boolean)
Creates a consumer of messages on a given destination with a selector
Declaration
IMessageConsumer CreateConsumer(IDestination destination, string selector, bool noLocal)
Parameters
Type |
Name |
Description |
IDestination |
destination |
|
System.String |
selector |
|
System.Boolean |
noLocal |
|
Returns
CreateDurableConsumer(ITopic, String, String, Boolean)
Creates a named durable consumer of messages on a given destination with a selector
Declaration
IMessageConsumer CreateDurableConsumer(ITopic destination, string name, string selector, bool noLocal)
Parameters
Type |
Name |
Description |
ITopic |
destination |
|
System.String |
name |
|
System.String |
selector |
|
System.Boolean |
noLocal |
|
Returns
CreateMapMessage()
Creates a new Map message which contains primitive key and value pairs
Declaration
IMapMessage CreateMapMessage()
Returns
CreateMessage()
Creates a new message with an empty body
Declaration
Returns
CreateObjectMessage(Object)
Creates a new Object message containing the given .NET object as the body
Declaration
IObjectMessage CreateObjectMessage(object body)
Parameters
Type |
Name |
Description |
System.Object |
body |
|
Returns
CreateProducer()
Creates a producer of messages
Declaration
IMessageProducer CreateProducer()
Returns
CreateProducer(IDestination)
Creates a producer of messages on a given destination
Declaration
IMessageProducer CreateProducer(IDestination destination)
Parameters
Returns
CreateStreamMessage()
Creates a new stream message
Declaration
IStreamMessage CreateStreamMessage()
Returns
CreateTemporaryQueue()
Creates a temporary queue
Declaration
ITemporaryQueue CreateTemporaryQueue()
Returns
CreateTemporaryTopic()
Creates a temporary topic
Declaration
ITemporaryTopic CreateTemporaryTopic()
Returns
CreateTextMessage()
Creates a new text message with an empty body
Declaration
ITextMessage CreateTextMessage()
Returns
CreateTextMessage(String)
Creates a new text message with the given body
Declaration
ITextMessage CreateTextMessage(string text)
Parameters
Type |
Name |
Description |
System.String |
text |
|
Returns
DeleteDestination(IDestination)
Delete a destination (Queue, Topic, Temp Queue, Temp Topic).
Declaration
void DeleteDestination(IDestination destination)
Parameters
DeleteDurableConsumer(String)
Deletes a durable consumer created with CreateDurableConsumer().
Declaration
void DeleteDurableConsumer(string name)
Parameters
Type |
Name |
Description |
System.String |
name |
Name of the durable consumer
|
GetQueue(String)
Returns the queue for the given name
Declaration
IQueue GetQueue(string name)
Parameters
Type |
Name |
Description |
System.String |
name |
|
Returns
GetTopic(String)
Returns the topic for the given name
Declaration
ITopic GetTopic(string name)
Parameters
Type |
Name |
Description |
System.String |
name |
|
Returns
Recover()
Stops all Message delivery in this session and restarts it again
with the oldest unabcknowledged message. Messages that were delivered
but not acknowledge should have their redelivered property set.
This is an optional method that may not by implemented by all NMS
providers, if not implemented an Exception will be thrown.
Message redelivery is not requried to be performed in the original
order. It is not valid to call this method on a Transacted Session.
Declaration
Rollback()
If this is a transactional session then rollback all message
send and acknowledgements for producers and consumers in this session
Declaration
Events
TransactionCommittedListener
Declaration
event SessionTxEventDelegate TransactionCommittedListener
Event Type
TransactionRolledBackListener
Declaration
event SessionTxEventDelegate TransactionRolledBackListener
Event Type
TransactionStartedListener
Declaration
event SessionTxEventDelegate TransactionStartedListener
Event Type