Changed back to specific class names for each messaging provider's implementation
This commit is contained in:
@@ -45,7 +45,7 @@ namespace Spring.Messaging.Nms.Connections
|
||||
/// </summary>
|
||||
/// <remarks>Checks <see cref="ISmartConnectionFactory.ShouldStop"/>, if available.
|
||||
/// This is essentially a more sophisticated version of
|
||||
/// <see cref="MessagingUtils.CloseConnection(IConnection, bool)"/>
|
||||
/// <see cref="NmsUtils.CloseConnection(IConnection, bool)"/>
|
||||
/// </remarks>
|
||||
/// <param name="connection">The connection to release. (if this is <code>null</code>, the call will be ignored)</param>
|
||||
/// <param name="cf">The ConnectionFactory that the Connection was obtained from. (may be <code>null</code>)</param>
|
||||
@@ -93,7 +93,7 @@ namespace Spring.Messaging.Nms.Connections
|
||||
{
|
||||
return false;
|
||||
}
|
||||
MessageResourceHolder resourceHolder = (MessageResourceHolder) TransactionSynchronizationManager.GetResource(cf);
|
||||
NmsResourceHolder resourceHolder = (NmsResourceHolder) TransactionSynchronizationManager.GetResource(cf);
|
||||
return (resourceHolder != null && resourceHolder.ContainsSession(session));
|
||||
}
|
||||
|
||||
@@ -140,8 +140,8 @@ namespace Spring.Messaging.Nms.Connections
|
||||
AssertUtils.ArgumentNotNull(resourceKey, "Resource key must not be null");
|
||||
AssertUtils.ArgumentNotNull(resourceKey, "ResourceFactory must not be null");
|
||||
|
||||
MessageResourceHolder resourceHolder =
|
||||
(MessageResourceHolder)TransactionSynchronizationManager.GetResource(resourceKey);
|
||||
NmsResourceHolder resourceHolder =
|
||||
(NmsResourceHolder)TransactionSynchronizationManager.GetResource(resourceKey);
|
||||
if (resourceHolder != null)
|
||||
{
|
||||
ISession rhSession = resourceFactory.GetSession(resourceHolder);
|
||||
@@ -162,10 +162,10 @@ namespace Spring.Messaging.Nms.Connections
|
||||
{
|
||||
return null;
|
||||
}
|
||||
MessageResourceHolder resourceHolderToUse = resourceHolder;
|
||||
NmsResourceHolder resourceHolderToUse = resourceHolder;
|
||||
if (resourceHolderToUse == null)
|
||||
{
|
||||
resourceHolderToUse = new MessageResourceHolder();
|
||||
resourceHolderToUse = new NmsResourceHolder();
|
||||
}
|
||||
|
||||
IConnection con = resourceFactory.GetConnection(resourceHolderToUse);
|
||||
@@ -243,12 +243,12 @@ namespace Spring.Messaging.Nms.Connections
|
||||
this.synchedLocalTransactionAllowed = synchedLocalTransactionAllowed;
|
||||
}
|
||||
|
||||
public virtual ISession GetSession(MessageResourceHolder holder)
|
||||
public virtual ISession GetSession(NmsResourceHolder holder)
|
||||
{
|
||||
return holder.GetSession(typeof(ISession), existingCon);
|
||||
}
|
||||
|
||||
public virtual IConnection GetConnection(MessageResourceHolder holder)
|
||||
public virtual IConnection GetConnection(NmsResourceHolder holder)
|
||||
{
|
||||
return (existingCon != null ? existingCon : holder.GetConnection());
|
||||
}
|
||||
@@ -291,7 +291,7 @@ namespace Spring.Messaging.Nms.Connections
|
||||
/// <returns> an appropriate Session fetched from the holder,
|
||||
/// or <code>null</code> if none found
|
||||
/// </returns>
|
||||
ISession GetSession(MessageResourceHolder holder);
|
||||
ISession GetSession(NmsResourceHolder holder);
|
||||
|
||||
/// <summary> Fetch an appropriate Connection from the given MessageResourceHolder.</summary>
|
||||
/// <param name="holder">the MessageResourceHolder
|
||||
@@ -299,7 +299,7 @@ namespace Spring.Messaging.Nms.Connections
|
||||
/// <returns> an appropriate Connection fetched from the holder,
|
||||
/// or <code>null</code> if none found
|
||||
/// </returns>
|
||||
IConnection GetConnection(MessageResourceHolder holder);
|
||||
IConnection GetConnection(NmsResourceHolder holder);
|
||||
|
||||
/// <summary> Create a new NMS Connection for registration with a MessageResourceHolder.</summary>
|
||||
/// <returns> the new NMS Connection
|
||||
@@ -333,13 +333,13 @@ namespace Spring.Messaging.Nms.Connections
|
||||
{
|
||||
private object resourceKey;
|
||||
|
||||
private MessageResourceHolder resourceHolder;
|
||||
private NmsResourceHolder resourceHolder;
|
||||
|
||||
private bool transacted;
|
||||
|
||||
private bool holderActive = true;
|
||||
|
||||
public MessageResourceSynchronization(object resourceKey, MessageResourceHolder resourceHolder, bool transacted)
|
||||
public MessageResourceSynchronization(object resourceKey, NmsResourceHolder resourceHolder, bool transacted)
|
||||
{
|
||||
this.resourceKey = resourceKey;
|
||||
this.resourceHolder = resourceHolder;
|
||||
|
||||
@@ -37,11 +37,11 @@ namespace Spring.Messaging.Nms.Connections
|
||||
/// </summary>
|
||||
/// <author>Juergen Hoeller</author>
|
||||
/// <author>Mark Pollack (.NET)</author>
|
||||
public class MessageResourceHolder : ResourceHolderSupport
|
||||
public class NmsResourceHolder : ResourceHolderSupport
|
||||
{
|
||||
#region Logging
|
||||
|
||||
private static readonly ILog logger = LogManager.GetLogger(typeof(MessageResourceHolder));
|
||||
private static readonly ILog logger = LogManager.GetLogger(typeof(NmsResourceHolder));
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -63,29 +63,29 @@ namespace Spring.Messaging.Nms.Connections
|
||||
#region Constructor (s)
|
||||
|
||||
/// <summary> Create a new MessageResourceHolder that is open for resources to be added.</summary>
|
||||
public MessageResourceHolder()
|
||||
public NmsResourceHolder()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MessageResourceHolder"/> class
|
||||
/// Initializes a new instance of the <see cref="NmsResourceHolder"/> class
|
||||
/// at is open for resources to be added.
|
||||
/// </summary>
|
||||
/// <param name="connectionFactory">The connection factory that this
|
||||
/// resource holder is associated with (may be <code>null</code>)
|
||||
/// </param>
|
||||
public MessageResourceHolder(IConnectionFactory connectionFactory)
|
||||
public NmsResourceHolder(IConnectionFactory connectionFactory)
|
||||
{
|
||||
this.connectionFactory = connectionFactory;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MessageResourceHolder"/> class for the
|
||||
/// Initializes a new instance of the <see cref="NmsResourceHolder"/> class for the
|
||||
/// given Session.
|
||||
/// </summary>
|
||||
/// <param name="session">The session.</param>
|
||||
public MessageResourceHolder(ISession session)
|
||||
public NmsResourceHolder(ISession session)
|
||||
{
|
||||
AddSession(session);
|
||||
frozen = true;
|
||||
@@ -96,7 +96,7 @@ namespace Spring.Messaging.Nms.Connections
|
||||
/// </param>
|
||||
/// <param name="session">the NMS Session
|
||||
/// </param>
|
||||
public MessageResourceHolder(IConnection connection, ISession session)
|
||||
public NmsResourceHolder(IConnection connection, ISession session)
|
||||
{
|
||||
AddConnection(connection);
|
||||
AddSession(session, connection);
|
||||
@@ -104,12 +104,12 @@ namespace Spring.Messaging.Nms.Connections
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MessageResourceHolder"/> class.
|
||||
/// Initializes a new instance of the <see cref="NmsResourceHolder"/> class.
|
||||
/// </summary>
|
||||
/// <param name="connectionFactory">The connection factory.</param>
|
||||
/// <param name="connection">The connection.</param>
|
||||
/// <param name="session">The session.</param>
|
||||
public MessageResourceHolder(IConnectionFactory connectionFactory, IConnection connection, ISession session)
|
||||
public NmsResourceHolder(IConnectionFactory connectionFactory, IConnection connection, ISession session)
|
||||
{
|
||||
this.connectionFactory = connectionFactory;
|
||||
AddConnection(connection);
|
||||
@@ -121,7 +121,7 @@ namespace Spring.Messaging.Nms.Connections
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this <see cref="MessageResourceHolder"/> is frozen, namely that
|
||||
/// Gets a value indicating whether this <see cref="NmsResourceHolder"/> is frozen, namely that
|
||||
/// additional resources can be registered with the holder. If using any of the constructors with
|
||||
/// a Session, the holder will be set to the frozen state.
|
||||
/// </summary>
|
||||
@@ -40,7 +40,7 @@ namespace Spring.Messaging.Nms.Connections
|
||||
/// <para>
|
||||
/// Application code is required to retrieve the transactional Session via
|
||||
/// <see cref="ConnectionFactoryUtils.GetTransactionalSession"/>. Spring's
|
||||
/// <see cref="MessageTemplate"/> will autodetect a thread-bound Session and
|
||||
/// <see cref="NmsTemplate"/> will autodetect a thread-bound Session and
|
||||
/// automatically participate in it.
|
||||
/// </para>
|
||||
/// <para>
|
||||
@@ -58,20 +58,20 @@ namespace Spring.Messaging.Nms.Connections
|
||||
/// </remarks>
|
||||
/// <author>Juergen Hoeller</author>
|
||||
/// <author>Mark Pollack (.NET)</author>
|
||||
public class MessageTransactionManager : AbstractPlatformTransactionManager,
|
||||
public class NmsTransactionManager : AbstractPlatformTransactionManager,
|
||||
IResourceTransactionManager, IInitializingObject
|
||||
{
|
||||
|
||||
#region Logging Definition
|
||||
|
||||
private static readonly ILog LOG = LogManager.GetLogger(typeof(MessageTransactionManager));
|
||||
private static readonly ILog LOG = LogManager.GetLogger(typeof(NmsTransactionManager));
|
||||
|
||||
#endregion
|
||||
|
||||
private IConnectionFactory connectionFactory;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MessageTransactionManager"/> class.
|
||||
/// Initializes a new instance of the <see cref="NmsTransactionManager"/> class.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The ConnectionFactory has to be set before using the instance.
|
||||
@@ -84,17 +84,17 @@ namespace Spring.Messaging.Nms.Connections
|
||||
/// Only one manager is allowed to drive synchronization at any point of time.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public MessageTransactionManager()
|
||||
public NmsTransactionManager()
|
||||
{
|
||||
TransactionSynchronization = TransactionSynchronizationState.Never;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MessageTransactionManager"/> class
|
||||
/// Initializes a new instance of the <see cref="NmsTransactionManager"/> class
|
||||
/// given a ConnectionFactory.
|
||||
/// </summary>
|
||||
/// <param name="connectionFactory">The connection factory to obtain connections from.</param>
|
||||
public MessageTransactionManager(IConnectionFactory connectionFactory) : this()
|
||||
public NmsTransactionManager(IConnectionFactory connectionFactory) : this()
|
||||
{
|
||||
ConnectionFactory = connectionFactory;
|
||||
AfterPropertiesSet();
|
||||
@@ -154,7 +154,7 @@ namespace Spring.Messaging.Nms.Connections
|
||||
MessageTransactionObject txObject = new MessageTransactionObject();
|
||||
|
||||
txObject.ResourceHolder =
|
||||
(MessageResourceHolder) TransactionSynchronizationManager.GetResource(ConnectionFactory);
|
||||
(NmsResourceHolder) TransactionSynchronizationManager.GetResource(ConnectionFactory);
|
||||
return txObject;
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ namespace Spring.Messaging.Nms.Connections
|
||||
{
|
||||
log.Debug("Created NMS transaction on Session [" + session + "] from Connection [" + con + "]");
|
||||
}
|
||||
txObject.ResourceHolder = new MessageResourceHolder(ConnectionFactory, con, session);
|
||||
txObject.ResourceHolder = new NmsResourceHolder(ConnectionFactory, con, session);
|
||||
txObject.ResourceHolder.SynchronizedWithTransaction = true;
|
||||
int timeout = DetermineTimeout(definition);
|
||||
if (timeout != DefaultTransactionDefinition.TIMEOUT_DEFAULT)
|
||||
@@ -260,7 +260,7 @@ namespace Spring.Messaging.Nms.Connections
|
||||
/// </exception>
|
||||
protected override void DoResume(object transaction, object suspendedResources)
|
||||
{
|
||||
MessageResourceHolder conHolder = (MessageResourceHolder) suspendedResources;
|
||||
NmsResourceHolder conHolder = (NmsResourceHolder) suspendedResources;
|
||||
TransactionSynchronizationManager.BindResource(ConnectionFactory, conHolder);
|
||||
}
|
||||
|
||||
@@ -402,10 +402,10 @@ namespace Spring.Messaging.Nms.Connections
|
||||
/// </summary>
|
||||
internal class MessageTransactionObject : ISmartTransactionObject
|
||||
{
|
||||
private MessageResourceHolder resourceHolder;
|
||||
private NmsResourceHolder resourceHolder;
|
||||
|
||||
|
||||
public MessageResourceHolder ResourceHolder
|
||||
public NmsResourceHolder ResourceHolder
|
||||
{
|
||||
get { return resourceHolder; }
|
||||
set { resourceHolder = value; }
|
||||
@@ -38,7 +38,7 @@ namespace Spring.Messaging.Nms.Connections
|
||||
/// You can either pass in a specific Connection directly or let this
|
||||
/// factory lazily create a Connection via a given target ConnectionFactory.
|
||||
/// <para>Useful in order to keep using the same Connection for multiple
|
||||
/// <see cref="MessageTemplate"/> calls, without having a pooling ConnectionFactory
|
||||
/// <see cref="NmsTemplate"/> calls, without having a pooling ConnectionFactory
|
||||
/// underneath. This may span any number of transactions, even concurrently executing transactions.
|
||||
/// </para>
|
||||
/// <para>
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Spring.Messaging.Nms.Core
|
||||
/// <author>Mark Pollack</author>
|
||||
/// <author>Juergen Hoeller</author>
|
||||
/// <author>Mark Pollack (.NET)</author>
|
||||
public interface IMessageOperations
|
||||
public interface INmsOperations
|
||||
{
|
||||
/// <summary> Execute the action specified by the given action object within
|
||||
/// a NMS Session.
|
||||
@@ -31,7 +31,7 @@ namespace Spring.Messaging.Nms.Core
|
||||
/// that can be used as a (anonymous) delegate.</para>
|
||||
/// </remarks>
|
||||
/// <author>Mark Pollack</author>
|
||||
/// <seealso cref="MessageTemplate.Execute(ISessionCallback,bool)">
|
||||
/// <seealso cref="NmsTemplate.Execute(ISessionCallback,bool)">
|
||||
/// </seealso>
|
||||
public interface ISessionCallback
|
||||
{
|
||||
|
||||
@@ -35,23 +35,23 @@ namespace Spring.Messaging.Nms.Core
|
||||
/// through overriding the <code>createNmsTemplate</code> method.
|
||||
///
|
||||
/// </remarks>
|
||||
public class MessageGatewaySupport : IInitializingObject
|
||||
public class NmsGatewaySupport : IInitializingObject
|
||||
{
|
||||
|
||||
#region Logging
|
||||
|
||||
private readonly ILog logger = LogManager.GetLogger(typeof(MessageGatewaySupport));
|
||||
private readonly ILog logger = LogManager.GetLogger(typeof(NmsGatewaySupport));
|
||||
|
||||
#endregion
|
||||
|
||||
private MessageTemplate jmsTemplate;
|
||||
private NmsTemplate jmsTemplate;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the NMS template for the gateway.
|
||||
/// </summary>
|
||||
/// <value>The NMS template.</value>
|
||||
public MessageTemplate MessageTemplate
|
||||
public NmsTemplate NmsTemplate
|
||||
{
|
||||
get { return jmsTemplate; }
|
||||
set { jmsTemplate = value; }
|
||||
@@ -83,9 +83,9 @@ namespace Spring.Messaging.Nms.Core
|
||||
///
|
||||
/// <param name="connectionFactory">The connection factory.</param>
|
||||
/// <returns></returns>
|
||||
protected virtual MessageTemplate CreateNmsTemplate(IConnectionFactory connectionFactory)
|
||||
protected virtual NmsTemplate CreateNmsTemplate(IConnectionFactory connectionFactory)
|
||||
{
|
||||
return new MessageTemplate(connectionFactory);
|
||||
return new NmsTemplate(connectionFactory);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -47,11 +47,11 @@ namespace Spring.Messaging.Nms.Core
|
||||
/// <author>Mark Pollack</author>
|
||||
/// <author>Juergen Hoeller</author>
|
||||
/// <author>Mark Pollack (.NET)</author>
|
||||
public class MessageTemplate : MessageDestinationAccessor, IMessageOperations
|
||||
public class NmsTemplate : NmsDestinationAccessor, INmsOperations
|
||||
{
|
||||
#region Logging
|
||||
|
||||
private readonly ILog logger = LogManager.GetLogger(typeof(MessageTemplate));
|
||||
private readonly ILog logger = LogManager.GetLogger(typeof(NmsTemplate));
|
||||
|
||||
|
||||
#endregion
|
||||
@@ -96,7 +96,7 @@ namespace Spring.Messaging.Nms.Core
|
||||
/// This constructor can be used to prepare a MessageTemplate via an ObjectFactory,
|
||||
/// typically setting the ConnectionFactory.</para>
|
||||
/// </remarks>
|
||||
public MessageTemplate()
|
||||
public NmsTemplate()
|
||||
{
|
||||
transactionalResourceFactory = new MessageTemplateResourceFactory(this);
|
||||
InitDefaultStrategies();
|
||||
@@ -106,7 +106,7 @@ namespace Spring.Messaging.Nms.Core
|
||||
/// <summary> Create a new MessageTemplate, given a ConnectionFactory.</summary>
|
||||
/// <param name="connectionFactory">the ConnectionFactory to obtain IConnections from
|
||||
/// </param>
|
||||
public MessageTemplate(IConnectionFactory connectionFactory)
|
||||
public NmsTemplate(IConnectionFactory connectionFactory)
|
||||
: this()
|
||||
{
|
||||
ConnectionFactory = connectionFactory;
|
||||
@@ -188,7 +188,7 @@ namespace Spring.Messaging.Nms.Core
|
||||
}
|
||||
finally
|
||||
{
|
||||
MessagingUtils.CloseSession(sessionToClose);
|
||||
NmsUtils.CloseSession(sessionToClose);
|
||||
ConnectionFactoryUtils.ReleaseConnection(conToClose, ConnectionFactory, startConnection);
|
||||
}
|
||||
}
|
||||
@@ -376,7 +376,7 @@ namespace Spring.Messaging.Nms.Core
|
||||
/// <returns> an appropriate IConnection fetched from the holder,
|
||||
/// or <code>null</code> if none found
|
||||
/// </returns>
|
||||
protected virtual IConnection GetConnection(MessageResourceHolder holder)
|
||||
protected virtual IConnection GetConnection(NmsResourceHolder holder)
|
||||
{
|
||||
return holder.GetConnection();
|
||||
}
|
||||
@@ -388,7 +388,7 @@ namespace Spring.Messaging.Nms.Core
|
||||
/// <returns> an appropriate ISession fetched from the holder,
|
||||
/// or <code>null</code> if none found
|
||||
/// </returns>
|
||||
protected virtual ISession GetSession(MessageResourceHolder holder)
|
||||
protected virtual ISession GetSession(NmsResourceHolder holder)
|
||||
{
|
||||
return holder.GetSession();
|
||||
}
|
||||
@@ -548,12 +548,12 @@ namespace Spring.Messaging.Nms.Core
|
||||
if (session.Transacted && IsSessionLocallyTransacted(session))
|
||||
{
|
||||
// Transacted session created by this template -> commit.
|
||||
MessagingUtils.CommitIfNecessary(session);
|
||||
NmsUtils.CommitIfNecessary(session);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
MessagingUtils.CloseMessageProducer(producer);
|
||||
NmsUtils.CloseMessageProducer(producer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -969,8 +969,8 @@ namespace Spring.Messaging.Nms.Core
|
||||
try
|
||||
{
|
||||
long timeout = ReceiveTimeout;
|
||||
MessageResourceHolder resourceHolder =
|
||||
(MessageResourceHolder)TransactionSynchronizationManager.GetResource(ConnectionFactory);
|
||||
NmsResourceHolder resourceHolder =
|
||||
(NmsResourceHolder)TransactionSynchronizationManager.GetResource(ConnectionFactory);
|
||||
if (resourceHolder != null && resourceHolder.HasTimeout)
|
||||
{
|
||||
timeout = Convert.ToInt64(resourceHolder.TimeToLiveInMilliseconds);
|
||||
@@ -984,7 +984,7 @@ namespace Spring.Messaging.Nms.Core
|
||||
if (IsSessionLocallyTransacted(session))
|
||||
{
|
||||
// Transacted session created by this template -> commit.
|
||||
MessagingUtils.CommitIfNecessary(session);
|
||||
NmsUtils.CommitIfNecessary(session);
|
||||
}
|
||||
}
|
||||
else if (IsClientAcknowledge(session))
|
||||
@@ -999,7 +999,7 @@ namespace Spring.Messaging.Nms.Core
|
||||
}
|
||||
finally
|
||||
{
|
||||
MessagingUtils.CloseMessageConsumer(consumer);
|
||||
NmsUtils.CloseMessageConsumer(consumer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1125,29 +1125,29 @@ namespace Spring.Messaging.Nms.Core
|
||||
/// </summary>
|
||||
private class MessageTemplateResourceFactory : ConnectionFactoryUtils.ResourceFactory
|
||||
{
|
||||
private MessageTemplate enclosingTemplateInstance;
|
||||
private NmsTemplate enclosingTemplateInstance;
|
||||
|
||||
public MessageTemplateResourceFactory(MessageTemplate enclosingInstance)
|
||||
public MessageTemplateResourceFactory(NmsTemplate enclosingInstance)
|
||||
{
|
||||
InitBlock(enclosingInstance);
|
||||
}
|
||||
|
||||
private void InitBlock(MessageTemplate enclosingInstance)
|
||||
private void InitBlock(NmsTemplate enclosingInstance)
|
||||
{
|
||||
enclosingTemplateInstance = enclosingInstance;
|
||||
}
|
||||
|
||||
public MessageTemplate EnclosingInstance
|
||||
public NmsTemplate EnclosingInstance
|
||||
{
|
||||
get { return enclosingTemplateInstance; }
|
||||
}
|
||||
|
||||
public virtual IConnection GetConnection(MessageResourceHolder holder)
|
||||
public virtual IConnection GetConnection(NmsResourceHolder holder)
|
||||
{
|
||||
return EnclosingInstance.GetConnection(holder);
|
||||
}
|
||||
|
||||
public virtual ISession GetSession(MessageResourceHolder holder)
|
||||
public virtual ISession GetSession(NmsResourceHolder holder)
|
||||
{
|
||||
return EnclosingInstance.GetSession(holder);
|
||||
}
|
||||
@@ -1170,10 +1170,10 @@ namespace Spring.Messaging.Nms.Core
|
||||
|
||||
private class ProducerCreatorCallback : ISessionCallback
|
||||
{
|
||||
private MessageTemplate jmsTemplate;
|
||||
private NmsTemplate jmsTemplate;
|
||||
private IProducerCallback producerCallback;
|
||||
|
||||
public ProducerCreatorCallback(MessageTemplate jmsTemplate, IProducerCallback producerCallback)
|
||||
public ProducerCreatorCallback(NmsTemplate jmsTemplate, IProducerCallback producerCallback)
|
||||
{
|
||||
this.jmsTemplate = jmsTemplate;
|
||||
this.producerCallback = producerCallback;
|
||||
@@ -1188,7 +1188,7 @@ namespace Spring.Messaging.Nms.Core
|
||||
}
|
||||
finally
|
||||
{
|
||||
MessagingUtils.CloseMessageProducer(producer);
|
||||
NmsUtils.CloseMessageProducer(producer);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1196,18 +1196,18 @@ namespace Spring.Messaging.Nms.Core
|
||||
|
||||
private class ReceiveCallback : ISessionCallback
|
||||
{
|
||||
private MessageTemplate jmsTemplate;
|
||||
private NmsTemplate jmsTemplate;
|
||||
private IDestination destination;
|
||||
private string destinationName;
|
||||
|
||||
|
||||
public ReceiveCallback(MessageTemplate jmsTemplate, string destinationName)
|
||||
public ReceiveCallback(NmsTemplate jmsTemplate, string destinationName)
|
||||
{
|
||||
this.jmsTemplate = jmsTemplate;
|
||||
this.destinationName = destinationName;
|
||||
}
|
||||
|
||||
public ReceiveCallback(MessageTemplate jmsTemplate, IDestination destination)
|
||||
public ReceiveCallback(NmsTemplate jmsTemplate, IDestination destination)
|
||||
{
|
||||
this.jmsTemplate = jmsTemplate;
|
||||
this.destination = destination;
|
||||
@@ -1231,11 +1231,11 @@ namespace Spring.Messaging.Nms.Core
|
||||
|
||||
private class ConvertAndSendMessageCreator : IMessageCreator
|
||||
{
|
||||
private MessageTemplate jmsTemplate;
|
||||
private NmsTemplate jmsTemplate;
|
||||
private object objectToConvert;
|
||||
private IMessagePostProcessor messagePostProcessor;
|
||||
|
||||
public ConvertAndSendMessageCreator(MessageTemplate jmsTemplate, object message, IMessagePostProcessor messagePostProcessor)
|
||||
public ConvertAndSendMessageCreator(NmsTemplate jmsTemplate, object message, IMessagePostProcessor messagePostProcessor)
|
||||
{
|
||||
this.jmsTemplate = jmsTemplate;
|
||||
objectToConvert = message;
|
||||
@@ -1251,12 +1251,12 @@ namespace Spring.Messaging.Nms.Core
|
||||
|
||||
private class ReceiveSelectedCallback : ISessionCallback
|
||||
{
|
||||
private MessageTemplate jmsTemplate;
|
||||
private NmsTemplate jmsTemplate;
|
||||
private string messageSelector;
|
||||
private string destinationName;
|
||||
private IDestination destination;
|
||||
|
||||
public ReceiveSelectedCallback(MessageTemplate jmsTemplate,
|
||||
public ReceiveSelectedCallback(NmsTemplate jmsTemplate,
|
||||
IDestination destination,
|
||||
string messageSelector)
|
||||
{
|
||||
@@ -1264,7 +1264,7 @@ namespace Spring.Messaging.Nms.Core
|
||||
this.destination = destination;
|
||||
this.messageSelector = messageSelector;
|
||||
}
|
||||
public ReceiveSelectedCallback(MessageTemplate jmsTemplate,
|
||||
public ReceiveSelectedCallback(NmsTemplate jmsTemplate,
|
||||
string destinationName,
|
||||
string messageSelector)
|
||||
{
|
||||
@@ -1311,10 +1311,10 @@ namespace Spring.Messaging.Nms.Core
|
||||
|
||||
internal class SimpleMessageCreator : IMessageCreator
|
||||
{
|
||||
private MessageTemplate jmsTemplate;
|
||||
private NmsTemplate jmsTemplate;
|
||||
private object objectToConvert;
|
||||
|
||||
public SimpleMessageCreator(MessageTemplate jmsTemplate, object objectToConvert)
|
||||
public SimpleMessageCreator(NmsTemplate jmsTemplate, object objectToConvert)
|
||||
{
|
||||
this.jmsTemplate = jmsTemplate;
|
||||
this.objectToConvert = objectToConvert;
|
||||
@@ -1334,32 +1334,32 @@ namespace Spring.Messaging.Nms.Core
|
||||
{
|
||||
private string destinationName;
|
||||
private IDestination destination;
|
||||
private MessageTemplate jmsTemplate;
|
||||
private NmsTemplate jmsTemplate;
|
||||
private IMessageCreator messageCreator;
|
||||
private IMessageCreatorDelegate messageCreatorDelegate;
|
||||
|
||||
public SendDestinationCallback(MessageTemplate jmsTemplate, string destinationName, IMessageCreator messageCreator)
|
||||
public SendDestinationCallback(NmsTemplate jmsTemplate, string destinationName, IMessageCreator messageCreator)
|
||||
{
|
||||
this.jmsTemplate = jmsTemplate;
|
||||
this.destinationName = destinationName;
|
||||
this.messageCreator = messageCreator;
|
||||
}
|
||||
|
||||
public SendDestinationCallback(MessageTemplate jmsTemplate, IDestination destination, IMessageCreator messageCreator)
|
||||
public SendDestinationCallback(NmsTemplate jmsTemplate, IDestination destination, IMessageCreator messageCreator)
|
||||
{
|
||||
this.jmsTemplate = jmsTemplate;
|
||||
this.destination = destination;
|
||||
this.messageCreator = messageCreator;
|
||||
}
|
||||
|
||||
public SendDestinationCallback(MessageTemplate jmsTemplate, string destinationName, IMessageCreatorDelegate messageCreatorDelegate)
|
||||
public SendDestinationCallback(NmsTemplate jmsTemplate, string destinationName, IMessageCreatorDelegate messageCreatorDelegate)
|
||||
{
|
||||
this.jmsTemplate = jmsTemplate;
|
||||
this.destinationName = destinationName;
|
||||
this.messageCreatorDelegate = messageCreatorDelegate;
|
||||
}
|
||||
|
||||
public SendDestinationCallback(MessageTemplate jmsTemplate, IDestination destination, IMessageCreatorDelegate messageCreatorDelegate)
|
||||
public SendDestinationCallback(NmsTemplate jmsTemplate, IDestination destination, IMessageCreatorDelegate messageCreatorDelegate)
|
||||
{
|
||||
this.jmsTemplate = jmsTemplate;
|
||||
this.destination = destination;
|
||||
@@ -33,7 +33,7 @@ namespace Spring.Messaging.Nms.Listener
|
||||
/// Common base class for all containers which need to implement listening
|
||||
/// based on a Connection (either shared or freshly obtained for each attempt).
|
||||
/// Inherits basic Connection and Session configuration handling from the
|
||||
/// <see cref="MessagingAccessor"/> base class.
|
||||
/// <see cref="NmsAccessor"/> base class.
|
||||
/// </summary>
|
||||
/// <para>
|
||||
/// This class provides basic lifecycle management, in particular management
|
||||
@@ -45,7 +45,7 @@ namespace Spring.Messaging.Nms.Listener
|
||||
///
|
||||
/// </remarks>
|
||||
/// <author>Mark Pollack</author>
|
||||
public abstract class AbstractListenerContainer : MessageDestinationAccessor, ILifecycle, IObjectNameAware, IDisposable
|
||||
public abstract class AbstractListenerContainer : NmsDestinationAccessor, ILifecycle, IObjectNameAware, IDisposable
|
||||
{
|
||||
#region Logging
|
||||
|
||||
@@ -473,7 +473,7 @@ namespace Spring.Messaging.Nms.Listener
|
||||
return con;
|
||||
} catch (NMSException)
|
||||
{
|
||||
MessagingUtils.CloseConnection(con);
|
||||
NmsUtils.CloseConnection(con);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ namespace Spring.Messaging.Nms.Listener
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to expose listener session to a registered
|
||||
/// <see cref="ISessionAwareMessageListener"/> as well as to <see cref="MessageTemplate"/> calls.
|
||||
/// <see cref="ISessionAwareMessageListener"/> as well as to <see cref="NmsTemplate"/> calls.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Default is "true", reusing the listener's Session.
|
||||
@@ -217,7 +217,7 @@ namespace Spring.Messaging.Nms.Listener
|
||||
/// underlying Connection instead, which might be necessary
|
||||
/// on some messaging providers.
|
||||
/// <para>Note that Sessions managed by an external transaction manager will
|
||||
/// always get exposed to <see cref="MessageTemplate"/>
|
||||
/// always get exposed to <see cref="NmsTemplate"/>
|
||||
/// calls. So in terms of MessageTemplate exposure, this setting only affects
|
||||
/// locally transacted Sessions.
|
||||
/// </para>
|
||||
@@ -412,13 +412,13 @@ namespace Spring.Messaging.Nms.Listener
|
||||
if (sessionToUse.Transacted && SessionTransacted)
|
||||
{
|
||||
// Transacted session created by this container -> commit.
|
||||
MessagingUtils.CommitIfNecessary(sessionToUse);
|
||||
NmsUtils.CommitIfNecessary(sessionToUse);
|
||||
}
|
||||
}
|
||||
} finally
|
||||
{
|
||||
MessagingUtils.CloseSession(sessionToClose);
|
||||
MessagingUtils.CloseConnection(conToClose);
|
||||
NmsUtils.CloseSession(sessionToClose);
|
||||
NmsUtils.CloseConnection(conToClose);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -449,7 +449,7 @@ namespace Spring.Messaging.Nms.Listener
|
||||
// Commit necessary - but avoid commit call is Session transaction is externally coordinated.
|
||||
if (IsSessionLocallyTransacted(session))
|
||||
{
|
||||
MessagingUtils.CommitIfNecessary(session);
|
||||
NmsUtils.CommitIfNecessary(session);
|
||||
}
|
||||
}
|
||||
else if (IsClientAcknowledge(session))
|
||||
@@ -472,7 +472,7 @@ namespace Spring.Messaging.Nms.Listener
|
||||
/// <returns>
|
||||
/// <c>true</c> if the is session locally transacted; otherwise, <c>false</c>.
|
||||
/// </returns>
|
||||
/// <see cref="MessagingAccessor.SessionTransacted"/>
|
||||
/// <see cref="NmsAccessor.SessionTransacted"/>
|
||||
protected virtual bool IsSessionLocallyTransacted(ISession session)
|
||||
{
|
||||
return SessionTransacted;
|
||||
@@ -489,7 +489,7 @@ namespace Spring.Messaging.Nms.Listener
|
||||
if (session.Transacted && IsSessionLocallyTransacted(session))
|
||||
{
|
||||
// Transacted session created by this container -> rollback
|
||||
MessagingUtils.RollbackIfNecessary(session);
|
||||
NmsUtils.RollbackIfNecessary(session);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
@@ -509,7 +509,7 @@ namespace Spring.Messaging.Nms.Listener
|
||||
{
|
||||
logger.Debug("Initiating transaction rollback on application exception");
|
||||
}
|
||||
MessagingUtils.RollbackIfNecessary(session);
|
||||
NmsUtils.RollbackIfNecessary(session);
|
||||
}
|
||||
} catch (NMSException)
|
||||
{
|
||||
|
||||
@@ -530,7 +530,7 @@ namespace Spring.Messaging.Nms.Listener.Adapter
|
||||
}
|
||||
finally
|
||||
{
|
||||
MessagingUtils.CloseMessageProducer(producer);
|
||||
NmsUtils.CloseMessageProducer(producer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,13 +29,13 @@ namespace Spring.Messaging.Nms.Listener
|
||||
/// </summary>
|
||||
/// <author>Juergen Hoeller</author>
|
||||
/// <author>Mark Pollack (.NET)</author>
|
||||
public class LocallyExposedMessageResourceHolder : MessageResourceHolder
|
||||
public class LocallyExposedNmsResourceHolder : NmsResourceHolder
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LocallyExposedMessageResourceHolder"/> class.
|
||||
/// Initializes a new instance of the <see cref="LocallyExposedNmsResourceHolder"/> class.
|
||||
/// </summary>
|
||||
/// <param name="session">The session.</param>
|
||||
public LocallyExposedMessageResourceHolder(ISession session) : base(session)
|
||||
public LocallyExposedNmsResourceHolder(ISession session) : base(session)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -237,12 +237,12 @@ namespace Spring.Messaging.Nms.Listener
|
||||
logger.Debug("Closing NMS MessageConsumers");
|
||||
foreach (IMessageConsumer messageConsumer in consumers)
|
||||
{
|
||||
MessagingUtils.CloseMessageConsumer(messageConsumer);
|
||||
NmsUtils.CloseMessageConsumer(messageConsumer);
|
||||
}
|
||||
logger.Debug("Closing NMS Sessions");
|
||||
foreach (ISession session in sessions)
|
||||
{
|
||||
MessagingUtils.CloseSession(session);
|
||||
NmsUtils.CloseSession(session);
|
||||
}
|
||||
consumers = null;
|
||||
sessions = null;
|
||||
@@ -296,7 +296,7 @@ namespace Spring.Messaging.Nms.Listener
|
||||
if (exposeResource)
|
||||
{
|
||||
TransactionSynchronizationManager.BindResource(
|
||||
container.ConnectionFactory, new LocallyExposedMessageResourceHolder(session));
|
||||
container.ConnectionFactory, new LocallyExposedNmsResourceHolder(session));
|
||||
}
|
||||
try
|
||||
{
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using Spring.Objects.Factory;
|
||||
using Spring.Util;
|
||||
using Apache.NMS;
|
||||
|
||||
@@ -35,7 +33,7 @@ namespace Spring.Messaging.Nms.Support.Destinations
|
||||
/// </remarks>
|
||||
/// <author>Juergen Hoeller </author>
|
||||
/// <author>Mark Pollack (.NET)</author>
|
||||
public class MessageDestinationAccessor : MessagingAccessor
|
||||
public class NmsDestinationAccessor : NmsAccessor
|
||||
{
|
||||
#region Fields
|
||||
|
||||
@@ -29,11 +29,11 @@ namespace Spring.Messaging.Nms.Support
|
||||
/// Generic utility methods for working with NMS. Mainly for internal use
|
||||
/// within the framework, but also useful for custom NMS access code.
|
||||
/// </summary>
|
||||
public abstract class MessagingUtils
|
||||
public abstract class NmsUtils
|
||||
{
|
||||
#region Logging
|
||||
|
||||
private static readonly ILog logger = LogManager.GetLogger(typeof(MessagingUtils));
|
||||
private static readonly ILog logger = LogManager.GetLogger(typeof(NmsUtils));
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -34,11 +34,11 @@ namespace Spring.Messaging.Nms.Support
|
||||
/// </remarks>
|
||||
/// <author>Juergen Hoeller</author>
|
||||
/// <author>Mark Pollack (.NET)</author>
|
||||
public class MessagingAccessor : IInitializingObject
|
||||
public class NmsAccessor : IInitializingObject
|
||||
{
|
||||
#region Logging
|
||||
|
||||
private readonly ILog logger = LogManager.GetLogger(typeof(MessagingAccessor));
|
||||
private readonly ILog logger = LogManager.GetLogger(typeof(NmsAccessor));
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -50,13 +50,13 @@
|
||||
<Compile Include="Messaging\Nms\Core\IExceptionListener.cs" />
|
||||
<Compile Include="Messaging\Nms\Core\IMessageCreator.cs" />
|
||||
<Compile Include="Messaging\Nms\Core\IMessageListener.cs" />
|
||||
<Compile Include="Messaging\Nms\Core\IMessageOperations.cs" />
|
||||
<Compile Include="Messaging\Nms\Core\INmsOperations.cs" />
|
||||
<Compile Include="Messaging\Nms\Core\IMessagePostProcessor.cs" />
|
||||
<Compile Include="Messaging\Nms\Core\IProducerCallback.cs" />
|
||||
<Compile Include="Messaging\Nms\Core\ISessionCallback.cs" />
|
||||
<Compile Include="Messaging\Nms\Core\MessageCreatorDelegate.cs" />
|
||||
<Compile Include="Messaging\Nms\Core\MessageTemplate.cs" />
|
||||
<Compile Include="Messaging\Nms\Core\MessagingGatewaySupport.cs" />
|
||||
<Compile Include="Messaging\Nms\Core\NmsTemplate.cs" />
|
||||
<Compile Include="Messaging\Nms\Core\NmsGatewaySupport.cs" />
|
||||
<Compile Include="Messaging\Nms\Core\SessionDelegate.cs" />
|
||||
<Compile Include="Messaging\Nms\Config\MessageListenerContainerObjectDefinitionParser.cs" />
|
||||
<Compile Include="Messaging\Nms\Config\NmsNamespaceParser.cs" />
|
||||
@@ -67,8 +67,8 @@
|
||||
<Compile Include="Messaging\Nms\Connections\ConnectionFactoryUtils.cs" />
|
||||
<Compile Include="Messaging\Nms\Connections\IDecoratorSession.cs" />
|
||||
<Compile Include="Messaging\Nms\Connections\ISmartConnectionFactory.cs" />
|
||||
<Compile Include="Messaging\Nms\Connections\MessageResourceHolder.cs" />
|
||||
<Compile Include="Messaging\Nms\Connections\MessageTransactionManager.cs" />
|
||||
<Compile Include="Messaging\Nms\Connections\NmsResourceHolder.cs" />
|
||||
<Compile Include="Messaging\Nms\Connections\NmsTransactionManager.cs" />
|
||||
<Compile Include="Messaging\Nms\Connections\SingleConnectionFactory.cs" />
|
||||
<Compile Include="Messaging\Nms\Connections\SynchedLocalTransactionFailedException.cs" />
|
||||
<Compile Include="Messaging\Nms\Listener\AbstractListenerContainer.cs" />
|
||||
@@ -76,15 +76,15 @@
|
||||
<Compile Include="Messaging\Nms\Listener\Adapter\ListenerExecutionFailedException.cs" />
|
||||
<Compile Include="Messaging\Nms\Listener\Adapter\MessageListenerAdapter.cs" />
|
||||
<Compile Include="Messaging\Nms\Listener\ISessionAwareMessageListener.cs" />
|
||||
<Compile Include="Messaging\Nms\Listener\LocallyExposedMessageResourceHolder.cs" />
|
||||
<Compile Include="Messaging\Nms\Listener\LocallyExposedNmsResourceHolder.cs" />
|
||||
<Compile Include="Messaging\Nms\Listener\SimpleMessageListenerContainer.cs" />
|
||||
<Compile Include="Messaging\Nms\Support\Converter\IMessageConverter.cs" />
|
||||
<Compile Include="Messaging\Nms\Support\Converter\MessageConversionException.cs" />
|
||||
<Compile Include="Messaging\Nms\Support\Converter\SimpleMessageConverter.cs" />
|
||||
<Compile Include="Messaging\Nms\Support\Destinations\DynamicDestinationResolver.cs" />
|
||||
<Compile Include="Messaging\Nms\Support\Destinations\IDestinationResolver.cs" />
|
||||
<Compile Include="Messaging\Nms\Support\Destinations\MessageDestinationAccessor.cs" />
|
||||
<Compile Include="Messaging\Nms\Support\MessageAccessor.cs" />
|
||||
<Compile Include="Messaging\Nms\Support\Destinations\NmsDestinationAccessor.cs" />
|
||||
<Compile Include="Messaging\Nms\Support\NmsAccessor.cs" />
|
||||
<Compile Include="Messaging\Nms\Support\MessageUtils.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -63,9 +63,9 @@ namespace Spring.Messaging.Nms.Connections
|
||||
|
||||
mocks.ReplayAll();
|
||||
|
||||
MessageTransactionManager tm = new MessageTransactionManager(connectionFactory);
|
||||
NmsTransactionManager tm = new NmsTransactionManager(connectionFactory);
|
||||
ITransactionStatus ts = tm.GetTransaction(new DefaultTransactionDefinition());
|
||||
MessageTemplate nt = new MessageTemplate(connectionFactory);
|
||||
NmsTemplate nt = new NmsTemplate(connectionFactory);
|
||||
nt.Execute(new AssertSessionCallback(session));
|
||||
tm.Commit(ts);
|
||||
|
||||
@@ -84,9 +84,9 @@ namespace Spring.Messaging.Nms.Connections
|
||||
|
||||
mocks.ReplayAll();
|
||||
|
||||
MessageTransactionManager tm = new MessageTransactionManager(connectionFactory);
|
||||
NmsTransactionManager tm = new NmsTransactionManager(connectionFactory);
|
||||
ITransactionStatus ts = tm.GetTransaction(new DefaultTransactionDefinition());
|
||||
MessageTemplate nt = new MessageTemplate(connectionFactory);
|
||||
NmsTemplate nt = new NmsTemplate(connectionFactory);
|
||||
nt.Execute(new AssertSessionCallback(session));
|
||||
tm.Rollback(ts);
|
||||
|
||||
@@ -112,9 +112,9 @@ namespace Spring.Messaging.Nms.Connections
|
||||
mocks.ReplayAll();
|
||||
|
||||
|
||||
MessageTransactionManager tm = new MessageTransactionManager(connectionFactory);
|
||||
NmsTransactionManager tm = new NmsTransactionManager(connectionFactory);
|
||||
ITransactionStatus ts = tm.GetTransaction(new DefaultTransactionDefinition());
|
||||
MessageTemplate nt = new MessageTemplate(connectionFactory);
|
||||
NmsTemplate nt = new NmsTemplate(connectionFactory);
|
||||
nt.Execute(new AssertSessionCallback(session));
|
||||
|
||||
TransactionTemplate tt = new TransactionTemplate(tm);
|
||||
@@ -144,9 +144,9 @@ namespace Spring.Messaging.Nms.Connections
|
||||
|
||||
mocks.ReplayAll();
|
||||
|
||||
MessageTransactionManager tm = new MessageTransactionManager(connectionFactory);
|
||||
NmsTransactionManager tm = new NmsTransactionManager(connectionFactory);
|
||||
ITransactionStatus ts = tm.GetTransaction(new DefaultTransactionDefinition());
|
||||
MessageTemplate nt = new MessageTemplate(connectionFactory);
|
||||
NmsTemplate nt = new NmsTemplate(connectionFactory);
|
||||
nt.Execute(new AssertSessionCallback(session));
|
||||
|
||||
TransactionTemplate tt = new TransactionTemplate(tm);
|
||||
@@ -193,9 +193,9 @@ namespace Spring.Messaging.Nms.Connections
|
||||
|
||||
mocks.ReplayAll();
|
||||
|
||||
MessageTransactionManager tm = new MessageTransactionManager(connectionFactory);
|
||||
NmsTransactionManager tm = new NmsTransactionManager(connectionFactory);
|
||||
ITransactionStatus ts = tm.GetTransaction(new DefaultTransactionDefinition());
|
||||
MessageTemplate nt = new MessageTemplate(connectionFactory);
|
||||
NmsTemplate nt = new NmsTemplate(connectionFactory);
|
||||
nt.Execute(new AssertSessionCallback(session));
|
||||
|
||||
TransactionTemplate tt = new TransactionTemplate(tm);
|
||||
@@ -242,9 +242,9 @@ namespace Spring.Messaging.Nms.Connections
|
||||
|
||||
mocks.ReplayAll();
|
||||
|
||||
MessageTransactionManager tm = new MessageTransactionManager(connectionFactory);
|
||||
NmsTransactionManager tm = new NmsTransactionManager(connectionFactory);
|
||||
ITransactionStatus ts = tm.GetTransaction(new DefaultTransactionDefinition());
|
||||
MessageTemplate nt = new MessageTemplate(connectionFactory);
|
||||
NmsTemplate nt = new NmsTemplate(connectionFactory);
|
||||
|
||||
|
||||
TransactionTemplate tt = new TransactionTemplate(tm);
|
||||
|
||||
@@ -54,9 +54,9 @@ namespace Spring.Messaging.Nms.Core
|
||||
CreateMocks();
|
||||
}
|
||||
|
||||
private MessageTemplate CreateTemplate()
|
||||
private NmsTemplate CreateTemplate()
|
||||
{
|
||||
MessageTemplate template = new MessageTemplate();
|
||||
NmsTemplate template = new NmsTemplate();
|
||||
template.DestinationResolver = mockDestinationResolver;
|
||||
template.SessionTransacted = UseTransactedTemplate;
|
||||
return template;
|
||||
@@ -103,7 +103,7 @@ namespace Spring.Messaging.Nms.Core
|
||||
[Test]
|
||||
public void SessionCallback()
|
||||
{
|
||||
MessageTemplate template = CreateTemplate();
|
||||
NmsTemplate template = CreateTemplate();
|
||||
template.ConnectionFactory = mockConnectionFactory;
|
||||
mockSession.Close();
|
||||
LastCall.On(mockSession).Repeat.Once();
|
||||
@@ -124,7 +124,7 @@ namespace Spring.Messaging.Nms.Core
|
||||
public void SessionCallbackWithinSynchronizedTransaction()
|
||||
{
|
||||
SingleConnectionFactory scf = new SingleConnectionFactory(mockConnectionFactory);
|
||||
MessageTemplate template = CreateTemplate();
|
||||
NmsTemplate template = CreateTemplate();
|
||||
template.ConnectionFactory = scf;
|
||||
|
||||
mockConnection.Start();
|
||||
|
||||
@@ -51,11 +51,11 @@ namespace Spring.Messaging.Nms.Integration
|
||||
Assert.IsNotNull(listener);
|
||||
|
||||
|
||||
MessageTemplate messageTemplate = (MessageTemplate) applicationContext["MessageTemplate"] as MessageTemplate;
|
||||
Assert.IsNotNull(messageTemplate);
|
||||
NmsTemplate nmsTemplate = (NmsTemplate) applicationContext["MessageTemplate"] as NmsTemplate;
|
||||
Assert.IsNotNull(nmsTemplate);
|
||||
|
||||
Assert.AreEqual(0, listener.MessageCount);
|
||||
messageTemplate.ConvertAndSend("Hello World 1");
|
||||
nmsTemplate.ConvertAndSend("Hello World 1");
|
||||
|
||||
int waitInMillis = 2000;
|
||||
Thread.Sleep(waitInMillis);
|
||||
@@ -63,7 +63,7 @@ namespace Spring.Messaging.Nms.Integration
|
||||
|
||||
container.Stop();
|
||||
Console.WriteLine("container stopped.");
|
||||
messageTemplate.ConvertAndSend("Hello World 2");
|
||||
nmsTemplate.ConvertAndSend("Hello World 2");
|
||||
Thread.Sleep(waitInMillis);
|
||||
Assert.AreEqual(1, listener.MessageCount);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user