Messaging code that should remain unaware of Spring's JMS support can work with this proxy to seamlessly participate in Spring-managed transactions. Note that the transaction manager, for example {@link JmsTransactionManager}, still needs to work with the underlying ConnectionFactory, not with this proxy.
Make sure that TransactionAwareConnectionFactoryProxy is the outermost ConnectionFactory of a chain of ConnectionFactory proxies/adapters. TransactionAwareConnectionFactoryProxy can delegate either directly to the target factory or to some intermediary adapter like {@link UserCredentialsConnectionFactoryAdapter}.
Delegates to {@link ConnectionFactoryUtils} for automatically participatingin thread-bound transactions, for example managed by {@link JmsTransactionManager}. createSession
calls and close
calls on returned Sessions will behave properly within a transaction, that is, always work on the transactional Session. If not within a transaction, normal ConnectionFactory behavior applies.
Note that transactional JMS Sessions will be registered on a per-Connection basis. To share the same JMS Session across a transaction, make sure that you operate on the same JMS Connection handle - either through reusing the handle or through configuring a {@link SingleConnectionFactory} underneath.
Returned transactional Session proxies will implement the {@link SessionProxy}interface to allow for access to the underlying target Session. This is only intended for accessing vendor-specific Session API or for testing purposes (e.g. to perform manual transaction control). For typical application purposes, simply use the standard JMS Session interface. @author Juergen Hoeller @since 2.0 @see UserCredentialsConnectionFactoryAdapter @see SingleConnectionFactory
|
|
|
|