Show / Hide Table of Contents

# Class Session

Default provider of ISession

##### Inheritance

System.Object
Session
NetTxSession

##### Implements

Apache.NMS.ISession
System.IDisposable
IDispatcher

##### Inherited Members

System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()

###### Namespace: Apache.NMS.ActiveMQ

###### Assembly: Apache.NMS.ActiveMQ.dll

##### Syntax

    public class Session : ISession, IDisposable, IDispatcher

### Constructors

| Improve this Doc View Source

#### Session(Connection, SessionId, AcknowledgementMode)

##### Declaration

    public Session(Connection connection, SessionId sessionId, AcknowledgementMode acknowledgementMode)

##### Parameters

Type | Name | Description
--- | --- | ---
Connection | connection |
SessionId | sessionId |
Apache.NMS.AcknowledgementMode | acknowledgementMode |

### Fields

| Improve this Doc View Source

#### clearInProgress

##### Declaration

    protected Atomic<bool> clearInProgress

##### Field Value

Type | Description
--- | ---
Apache.NMS.Util.Atomic<System.Boolean> |

| Improve this Doc View Source

#### closed

##### Declaration

    protected bool closed

##### Field Value

Type | Description
--- | ---
System.Boolean |

| Improve this Doc View Source

#### closing

##### Declaration

    protected bool closing

##### Field Value

Type | Description
--- | ---
System.Boolean |

| Improve this Doc View Source

#### disposed

##### Declaration

    protected bool disposed

##### Field Value

Type | Description
--- | ---
System.Boolean |

### Properties

| Improve this Doc View Source

#### AcknowledgementMode

##### Declaration

    public virtual AcknowledgementMode AcknowledgementMode { get; }

##### Property Value

Type | Description
--- | ---
Apache.NMS.AcknowledgementMode |

| Improve this Doc View Source

#### CloseStopTimeout

##### Declaration

    public long CloseStopTimeout { get; set; }

##### Property Value

Type | Description
--- | ---
System.Int64 |

| Improve this Doc View Source

#### Connection

##### Declaration

    public Connection Connection { get; }

##### Property Value

Type | Description
--- | ---
Connection |

| Improve this Doc View Source

#### ConsumerTransformer

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

    public ConsumerTransformerDelegate ConsumerTransformer { get; set; }

##### Property Value

Type | Description
--- | ---
Apache.NMS.ConsumerTransformerDelegate |

| Improve this Doc View Source

#### DispatchAsync

Enables or disables whether asynchronous dispatch should be used by the broker

