C# Class Spring.Messaging.Nms.Connections.CachingConnectionFactory

SingleConnectionFactory subclass that adds Session, MessageProducer, and MessageConsumer caching. This ConnectionFactory also switches the ReconnectOnException property to true by default, allowing for automatic recovery of the underlying Connection.
By default, only one single Session will be cached, with further requested Sessions being created and disposed on demand. Consider raising the SessionCacheSize property in case of a high-concurrency environment.

NOTE: This ConnectionFactory requires explicit closing of all Sessions obtained from its shared Connection. This is the usual recommendation for native NMS access code anyway. However, with this ConnectionFactory, its use is mandatory in order to actually allow for Session reuse.

Note also that MessageConsumers obtained from a cached Session won't get closed until the Session will eventually be removed from the pool. This may lead to semantic side effects in some cases. For a durable subscriber, the logical Session.Close() call will also close the subscription. Re-registering a durable consumer for the same subscription on the same Session handle is not supported; close and reobtain a cached Session first.

Inheritance: Spring.Messaging.Nms.Connections.SingleConnectionFactory
Afficher le fichier Open project: spring-projects/spring-net Class Usage Examples

Méthodes publiques

Méthode Description
CachingConnectionFactory ( ) : System

Initializes a new instance of the CachingConnectionFactory class. and sets the ReconnectOnException to true

CachingConnectionFactory ( IConnectionFactory targetConnectionFactory ) : System

Initializes a new instance of the CachingConnectionFactory class for the given IConnectionFactory

GetSession ( IConnection con, AcknowledgementMode mode ) : ISession

Obtaining a cached Session.

ResetConnection ( ) : void

Resets the Session cache as well as resetting the connection.

Méthodes protégées

Méthode Description
GetCachedSessionWrapper ( ISession targetSession, Spring.Collections.LinkedList sessionList ) : ISession

Wraps the given Session so that it delegates every method call to the target session but adapts close calls. This is useful for allowing application code to handle a special framework Session just like an ordinary Session.

Method Details

CachingConnectionFactory() public méthode

Initializes a new instance of the CachingConnectionFactory class. and sets the ReconnectOnException to true
public CachingConnectionFactory ( ) : System
Résultat System

CachingConnectionFactory() public méthode

Initializes a new instance of the CachingConnectionFactory class for the given IConnectionFactory
public CachingConnectionFactory ( IConnectionFactory targetConnectionFactory ) : System
targetConnectionFactory IConnectionFactory The target connection factory.
Résultat System

GetCachedSessionWrapper() protected méthode

Wraps the given Session so that it delegates every method call to the target session but adapts close calls. This is useful for allowing application code to handle a special framework Session just like an ordinary Session.
protected GetCachedSessionWrapper ( ISession targetSession, Spring.Collections.LinkedList sessionList ) : ISession
targetSession ISession The original Session to wrap.
sessionList Spring.Collections.LinkedList The List of cached Sessions that the given Session belongs to.
Résultat ISession

GetSession() public méthode

Obtaining a cached Session.
public GetSession ( IConnection con, AcknowledgementMode mode ) : ISession
con IConnection The connection to operate on.
mode AcknowledgementMode The session ack mode.
Résultat ISession

ResetConnection() public méthode

Resets the Session cache as well as resetting the connection.
public ResetConnection ( ) : void
Résultat void