Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

NmsTransactionManager Class

A AbstractPlatformTransactionManager implementation for a single NMS

. Binds a Connection/Session pair from the specified ConnecctionFactory to the thread, potentially allowing for one thread-bound Session per ConnectionFactory.

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


[Visual Basic]
Public Class NmsTransactionManager
    Inherits AbstractPlatformTransactionManager
    Implements IResourceTransactionManager, IInitializingObject
public class NmsTransactionManager : AbstractPlatformTransactionManager, IResourceTransactionManager, IInitializingObject

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.


Application code is required to retrieve the transactional Session via GetTransactionalSession. Spring's NmsTemplate will autodetect a thread-bound Session and automatically participate in it.

The use of CachingConnectionFactoryas a target for this transaction manager is strongly recommended. CachingConnectionFactory uses a single NMS Connection for all NMS access in order to avoid the overhead of repeated Connection creation, as well as maintaining a cache of Sessions. Each transaction will then share the same NMS Connection, while still using its own individual NMS Session.

The use of a raw target ConnectionFactory would not only be inefficient because of the lack of resource reuse. It might also lead to strange effects when your NMS provider doesn't accept

calls and/or
calls before
, with the latter supposed to commit all the messages that have been sent through the producer handle and received through the consumer handle. As a safe general solution, always pass in a CachingConnectionFactory into this transaction manager's ConnectionFactory property.

Transaction synchronization is turned off by default, as this manager might be used alongside an IDbProvider based Spring transaction manager such as the AdoPlatformTransactionManager, which has stronger needs for synchronization.


Namespace: Spring.Messaging.Nms.Connections

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

See Also

NmsTransactionManager Members | Spring.Messaging.Nms.Connections Namespace