##### Declaration

    public bool DispatchAsync { get; set; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

| Improve this Doc View Source

#### DisposeStopTimeout

##### Declaration

    public long DisposeStopTimeout { get; set; }

##### Property Value

Type | Description
--- | ---
System.Int64 |

| Improve this Doc View Source

#### Exclusive

Enables or disables exclusive consumers when using queues. An exclusive consumer means only one instance of a consumer is allowed to process messages on a queue to preserve order

##### Declaration

    public bool Exclusive { get; set; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

| Improve this Doc View Source

#### Executor

##### Declaration

    public SessionExecutor Executor { get; }

##### Property Value

Type | Description
--- | ---
SessionExecutor |

| Improve this Doc View Source

#### IsAutoAcknowledge

##### Declaration

    public virtual bool IsAutoAcknowledge { get; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

| Improve this Doc View Source

#### IsClientAcknowledge

##### Declaration

    public virtual bool IsClientAcknowledge { get; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

| Improve this Doc View Source

#### IsDupsOkAcknowledge

##### Declaration

    public virtual bool IsDupsOkAcknowledge { get; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

| Improve this Doc View Source

#### IsIndividualAcknowledge

##### Declaration

    public virtual bool IsIndividualAcknowledge { get; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

| Improve this Doc View Source

#### IsTransacted

##### Declaration

    public virtual bool IsTransacted { get; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

| Improve this Doc View Source

#### MaximumPendingMessageLimit

Sets the maximum number of messages to keep around per consumer in addition to the prefetch window for non-durable topics until messages will start to be evicted for slow consumers. Must be > 0 to enable this feature

##### Declaration

    public int MaximumPendingMessageLimit { set; }

##### Property Value

Type | Description
--- | ---
System.Int32 |

| Improve this Doc View Source

#### NextDeliveryId

##### Declaration

    public long NextDeliveryId { get; }

##### Property Value

Type | Description
--- | ---
System.Int64 |

| Improve this Doc View Source

#### Priority

Sets the default consumer priority for consumers

##### Declaration

    public byte Priority { get; set; }

##### Property Value

Type | Description
--- | ---
System.Byte |

| Improve this Doc View Source

#### ProducerTransformer

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

    public ProducerTransformerDelegate ProducerTransformer { get; set; }

##### Property Value

Type | Description
--- | ---
Apache.NMS.ProducerTransformerDelegate |

| Improve this Doc View Source

#### RequestTimeout

##### Declaration

    public TimeSpan RequestTimeout { get; set; }

##### Property Value

Type | Description
--- | ---
System.TimeSpan |

| Improve this Doc View Source

#### Retroactive

Enables or disables retroactive mode for consumers; i.e. do they go back in time or not?

##### Declaration

    public bool Retroactive { get; set; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

| Improve this Doc View Source

#### SessionId

##### Declaration

    public SessionId SessionId { get; }

##### Property Value

Type | Description
--- | ---
SessionId |

| Improve this Doc View Source

#### Started

##### Declaration

    public bool Started { get; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

| Improve this Doc View Source

#### Transacted

##### Declaration

    public bool Transacted { get; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

| Improve this Doc View Source

#### TransactionContext

##### Declaration

    public TransactionContext TransactionContext { get; }

##### Property Value

Type | Description
--- | ---
TransactionContext |

### Methods

| Improve this Doc View Source

#### AddConsumer(MessageConsumer)

##### Declaration

    public void AddConsumer(MessageConsumer consumer)

##### Parameters

Type | Name | Description
--- | --- | ---
MessageConsumer | consumer |

| Improve this Doc View Source

#### AddProducer(MessageProducer)

##### Declaration

    public void AddProducer(MessageProducer producer)

##### Parameters

Type | Name | Description
--- | --- | ---
MessageProducer | producer |

| Improve this Doc View Source

#### Close()

##### Declaration

    public virtual void Close()

| Improve this Doc View Source

#### Commit()

##### Declaration

    public void Commit()

| Improve this Doc View Source

#### CreateBrowser(IQueue)

##### Declaration

    public IQueueBrowser CreateBrowser(IQueue queue)

##### Parameters

Type | Name | Description
--- | --- | ---
Apache.NMS.IQueue | queue |

##### Returns

Type | Description
--- | ---
Apache.NMS.IQueueBrowser |

| Improve this Doc View Source

#### CreateBrowser(IQueue, String)

##### Declaration

    public IQueueBrowser CreateBrowser(IQueue queue, string selector)

##### Parameters

Type | Name | Description
--- | --- | ---
Apache.NMS.IQueue | queue |
System.String | selector |

##### Returns

Type | Description
--- | ---
Apache.NMS.IQueueBrowser |

| Improve this Doc View Source

#### CreateBytesMessage()

##### Declaration

    public IBytesMessage CreateBytesMessage()

##### Returns

Type | Description
--- | ---
Apache.NMS.IBytesMessage |

| Improve this Doc View Source

#### CreateBytesMessage(Byte[])

##### Declaration

    public IBytesMessage CreateBytesMessage(byte[] body)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Byte[] | body |

##### Returns

Type | Description
--- | ---
Apache.NMS.IBytesMessage |

| Improve this Doc View Source

#### CreateConsumer(IDestination)

##### Declaration

    public IMessageConsumer CreateConsumer(IDestination destination)

##### Parameters

Type | Name | Description
--- | --- | ---
Apache.NMS.IDestination | destination |

##### Returns

Type | Description
--- | ---
Apache.NMS.IMessageConsumer |

| Improve this Doc View Source

#### CreateConsumer(IDestination, String)

##### Declaration

    public IMessageConsumer CreateConsumer(IDestination destination, string selector)

##### Parameters

Type | Name | Description
--- | --- | ---
Apache.NMS.IDestination | destination |
System.String | selector |

##### Returns

Type | Description
--- | ---
Apache.NMS.IMessageConsumer |

| Improve this Doc View Source

#### CreateConsumer(IDestination, String, Boolean)

##### Declaration

    public IMessageConsumer CreateConsumer(IDestination destination, string selector, bool noLocal)

##### Parameters

Type | Name | Description
--- | --- | ---
Apache.NMS.IDestination | destination |
System.String | selector |
System.Boolean | noLocal |

##### Returns

Type | Description
--- | ---
Apache.NMS.IMessageConsumer |

| Improve this Doc View Source

#### CreateDurableConsumer(ITopic, String, String, Boolean)

##### Declaration

    public IMessageConsumer CreateDurableConsumer(ITopic destination, string name, string selector, bool noLocal)

##### Parameters

Type | Name | Description
--- | --- | ---
Apache.NMS.ITopic | destination |
System.String | name |
System.String | selector |
System.Boolean | noLocal |

##### Returns

Type | Description
--- | ---
Apache.NMS.IMessageConsumer |

| Improve this Doc View Source

#### CreateMapMessage()

##### Declaration

    public IMapMessage CreateMapMessage()

##### Returns

Type | Description
--- | ---
Apache.NMS.IMapMessage |

| Improve this Doc View Source

#### CreateMessage()

##### Declaration

    public IMessage CreateMessage()

##### Returns

Type | Description
--- | ---
Apache.NMS.IMessage |

| Improve this Doc View Source

#### CreateObjectMessage(Object)

##### Declaration

    public IObjectMessage CreateObjectMessage(object body)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Object | body |

##### Returns

Type | Description
--- | ---
Apache.NMS.IObjectMessage |

| Improve this Doc View Source

#### CreateProducer()

##### Declaration

    public IMessageProducer CreateProducer()

##### Returns

Type | Description
--- | ---
Apache.NMS.IMessageProducer |

| Improve this Doc View Source

#### CreateProducer(IDestination)

##### Declaration

    public IMessageProducer CreateProducer(IDestination destination)

##### Parameters

Type | Name | Description
--- | --- | ---
Apache.NMS.IDestination | destination |

##### Returns

Type | Description
--- | ---
Apache.NMS.IMessageProducer |

| Improve this Doc View Source

#### CreateStreamMessage()

##### Declaration

    public IStreamMessage CreateStreamMessage()

##### Returns

Type | Description
--- | ---
Apache.NMS.IStreamMessage |

| Improve this Doc View Source

#### CreateTemporaryQueue()

##### Declaration

    public ITemporaryQueue CreateTemporaryQueue()

##### Returns

Type | Description
--- | ---
Apache.NMS.ITemporaryQueue |

| Improve this Doc View Source

#### CreateTemporaryTopic()

##### Declaration

    public ITemporaryTopic CreateTemporaryTopic()

##### Returns

Type | Description
--- | ---
Apache.NMS.ITemporaryTopic |

| Improve this Doc View Source

#### CreateTextMessage()

##### Declaration

    public ITextMessage CreateTextMessage()

##### Returns

Type | Description
--- | ---
Apache.NMS.ITextMessage |

| Improve this Doc View Source

#### CreateTextMessage(String)

##### Declaration

    public ITextMessage CreateTextMessage(string text)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | text |

##### Returns

Type | Description
--- | ---
Apache.NMS.ITextMessage |

| Improve this Doc View Source

#### CreateTransactionContext()

##### Declaration

    protected virtual TransactionContext CreateTransactionContext()

##### Returns

Type | Description
--- | ---
TransactionContext |

| Improve this Doc View Source

#### DeleteDestination(IDestination)

Delete a destination (Queue, Topic, Temp Queue, Temp Topic).

##### Declaration

    public void DeleteDestination(IDestination destination)

##### Parameters

Type | Name | Description
--- | --- | ---
Apache.NMS.IDestination | destination |

| Improve this Doc View Source

#### DeleteDurableConsumer(String)

##### Declaration

    public void DeleteDurableConsumer(string name)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name |

| Improve this Doc View Source

#### Dispatch(MessageDispatch)

##### Declaration

    public void Dispatch(MessageDispatch dispatch)

##### Parameters

Type | Name | Description
--- | --- | ---
MessageDispatch | dispatch |

| Improve this Doc View Source

#### Dispose()

##### Declaration

    public void Dispose()

| Improve this Doc View Source

#### Dispose(Boolean)

##### Declaration

    protected void Dispose(bool disposing)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Boolean | disposing |

| Improve this Doc View Source

#### Finalize()

##### Declaration

    protected void Finalize()

| Improve this Doc View Source

#### GetNextConsumerId()

##### Declaration

    public ConsumerId GetNextConsumerId()

##### Returns

Type | Description
--- | ---
ConsumerId |

| Improve this Doc View Source

#### GetNextProducerId()

##### Declaration

    public ProducerId GetNextProducerId()

##### Returns

Type | Description
--- | ---
ProducerId |

| Improve this Doc View Source

#### GetQueue(String)

##### Declaration

    public IQueue GetQueue(string name)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name |

##### Returns

Type | Description
--- | ---
Apache.NMS.IQueue |

| Improve this Doc View Source

#### GetTopic(String)

##### Declaration

    public ITopic GetTopic(string name)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name |

##### Returns

Type | Description
--- | ---
Apache.NMS.ITopic |

| Improve this Doc View Source

#### Recover()

##### Declaration

    public void Recover()

| Improve this Doc View Source

#### RemoveConsumer(MessageConsumer)

##### Declaration

    public void RemoveConsumer(MessageConsumer consumer)

##### Parameters

Type | Name | Description
--- | --- | ---
MessageConsumer | consumer |

| Improve this Doc View Source

#### RemoveProducer(ProducerId)

##### Declaration

    public void RemoveProducer(ProducerId objectId)

##### Parameters

Type | Name | Description
--- | --- | ---
ProducerId | objectId |

| Improve this Doc View Source

#### Rollback()

##### Declaration

    public void Rollback()

| Improve this Doc View Source

#### Start()

##### Declaration

    public void Start()

| Improve this Doc View Source

#### Stop()

##### Declaration

    public void Stop()

### Events

| Improve this Doc View Source

#### TransactionCommittedListener

##### Declaration

    public event SessionTxEventDelegate TransactionCommittedListener

##### Event Type

Type | Description
--- | ---
Apache.NMS.SessionTxEventDelegate |

| Improve this Doc View Source

#### TransactionRolledBackListener

##### Declaration

    public event SessionTxEventDelegate TransactionRolledBackListener

##### Event Type

Type | Description
--- | ---
Apache.NMS.SessionTxEventDelegate |

| Improve this Doc View Source

#### TransactionStartedListener

##### Declaration

    public event SessionTxEventDelegate TransactionStartedListener

##### Event Type

Type | Description
--- | ---
Apache.NMS.SessionTxEventDelegate |

### Implements

Apache.NMS.ISession
System.IDisposable
IDispatcher