Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

SingleConnectionFactory Class

A ConnectionFactory adapter that returns the same Connection from all CreateConnection() calls, and ignores calls to Connection.Close(). According to the JMS Connection model, this is perfectly thread-safe. The shared Connection can be automatically recovered in case of an Exception.

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


[Visual Basic]
Public Class SingleConnectionFactory
    Implements IConnectionFactory, ISerializable, ICloneable, IExceptionListener, IInitializingObject, IDisposable
public class SingleConnectionFactory : IConnectionFactory, ISerializable, ICloneable, IExceptionListener, IInitializingObject, IDisposable

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.


You can either pass in a specific Connection directly or let this factory lazily create a Connection via a given target ConnectionFactory.

Useful for testing and in applications when you want to keep using the same Connection for multiple EmsTemplate calls, without having a pooling ConnectionFactory underneath. This may span any number of transactions, even concurrently executing transactions.

Note that Spring's message listener containers support the use of a shared Connection within each listener container instance. Using SingleConnectionFactory with a MessageListenerContainer only really makes sense for sharing a single Connection across multiple listener containers.


Namespace: Spring.Messaging.Ems.Connections

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

See Also

SingleConnectionFactory Members | Spring.Messaging.Ems.Connections Namespace