Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

CachingConnectionFactory Class

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.

For a list of all members of this type, see CachingConnectionFactory Members .


[Visual Basic]
Public Class CachingConnectionFactory
    Inherits SingleConnectionFactory
public class CachingConnectionFactory : SingleConnectionFactory

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.


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 EMS 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

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.


Namespace: Spring.Messaging.Ems.Connections

Assembly: Spring.Messaging.Ems (in Spring.Messaging.Ems.dll)

See Also

CachingConnectionFactory Members | Spring.Messaging.Ems.Connections Namespace