From a86b745710063c47bba8ecc0682bdc8b6f0fd95b Mon Sep 17 00:00:00 2001 From: markpollack Date: Fri, 20 Mar 2009 13:18:11 +0000 Subject: [PATCH] Show use of CachingConnectionFactory in docs for ActiveMQ integration Show use of ConnectionUtils.GetConnectionTxPair when using 'low level' integration with Spring's declarative tx mgmt. --- doc/reference/src/messaging.xml | 11 ++++++++--- doc/reference/src/transaction.xml | 22 ++++++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/doc/reference/src/messaging.xml b/doc/reference/src/messaging.xml index ec299fb9..78526573 100644 --- a/doc/reference/src/messaging.xml +++ b/doc/reference/src/messaging.xml @@ -875,14 +875,19 @@ namespace MyApp implementation, SimpleMessageListenerContainer. SimpleMessageListenerContainer creates a fixed number of JMS Sessions/MessageConsumer pairs as set by the property - ConcurrentConsumers. Here is a sample - configuration + ConcurrentConsumers. The default value of + ConcurrentConsumers is one. Here is a sample configuration - <object id="ConnectionFactory" type="Apache.NMS.ActiveMQ.ConnectionFactory, Apache.NMS.ActiveMQ"> + <object id="ActiveMqConnectionFactory" type="Apache.NMS.ActiveMQ.ConnectionFactory, Apache.NMS.ActiveMQ"> <constructor-arg index="0" value="tcp://localhost:61616"/> </object> + <object id="ConnectionFactory" type="Spring.Messaging.Nms.Connections.CachingConnectionFactory, Spring.Messaging.Nms"> + <constructor-arg index=0" ref="ActiveMqConnectionFactory"/> + <property name="SessionCacheSize" value="10"/> + </object> + <object id="MyMessageListener" type="MyApp.SimpleMessageListener, MyApp"/> <object id="MessageListenerContainer" type="Spring.Messaging.Nms.Listener.SimpleMessageListenerContainer, Spring.Messaging.Nms"> diff --git a/doc/reference/src/transaction.xml b/doc/reference/src/transaction.xml index 7fedb346..8f95046c 100644 --- a/doc/reference/src/transaction.xml +++ b/doc/reference/src/transaction.xml @@ -405,6 +405,28 @@ ConnectionUtils contains the static method ConnectionTxPair GetConnectionTxPair(IDbProvider provider) which serves this purpose. + + public class LowLevelIntegration +{ + // Spring's IDbProvider abstraction + private IDbProvider dbProvider; + + public IDbProvider dbProvider + { + set { dbProvider = value; } + } + + public void DoWork() { + ConnectionTxPair connTxPair = ConnectionUtils.GetConnectionTxPair(dbProvider); + //Use some data access library that allows you to pass in the transaction + + DbWrapper dbWrapper = new DbWrapper(); + string cmdText = ... // some command text + dbWrapper.ExecuteNonQuery(cmdText, connTxPair.Transaction); + } +} + +