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 .

System.Object
   SingleConnectionFactory
      CachingConnectionFactory

[Visual Basic]
Public Class CachingConnectionFactory
    Inherits SingleConnectionFactory
[C#]
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.

Remarks

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.

Requirements

Namespace: Spring.Messaging.Nms.Connections

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

See Also

CachingConnectionFactory Members | Spring.Messaging.Nms.Connections Namespace