diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/ConnectionFactoryUtils.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/ConnectionFactoryUtils.cs index 7f22bf88..44f61981 100644 --- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/ConnectionFactoryUtils.cs +++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/ConnectionFactoryUtils.cs @@ -45,7 +45,7 @@ namespace Spring.Messaging.Nms.Connections /// /// Checks , if available. /// This is essentially a more sophisticated version of - /// + /// /// /// The connection to release. (if this is null, the call will be ignored) /// The ConnectionFactory that the Connection was obtained from. (may be null) @@ -93,7 +93,7 @@ namespace Spring.Messaging.Nms.Connections { return false; } - NmsResourceHolder resourceHolder = (NmsResourceHolder) TransactionSynchronizationManager.GetResource(cf); + MessageResourceHolder resourceHolder = (MessageResourceHolder) 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"); - NmsResourceHolder resourceHolder = - (NmsResourceHolder)TransactionSynchronizationManager.GetResource(resourceKey); + MessageResourceHolder resourceHolder = + (MessageResourceHolder)TransactionSynchronizationManager.GetResource(resourceKey); if (resourceHolder != null) { ISession rhSession = resourceFactory.GetSession(resourceHolder); @@ -162,10 +162,10 @@ namespace Spring.Messaging.Nms.Connections { return null; } - NmsResourceHolder resourceHolderToUse = resourceHolder; + MessageResourceHolder resourceHolderToUse = resourceHolder; if (resourceHolderToUse == null) { - resourceHolderToUse = new NmsResourceHolder(); + resourceHolderToUse = new MessageResourceHolder(); } IConnection con = resourceFactory.GetConnection(resourceHolderToUse); @@ -214,7 +214,7 @@ namespace Spring.Messaging.Nms.Connections if (resourceHolderToUse != resourceHolder) { TransactionSynchronizationManager.RegisterSynchronization( - new NmsResourceSynchronization(resourceKey, resourceHolderToUse, + new MessageResourceSynchronization(resourceKey, resourceHolderToUse, resourceFactory.SynchedLocalTransactionAllowed)); resourceHolderToUse.SynchronizedWithTransaction = true; TransactionSynchronizationManager.BindResource(resourceKey, resourceHolderToUse); @@ -243,12 +243,12 @@ namespace Spring.Messaging.Nms.Connections this.synchedLocalTransactionAllowed = synchedLocalTransactionAllowed; } - public virtual ISession GetSession(NmsResourceHolder holder) + public virtual ISession GetSession(MessageResourceHolder holder) { return holder.GetSession(typeof(ISession), existingCon); } - public virtual IConnection GetConnection(NmsResourceHolder holder) + public virtual IConnection GetConnection(MessageResourceHolder holder) { return (existingCon != null ? existingCon : holder.GetConnection()); } @@ -285,29 +285,29 @@ namespace Spring.Messaging.Nms.Connections /// public interface ResourceFactory { - /// Fetch an appropriate Session from the given NmsResourceHolder. - /// the NmsResourceHolder + /// Fetch an appropriate Session from the given MessageResourceHolder. + /// the MessageResourceHolder /// /// an appropriate Session fetched from the holder, /// or null if none found /// - ISession GetSession(NmsResourceHolder holder); + ISession GetSession(MessageResourceHolder holder); - /// Fetch an appropriate Connection from the given NmsResourceHolder. - /// the NmsResourceHolder + /// Fetch an appropriate Connection from the given MessageResourceHolder. + /// the MessageResourceHolder /// /// an appropriate Connection fetched from the holder, /// or null if none found /// - IConnection GetConnection(NmsResourceHolder holder); + IConnection GetConnection(MessageResourceHolder holder); - /// Create a new NMS Connection for registration with a NmsResourceHolder. + /// Create a new NMS Connection for registration with a MessageResourceHolder. /// the new NMS Connection /// /// NMSException if thrown by NMS API methods IConnection CreateConnection(); - /// Create a new NMS ISession for registration with a NmsResourceHolder. + /// Create a new NMS ISession for registration with a MessageResourceHolder. /// the NMS Connection to create a ISession for /// /// the new NMS Session @@ -329,17 +329,17 @@ namespace Spring.Messaging.Nms.Connections /// Callback for resource cleanup at the end of a non-native NMS transaction /// - private class NmsResourceSynchronization : TransactionSynchronizationAdapter + private class MessageResourceSynchronization : TransactionSynchronizationAdapter { private object resourceKey; - private NmsResourceHolder resourceHolder; + private MessageResourceHolder resourceHolder; private bool transacted; private bool holderActive = true; - public NmsResourceSynchronization(object resourceKey, NmsResourceHolder resourceHolder, bool transacted) + public MessageResourceSynchronization(object resourceKey, MessageResourceHolder resourceHolder, bool transacted) { this.resourceKey = resourceKey; this.resourceHolder = resourceHolder; diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/NmsResourceHolder.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/MessageResourceHolder.cs similarity index 85% rename from src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/NmsResourceHolder.cs rename to src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/MessageResourceHolder.cs index 9964efc7..2ed240ec 100644 --- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/NmsResourceHolder.cs +++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/MessageResourceHolder.cs @@ -29,7 +29,7 @@ using Apache.NMS; namespace Spring.Messaging.Nms.Connections { /// Connection holder, wrapping a NMS Connection and a NMS Session. - /// NmsTransactionManager binds instances of this class to the thread, + /// MessageTransactionManager binds instances of this class to the thread, /// for a given NMS ConnectionFactory. /// ///

Note: This is an SPI class, not intended to be used by applications.

@@ -37,11 +37,11 @@ namespace Spring.Messaging.Nms.Connections ///
/// Juergen Hoeller /// Mark Pollack (.NET) - public class NmsResourceHolder : ResourceHolderSupport + public class MessageResourceHolder : ResourceHolderSupport { #region Logging - private static readonly ILog logger = LogManager.GetLogger(typeof(NmsResourceHolder)); + private static readonly ILog logger = LogManager.GetLogger(typeof(MessageResourceHolder)); #endregion @@ -62,41 +62,41 @@ namespace Spring.Messaging.Nms.Connections #region Constructor (s) - /// Create a new NmsResourceHolder that is open for resources to be added. - public NmsResourceHolder() + /// Create a new MessageResourceHolder that is open for resources to be added. + public MessageResourceHolder() { } /// - /// Initializes a new instance of the class + /// Initializes a new instance of the class /// at is open for resources to be added. /// /// The connection factory that this /// resource holder is associated with (may be null) /// - public NmsResourceHolder(IConnectionFactory connectionFactory) + public MessageResourceHolder(IConnectionFactory connectionFactory) { this.connectionFactory = connectionFactory; } /// - /// Initializes a new instance of the class for the + /// Initializes a new instance of the class for the /// given Session. /// /// The session. - public NmsResourceHolder(ISession session) + public MessageResourceHolder(ISession session) { AddSession(session); frozen = true; } - /// Create a new NmsResourceHolder for the given NMS resources. + /// Create a new MessageResourceHolder for the given NMS resources. /// the NMS Connection /// /// the NMS Session /// - public NmsResourceHolder(IConnection connection, ISession session) + public MessageResourceHolder(IConnection connection, ISession session) { AddConnection(connection); AddSession(session, connection); @@ -104,12 +104,12 @@ namespace Spring.Messaging.Nms.Connections } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The connection factory. /// The connection. /// The session. - public NmsResourceHolder(IConnectionFactory connectionFactory, IConnection connection, ISession session) + public MessageResourceHolder(IConnectionFactory connectionFactory, IConnection connection, ISession session) { this.connectionFactory = connectionFactory; AddConnection(connection); @@ -121,7 +121,7 @@ namespace Spring.Messaging.Nms.Connections #region Properties /// - /// Gets a value indicating whether this is frozen, namely that + /// Gets a value indicating whether this 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. /// @@ -144,7 +144,7 @@ namespace Spring.Messaging.Nms.Connections /// The connection. public void AddConnection(IConnection connection) { - AssertUtils.IsTrue(!frozen, "Cannot add IConnection because NmsResourceHolder is frozen"); + AssertUtils.IsTrue(!frozen, "Cannot add IConnection because MessageResourceHolder is frozen"); AssertUtils.ArgumentNotNull(connection, "IConnection must not be null"); if (!connections.Contains(connection)) { @@ -168,7 +168,7 @@ namespace Spring.Messaging.Nms.Connections /// The connection. public void AddSession(ISession session, IConnection connection) { - AssertUtils.IsTrue(!frozen, "Cannot add ISession because NmsResourceHolder is frozen"); + AssertUtils.IsTrue(!frozen, "Cannot add ISession because MessageResourceHolder is frozen"); AssertUtils.ArgumentNotNull(session, "ISession must not be null"); if (!sessions.Contains(session)) { diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/NmsTransactionManager.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/MessageTransactionManager.cs similarity index 85% rename from src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/NmsTransactionManager.cs rename to src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/MessageTransactionManager.cs index e3a6b294..da5d9494 100644 --- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/NmsTransactionManager.cs +++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/MessageTransactionManager.cs @@ -23,6 +23,7 @@ using System; using System.Data; using Apache.NMS; using Common.Logging; +using Spring.Messaging.Nms; using Spring.Objects.Factory; using Spring.Transaction; using Spring.Transaction.Support; @@ -39,7 +40,7 @@ namespace Spring.Messaging.Nms.Connections /// /// Application code is required to retrieve the transactional Session via /// . Spring's - /// will autodetect a thread-bound Session and + /// will autodetect a thread-bound Session and /// automatically participate in it. /// /// @@ -57,24 +58,24 @@ namespace Spring.Messaging.Nms.Connections /// /// Juergen Hoeller /// Mark Pollack (.NET) - public class NmsTransactionManager : AbstractPlatformTransactionManager, + public class MessageTransactionManager : AbstractPlatformTransactionManager, IResourceTransactionManager, IInitializingObject { #region Logging Definition - private static readonly ILog LOG = LogManager.GetLogger(typeof(NmsTransactionManager)); + private static readonly ILog LOG = LogManager.GetLogger(typeof(MessageTransactionManager)); #endregion private IConnectionFactory connectionFactory; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// /// The ConnectionFactory has to be set before using the instance. - /// This constructor can be used to prepare a NmsTemplate via a ApplicationContext, + /// This constructor can be used to prepare a MessageTemplate via a ApplicationContext, /// typically setting the ConnectionFactory via ConnectionFactory property. /// /// Turns off transaction synchronization by default, as this manager might @@ -83,17 +84,17 @@ namespace Spring.Messaging.Nms.Connections /// Only one manager is allowed to drive synchronization at any point of time. /// /// - public NmsTransactionManager() + public MessageTransactionManager() { TransactionSynchronization = TransactionSynchronizationState.Never; } /// - /// Initializes a new instance of the class + /// Initializes a new instance of the class /// given a ConnectionFactory. /// /// The connection factory to obtain connections from. - public NmsTransactionManager(IConnectionFactory connectionFactory) : this() + public MessageTransactionManager(IConnectionFactory connectionFactory) : this() { ConnectionFactory = connectionFactory; AfterPropertiesSet(); @@ -145,15 +146,15 @@ namespace Spring.Messaging.Nms.Connections /// - /// Get the NmsTransactionObject. + /// Get the MessageTransactionObject. /// - /// he NmsTransactionObject. + /// he MessageTransactionObject. protected override object DoGetTransaction() { - NmsTransactionObject txObject = new NmsTransactionObject(); + MessageTransactionObject txObject = new MessageTransactionObject(); txObject.ResourceHolder = - (NmsResourceHolder) TransactionSynchronizationManager.GetResource(ConnectionFactory); + (MessageResourceHolder) TransactionSynchronizationManager.GetResource(ConnectionFactory); return txObject; } @@ -179,7 +180,7 @@ namespace Spring.Messaging.Nms.Connections { throw new InvalidIsolationLevelException("NMS does not support an isoliation level concept"); } - NmsTransactionObject txObject = (NmsTransactionObject) transaction; + MessageTransactionObject txObject = (MessageTransactionObject) transaction; IConnection con = null; ISession session = null; try @@ -190,7 +191,7 @@ namespace Spring.Messaging.Nms.Connections { log.Debug("Created NMS transaction on Session [" + session + "] from Connection [" + con + "]"); } - txObject.ResourceHolder = new NmsResourceHolder(ConnectionFactory, con, session); + txObject.ResourceHolder = new MessageResourceHolder(ConnectionFactory, con, session); txObject.ResourceHolder.SynchronizedWithTransaction = true; int timeout = DetermineTimeout(definition); if (timeout != DefaultTransactionDefinition.TIMEOUT_DEFAULT) @@ -240,7 +241,7 @@ namespace Spring.Messaging.Nms.Connections /// protected override object DoSuspend(object transaction) { - NmsTransactionObject txObject = (NmsTransactionObject) transaction; + MessageTransactionObject txObject = (MessageTransactionObject) transaction; txObject.ResourceHolder = null; return TransactionSynchronizationManager.UnbindResource(ConnectionFactory); } @@ -259,7 +260,7 @@ namespace Spring.Messaging.Nms.Connections /// protected override void DoResume(object transaction, object suspendedResources) { - NmsResourceHolder conHolder = (NmsResourceHolder) suspendedResources; + MessageResourceHolder conHolder = (MessageResourceHolder) suspendedResources; TransactionSynchronizationManager.BindResource(ConnectionFactory, conHolder); } @@ -272,7 +273,7 @@ namespace Spring.Messaging.Nms.Connections /// protected override void DoCommit(DefaultTransactionStatus status) { - NmsTransactionObject txObject = (NmsTransactionObject)status.Transaction; + MessageTransactionObject txObject = (MessageTransactionObject)status.Transaction; ISession session = txObject.ResourceHolder.GetSession(); try { @@ -299,7 +300,7 @@ namespace Spring.Messaging.Nms.Connections /// protected override void DoRollback(DefaultTransactionStatus status) { - NmsTransactionObject txObject = (NmsTransactionObject)status.Transaction; + MessageTransactionObject txObject = (MessageTransactionObject)status.Transaction; ISession session = txObject.ResourceHolder.GetSession(); try { @@ -326,7 +327,7 @@ namespace Spring.Messaging.Nms.Connections /// protected override void DoSetRollbackOnly(DefaultTransactionStatus status) { - NmsTransactionObject txObject = (NmsTransactionObject)status.Transaction; + MessageTransactionObject txObject = (MessageTransactionObject)status.Transaction; txObject.ResourceHolder.RollbackOnly = true; } @@ -345,7 +346,7 @@ namespace Spring.Messaging.Nms.Connections /// protected override void DoCleanupAfterCompletion(object transaction) { - NmsTransactionObject txObject = (NmsTransactionObject)transaction; + MessageTransactionObject txObject = (MessageTransactionObject)transaction; TransactionSynchronizationManager.UnbindResource(ConnectionFactory); txObject.ResourceHolder.CloseAll(); txObject.ResourceHolder.Clear(); @@ -365,7 +366,7 @@ namespace Spring.Messaging.Nms.Connections /// protected override bool IsExistingTransaction(object transaction) { - NmsTransactionObject txObject = transaction as NmsTransactionObject; + MessageTransactionObject txObject = transaction as MessageTransactionObject; if (txObject != null) { return txObject.ResourceHolder != null; @@ -396,15 +397,15 @@ namespace Spring.Messaging.Nms.Connections /// - /// NMS Transaction object, representing a NmsResourceHolder. - /// Used as transaction object by NmsTransactionManager + /// NMS Transaction object, representing a MessageResourceHolder. + /// Used as transaction object by MessageTransactionManager /// - internal class NmsTransactionObject : ISmartTransactionObject + internal class MessageTransactionObject : ISmartTransactionObject { - private NmsResourceHolder resourceHolder; + private MessageResourceHolder resourceHolder; - public NmsResourceHolder ResourceHolder + public MessageResourceHolder ResourceHolder { get { return resourceHolder; } set { resourceHolder = value; } diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/SingleConnectionFactory.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/SingleConnectionFactory.cs index 7d5b1474..bddc8616 100644 --- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/SingleConnectionFactory.cs +++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/SingleConnectionFactory.cs @@ -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. /// Useful in order to keep using the same Connection for multiple - /// calls, without having a pooling ConnectionFactory + /// calls, without having a pooling ConnectionFactory /// underneath. This may span any number of transactions, even concurrently executing transactions. /// /// diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/IMessageCreator.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/IMessageCreator.cs index 40db1d44..4c0b14df 100644 --- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/IMessageCreator.cs +++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/IMessageCreator.cs @@ -25,7 +25,7 @@ namespace Spring.Messaging.Nms /// Creates a NMS message given a Session /// ///

The Session typically is provided by an instance - /// of the NmsTemplate class.

+ /// of the MessageTemplate class.

///
/// Mark Pollack public interface IMessageCreator diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/INmsOperations.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/IMessageOperations.cs similarity index 97% rename from src/Spring/Spring.Messaging.Nms/Messaging/Nms/INmsOperations.cs rename to src/Spring/Spring.Messaging.Nms/Messaging/Nms/IMessageOperations.cs index 5dc54305..68831c83 100644 --- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/INmsOperations.cs +++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/IMessageOperations.cs @@ -25,10 +25,10 @@ namespace Spring.Messaging.Nms /// Specifies a basic set of NMS operations. /// /// - ///

Implemented by NmsTemplate. Not often used but a useful option + ///

Implemented by MessageTemplate. Not often used but a useful option /// to enhance testability, as it can easily be mocked or stubbed.

/// - ///

Provides NmsTemplate's send(..) and + ///

Provides MessageTemplate's send(..) and /// receive(..) methods that mirror various NMS API methods. /// See the NMS specification and NMS API docs for details on those methods. ///

@@ -36,7 +36,7 @@ namespace Spring.Messaging.Nms /// Mark Pollack /// Juergen Hoeller /// Mark Pollack (.NET) - public interface INmsOperations + public interface IMessageOperations { /// Execute the action specified by the given action object within /// a NMS Session. diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/IMessagePostProcessor.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/IMessagePostProcessor.cs index 3aadd167..28374018 100644 --- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/IMessagePostProcessor.cs +++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/IMessagePostProcessor.cs @@ -22,7 +22,7 @@ using Apache.NMS; namespace Spring.Messaging.Nms { - /// To be used with NmsTemplate's send method that + /// To be used with MessageTemplate's send method that /// convert an object to a message. /// /// diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/IProducerCallback.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/IProducerCallback.cs index d3d909cc..8f5835c0 100644 --- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/IProducerCallback.cs +++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/IProducerCallback.cs @@ -24,7 +24,7 @@ namespace Spring.Messaging.Nms { /// Callback for sending a message to a NMS destination. /// - ///

To be used with the NmsTemplate.Execute(IProducerCallback) + ///

To be used with the MessageTemplate.Execute(IProducerCallback) /// method, often implemented as an anonymous inner class.

/// ///

The typical implementation will perform multiple operations on the diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/ISessionCallback.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/ISessionCallback.cs index f8c2e185..447e1f89 100644 --- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/ISessionCallback.cs +++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/ISessionCallback.cs @@ -26,11 +26,11 @@ namespace Spring.Messaging.Nms /// Session ///

/// - ///

To be used with the NmsTemplate.Execute(ISessionCallback)} + ///

To be used with the MessageTemplate.Execute(ISessionCallback)} /// method, often implemented as an anonymous inner class.

///
/// Mark Pollack - /// + /// /// public interface ISessionCallback { diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/AbstractNmsListeningContainer.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/AbstractListenerContainer.cs similarity index 95% rename from src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/AbstractNmsListeningContainer.cs rename to src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/AbstractListenerContainer.cs index 5f508693..ae3c7855 100644 --- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/AbstractNmsListeningContainer.cs +++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/AbstractListenerContainer.cs @@ -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 - /// base class. + /// base class. ///
/// /// This class provides basic lifecycle management, in particular management @@ -45,11 +45,11 @@ namespace Spring.Messaging.Nms.Listener /// ///
/// Mark Pollack - public abstract class AbstractNmsListeningContainer : NmsDestinationAccessor, ILifecycle, IObjectNameAware, IDisposable + public abstract class AbstractListenerContainer : MessageDestinationAccessor, ILifecycle, IObjectNameAware, IDisposable { #region Logging - private readonly ILog logger = LogManager.GetLogger(typeof(AbstractNmsListeningContainer)); + private readonly ILog logger = LogManager.GetLogger(typeof(AbstractListenerContainer)); #endregion @@ -439,7 +439,7 @@ namespace Spring.Messaging.Nms.Listener bool running = IsRunning; lock (this.sharedConnectionMonitor) { - NmsUtils.CloseConnection(this.sharedConnection, running); + MessagingUtils.CloseConnection(this.sharedConnection, running); IConnection con = CreateConnection(); try @@ -448,7 +448,7 @@ namespace Spring.Messaging.Nms.Listener } catch (Exception) { - NmsUtils.CloseConnection(con); + MessagingUtils.CloseConnection(con); throw; } this.sharedConnection = con; @@ -473,7 +473,7 @@ namespace Spring.Messaging.Nms.Listener return con; } catch (NMSException) { - NmsUtils.CloseConnection(con); + MessagingUtils.CloseConnection(con); throw; } } diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/AbstractMessageListenerContainer.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/AbstractMessageListenerContainer.cs index cd0733f7..7d5a0a4e 100644 --- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/AbstractMessageListenerContainer.cs +++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/AbstractMessageListenerContainer.cs @@ -32,7 +32,7 @@ namespace Spring.Messaging.Nms.Listener /// a standard NMS MessageListener or a Spring-specific /// /// - public abstract class AbstractMessageListenerContainer : AbstractNmsListeningContainer + public abstract class AbstractMessageListenerContainer : AbstractListenerContainer { #region Logging @@ -209,7 +209,7 @@ namespace Spring.Messaging.Nms.Listener /// /// Gets or sets a value indicating whether to expose listener session to a registered - /// as well as to calls. + /// as well as to calls. /// /// /// Default is "true", reusing the listener's Session. @@ -217,8 +217,8 @@ namespace Spring.Messaging.Nms.Listener /// underlying Connection instead, which might be necessary /// on some messaging providers. /// Note that Sessions managed by an external transaction manager will - /// always get exposed to - /// calls. So in terms of NmsTemplate exposure, this setting only affects + /// always get exposed to + /// calls. So in terms of MessageTemplate exposure, this setting only affects /// locally transacted Sessions. /// /// @@ -412,13 +412,13 @@ namespace Spring.Messaging.Nms.Listener if (sessionToUse.Transacted && SessionTransacted) { // Transacted session created by this container -> commit. - NmsUtils.CommitIfNecessary(sessionToUse); + MessagingUtils.CommitIfNecessary(sessionToUse); } } } finally { - NmsUtils.CloseSession(sessionToClose); - NmsUtils.CloseConnection(conToClose); + MessagingUtils.CloseSession(sessionToClose); + MessagingUtils.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)) { - NmsUtils.CommitIfNecessary(session); + MessagingUtils.CommitIfNecessary(session); } } else if (IsClientAcknowledge(session)) @@ -472,7 +472,7 @@ namespace Spring.Messaging.Nms.Listener /// /// true if the is session locally transacted; otherwise, false. /// - /// + /// 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 - NmsUtils.RollbackIfNecessary(session); + MessagingUtils.RollbackIfNecessary(session); } } /// @@ -509,7 +509,7 @@ namespace Spring.Messaging.Nms.Listener { logger.Debug("Initiating transaction rollback on application exception"); } - NmsUtils.RollbackIfNecessary(session); + MessagingUtils.RollbackIfNecessary(session); } } catch (NMSException) { diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/Adapter/MessageListenerAdapter.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/Adapter/MessageListenerAdapter.cs index d83c2ffa..fe8b18a6 100644 --- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/Adapter/MessageListenerAdapter.cs +++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/Adapter/MessageListenerAdapter.cs @@ -457,7 +457,7 @@ namespace Spring.Messaging.Nms.Listener.Adapter } finally { - NmsUtils.CloseMessageProducer(producer); + MessagingUtils.CloseMessageProducer(producer); } } diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/LocallyExposedNmsResourceHolder.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/LocallyExposedMessageResourceHolder.cs similarity index 78% rename from src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/LocallyExposedNmsResourceHolder.cs rename to src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/LocallyExposedMessageResourceHolder.cs index 1eda9a3a..c17b4da2 100644 --- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/LocallyExposedNmsResourceHolder.cs +++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/LocallyExposedMessageResourceHolder.cs @@ -24,18 +24,18 @@ using Spring.Messaging.Nms.Connections; namespace Spring.Messaging.Nms.Listener { /// - /// NmsResourceHolder marker subclass that indicates local exposure, + /// MessageResourceHolder marker subclass that indicates local exposure, /// i.e. that does not indicate an externally managed transaction. /// /// Juergen Hoeller /// Mark Pollack (.NET) - public class LocallyExposedNmsResourceHolder : NmsResourceHolder + public class LocallyExposedMessageResourceHolder : MessageResourceHolder { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The session. - public LocallyExposedNmsResourceHolder(ISession session) : base(session) + public LocallyExposedMessageResourceHolder(ISession session) : base(session) { } diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/SimpleMessageListenerContainer.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/SimpleMessageListenerContainer.cs index 500a2ef9..6b93ce32 100644 --- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/SimpleMessageListenerContainer.cs +++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/SimpleMessageListenerContainer.cs @@ -236,12 +236,12 @@ namespace Spring.Messaging.Nms.Listener logger.Debug("Closing NMS MessageConsumers"); foreach (IMessageConsumer messageConsumer in consumers) { - NmsUtils.CloseMessageConsumer(messageConsumer); + MessagingUtils.CloseMessageConsumer(messageConsumer); } logger.Debug("Closing NMS Sessions"); foreach (ISession session in sessions) { - NmsUtils.CloseSession(session); + MessagingUtils.CloseSession(session); } consumers = null; sessions = null; @@ -295,7 +295,7 @@ namespace Spring.Messaging.Nms.Listener if (exposeResource) { TransactionSynchronizationManager.BindResource( - container.ConnectionFactory, new LocallyExposedNmsResourceHolder(session)); + container.ConnectionFactory, new LocallyExposedMessageResourceHolder(session)); } try { diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/NmsGatewaySupport.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/MessageGatewaySupport.cs similarity index 77% rename from src/Spring/Spring.Messaging.Nms/Messaging/Nms/NmsGatewaySupport.cs rename to src/Spring/Spring.Messaging.Nms/Messaging/Nms/MessageGatewaySupport.cs index 4ce57abe..b25fe45d 100644 --- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/NmsGatewaySupport.cs +++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/MessageGatewaySupport.cs @@ -29,29 +29,29 @@ namespace Spring.Messaging.Nms /// Convenient super class for application classes that need NMS access. /// /// - /// Requires a ConnectionFactory or a NmsTemplate instance to be set. - /// It will create its own NmsTemplate if a ConnectionFactory is passed in. - /// A custom NmsTemplate instance can be created for a given ConnectionFactory + /// Requires a ConnectionFactory or a MessageTemplate instance to be set. + /// It will create its own MessageTemplate if a ConnectionFactory is passed in. + /// A custom MessageTemplate instance can be created for a given ConnectionFactory /// through overriding the createNmsTemplate method. /// /// - public class NmsGatewaySupport : IInitializingObject + public class MessageGatewaySupport : IInitializingObject { #region Logging - private readonly ILog logger = LogManager.GetLogger(typeof(NmsGatewaySupport)); + private readonly ILog logger = LogManager.GetLogger(typeof(MessageGatewaySupport)); #endregion - private NmsTemplate jmsTemplate; + private MessageTemplate jmsTemplate; /// /// Gets or sets the NMS template for the gateway. /// /// The NMS template. - public NmsTemplate NmsTemplate + public MessageTemplate MessageTemplate { get { return jmsTemplate; } set { jmsTemplate = value; } @@ -59,7 +59,7 @@ namespace Spring.Messaging.Nms /// /// Gets or sets he NMS connection factory to be used by the gateway. - /// Will automatically create a NmsTemplate for the given ConnectionFactory. + /// Will automatically create a MessageTemplate for the given ConnectionFactory. /// /// The connection factory. public IConnectionFactory ConnectionFactory @@ -75,17 +75,17 @@ namespace Spring.Messaging.Nms } /// - /// Creates a NmsTemplate for the given ConnectionFactory. + /// Creates a MessageTemplate for the given ConnectionFactory. /// /// Only invoked if populating the gateway with a ConnectionFactory reference. - /// Can be overridden in subclasses to provide a different NmsTemplate instance + /// Can be overridden in subclasses to provide a different MessageTemplate instance /// /// /// The connection factory. /// - protected virtual NmsTemplate CreateNmsTemplate(IConnectionFactory connectionFactory) + protected virtual MessageTemplate CreateNmsTemplate(IConnectionFactory connectionFactory) { - return new NmsTemplate(connectionFactory); + return new MessageTemplate(connectionFactory); } /// diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/NmsTemplate.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/MessageTemplate.cs similarity index 90% rename from src/Spring/Spring.Messaging.Nms/Messaging/Nms/NmsTemplate.cs rename to src/Spring/Spring.Messaging.Nms/Messaging/Nms/MessageTemplate.cs index 41c39beb..b8d687a0 100644 --- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/NmsTemplate.cs +++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/MessageTemplate.cs @@ -47,11 +47,11 @@ namespace Spring.Messaging.Nms /// Mark Pollack /// Juergen Hoeller /// Mark Pollack (.NET) - public class NmsTemplate : NmsDestinationAccessor, INmsOperations + public class MessageTemplate : MessageDestinationAccessor, IMessageOperations { #region Logging - private readonly ILog logger = LogManager.GetLogger(typeof(NmsTemplate)); + private readonly ILog logger = LogManager.GetLogger(typeof(MessageTemplate)); #endregion @@ -63,7 +63,7 @@ namespace Spring.Messaging.Nms /// public static readonly long DEFAULT_RECEIVE_TIMEOUT = -1; - private NmsTemplateResourceFactory transactionalResourceFactory; + private MessageTemplateResourceFactory transactionalResourceFactory; private object defaultDestination; @@ -85,30 +85,28 @@ namespace Spring.Messaging.Nms private bool persistent = NMSConstants.defaultPersistence; private TimeSpan timeToLive; - - private NmsResources jmsResources = new NmsResources(); - + #endregion #region Constructor (s) - /// Create a new NmsTemplate. + /// Create a new MessageTemplate. /// /// Note: The ConnectionFactory has to be set before using the instance. - /// This constructor can be used to prepare a NmsTemplate via an ObjectFactory, + /// This constructor can be used to prepare a MessageTemplate via an ObjectFactory, /// typically setting the ConnectionFactory. /// - public NmsTemplate() + public MessageTemplate() { - transactionalResourceFactory = new NmsTemplateResourceFactory(this); + transactionalResourceFactory = new MessageTemplateResourceFactory(this); InitDefaultStrategies(); } - /// Create a new NmsTemplate, given a ConnectionFactory. + /// Create a new MessageTemplate, given a ConnectionFactory. /// the ConnectionFactory to obtain IConnections from /// - public NmsTemplate(IConnectionFactory connectionFactory) + public MessageTemplate(IConnectionFactory connectionFactory) : this() { ConnectionFactory = connectionFactory; @@ -132,7 +130,7 @@ namespace Spring.Messaging.Nms if (defaultDestination == null) { throw new SystemException( - "No defaultDestination or defaultDestinationName specified. Check configuration of NmsTemplate."); + "No defaultDestination or defaultDestinationName specified. Check configuration of MessageTemplate."); } } @@ -141,7 +139,7 @@ namespace Spring.Messaging.Nms { if (MessageConverter == null) { - throw new SystemException("No messageConverter registered. Check configuration of NmsTemplate."); + throw new SystemException("No messageConverter registered. Check configuration of MessageTemplate."); } } @@ -190,7 +188,7 @@ namespace Spring.Messaging.Nms } finally { - NmsUtils.CloseSession(sessionToClose); + MessagingUtils.CloseSession(sessionToClose); ConnectionFactoryUtils.ReleaseConnection(conToClose, ConnectionFactory, startConnection); } } @@ -371,26 +369,26 @@ namespace Spring.Messaging.Nms #region NMS Factory Methods - /// Fetch an appropriate Connection from the given NmsResourceHolder. + /// Fetch an appropriate Connection from the given MessageResourceHolder. /// - /// the NmsResourceHolder + /// the MessageResourceHolder /// /// an appropriate IConnection fetched from the holder, /// or null if none found /// - protected virtual IConnection GetConnection(NmsResourceHolder holder) + protected virtual IConnection GetConnection(MessageResourceHolder holder) { return holder.GetConnection(); } - /// Fetch an appropriate Session from the given NmsResourceHolder. + /// Fetch an appropriate Session from the given MessageResourceHolder. /// - /// the NmsResourceHolder + /// the MessageResourceHolder /// /// an appropriate ISession fetched from the holder, /// or null if none found /// - protected virtual ISession GetSession(NmsResourceHolder holder) + protected virtual ISession GetSession(MessageResourceHolder holder) { return holder.GetSession(); } @@ -550,12 +548,12 @@ namespace Spring.Messaging.Nms if (session.Transacted && IsSessionLocallyTransacted(session)) { // Transacted session created by this template -> commit. - NmsUtils.CommitIfNecessary(session); + MessagingUtils.CommitIfNecessary(session); } } finally { - NmsUtils.CloseMessageProducer(producer); + MessagingUtils.CloseMessageProducer(producer); } } @@ -581,7 +579,7 @@ namespace Spring.Messaging.Nms #endregion - #region INmsOperations Implementation + #region IMessageOperations Implementation /// Execute the action specified by the given action object within /// a NMS Session. @@ -952,8 +950,8 @@ namespace Spring.Messaging.Nms try { long timeout = ReceiveTimeout; - NmsResourceHolder resourceHolder = - (NmsResourceHolder)TransactionSynchronizationManager.GetResource(ConnectionFactory); + MessageResourceHolder resourceHolder = + (MessageResourceHolder)TransactionSynchronizationManager.GetResource(ConnectionFactory); if (resourceHolder != null && resourceHolder.HasTimeout) { timeout = Convert.ToInt64(resourceHolder.TimeToLiveInMilliseconds); @@ -967,7 +965,7 @@ namespace Spring.Messaging.Nms if (IsSessionLocallyTransacted(session)) { // Transacted session created by this template -> commit. - NmsUtils.CommitIfNecessary(session); + MessagingUtils.CommitIfNecessary(session); } } else if (IsClientAcknowledge(session)) @@ -982,7 +980,7 @@ namespace Spring.Messaging.Nms } finally { - NmsUtils.CloseMessageConsumer(consumer); + MessagingUtils.CloseMessageConsumer(consumer); } } @@ -1106,31 +1104,31 @@ namespace Spring.Messaging.Nms /// /// ResourceFactory implementation that delegates to this template's callback methods. /// - private class NmsTemplateResourceFactory : ConnectionFactoryUtils.ResourceFactory + private class MessageTemplateResourceFactory : ConnectionFactoryUtils.ResourceFactory { - private NmsTemplate enclosingTemplateInstance; + private MessageTemplate enclosingTemplateInstance; - public NmsTemplateResourceFactory(NmsTemplate enclosingInstance) + public MessageTemplateResourceFactory(MessageTemplate enclosingInstance) { InitBlock(enclosingInstance); } - private void InitBlock(NmsTemplate enclosingInstance) + private void InitBlock(MessageTemplate enclosingInstance) { enclosingTemplateInstance = enclosingInstance; } - public NmsTemplate EnclosingInstance + public MessageTemplate EnclosingInstance { get { return enclosingTemplateInstance; } } - public virtual IConnection GetConnection(NmsResourceHolder holder) + public virtual IConnection GetConnection(MessageResourceHolder holder) { return EnclosingInstance.GetConnection(holder); } - public virtual ISession GetSession(NmsResourceHolder holder) + public virtual ISession GetSession(MessageResourceHolder holder) { return EnclosingInstance.GetSession(holder); } @@ -1153,10 +1151,10 @@ namespace Spring.Messaging.Nms private class ProducerCreatorCallback : ISessionCallback { - private NmsTemplate jmsTemplate; + private MessageTemplate jmsTemplate; private IProducerCallback producerCallback; - public ProducerCreatorCallback(NmsTemplate jmsTemplate, IProducerCallback producerCallback) + public ProducerCreatorCallback(MessageTemplate jmsTemplate, IProducerCallback producerCallback) { this.jmsTemplate = jmsTemplate; this.producerCallback = producerCallback; @@ -1171,7 +1169,7 @@ namespace Spring.Messaging.Nms } finally { - NmsUtils.CloseMessageProducer(producer); + MessagingUtils.CloseMessageProducer(producer); } } @@ -1179,18 +1177,18 @@ namespace Spring.Messaging.Nms private class ReceiveCallback : ISessionCallback { - private NmsTemplate jmsTemplate; + private MessageTemplate jmsTemplate; private IDestination destination; private string destinationName; - public ReceiveCallback(NmsTemplate jmsTemplate, string destinationName) + public ReceiveCallback(MessageTemplate jmsTemplate, string destinationName) { this.jmsTemplate = jmsTemplate; this.destinationName = destinationName; } - public ReceiveCallback(NmsTemplate jmsTemplate, IDestination destination) + public ReceiveCallback(MessageTemplate jmsTemplate, IDestination destination) { this.jmsTemplate = jmsTemplate; this.destination = destination; @@ -1214,11 +1212,11 @@ namespace Spring.Messaging.Nms private class ConvertAndSendMessageCreator : IMessageCreator { - private NmsTemplate jmsTemplate; + private MessageTemplate jmsTemplate; private object objectToConvert; private IMessagePostProcessor messagePostProcessor; - public ConvertAndSendMessageCreator(NmsTemplate jmsTemplate, object message, IMessagePostProcessor messagePostProcessor) + public ConvertAndSendMessageCreator(MessageTemplate jmsTemplate, object message, IMessagePostProcessor messagePostProcessor) { this.jmsTemplate = jmsTemplate; objectToConvert = message; @@ -1234,12 +1232,12 @@ namespace Spring.Messaging.Nms private class ReceiveSelectedCallback : ISessionCallback { - private NmsTemplate jmsTemplate; + private MessageTemplate jmsTemplate; private string messageSelector; private string destinationName; private IDestination destination; - public ReceiveSelectedCallback(NmsTemplate jmsTemplate, + public ReceiveSelectedCallback(MessageTemplate jmsTemplate, IDestination destination, string messageSelector) { @@ -1247,7 +1245,7 @@ namespace Spring.Messaging.Nms this.destination = destination; this.messageSelector = messageSelector; } - public ReceiveSelectedCallback(NmsTemplate jmsTemplate, + public ReceiveSelectedCallback(MessageTemplate jmsTemplate, string destinationName, string messageSelector) { @@ -1276,42 +1274,12 @@ namespace Spring.Messaging.Nms #endregion } - /// - /// This is a TIBCO specific class so that we can reuse connections, session, and - /// message producers instead of creating/destroying them on each operation. - /// - internal class NmsResources - { - private IConnection connection; - private ISession session; - private IMessageProducer messageProducer; - - public IConnection Connection - { - get { return connection; } - set { connection = value; } - } - - public ISession Session - { - get { return session; } - set { session = value; } - } - - public IMessageProducer MessageProducer - { - get { return messageProducer; } - set { messageProducer = value; } - } - } - - internal class SimpleMessageCreator : IMessageCreator { - private NmsTemplate jmsTemplate; + private MessageTemplate jmsTemplate; private object objectToConvert; - public SimpleMessageCreator(NmsTemplate jmsTemplate, object objectToConvert) + public SimpleMessageCreator(MessageTemplate jmsTemplate, object objectToConvert) { this.jmsTemplate = jmsTemplate; this.objectToConvert = objectToConvert; @@ -1331,32 +1299,32 @@ namespace Spring.Messaging.Nms { private string destinationName; private IDestination destination; - private NmsTemplate jmsTemplate; + private MessageTemplate jmsTemplate; private IMessageCreator messageCreator; private IMessageCreatorDelegate messageCreatorDelegate; - public SendDestinationCallback(NmsTemplate jmsTemplate, string destinationName, IMessageCreator messageCreator) + public SendDestinationCallback(MessageTemplate jmsTemplate, string destinationName, IMessageCreator messageCreator) { this.jmsTemplate = jmsTemplate; this.destinationName = destinationName; this.messageCreator = messageCreator; } - public SendDestinationCallback(NmsTemplate jmsTemplate, IDestination destination, IMessageCreator messageCreator) + public SendDestinationCallback(MessageTemplate jmsTemplate, IDestination destination, IMessageCreator messageCreator) { this.jmsTemplate = jmsTemplate; this.destination = destination; this.messageCreator = messageCreator; } - public SendDestinationCallback(NmsTemplate jmsTemplate, string destinationName, IMessageCreatorDelegate messageCreatorDelegate) + public SendDestinationCallback(MessageTemplate jmsTemplate, string destinationName, IMessageCreatorDelegate messageCreatorDelegate) { this.jmsTemplate = jmsTemplate; this.destinationName = destinationName; this.messageCreatorDelegate = messageCreatorDelegate; } - public SendDestinationCallback(NmsTemplate jmsTemplate, IDestination destination, IMessageCreatorDelegate messageCreatorDelegate) + public SendDestinationCallback(MessageTemplate jmsTemplate, IDestination destination, IMessageCreatorDelegate messageCreatorDelegate) { this.jmsTemplate = jmsTemplate; this.destination = destination; diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/Converter/SimpleMessageConverter.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/Converter/SimpleMessageConverter.cs index f3acf628..5af6c746 100644 --- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/Converter/SimpleMessageConverter.cs +++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/Converter/SimpleMessageConverter.cs @@ -26,7 +26,7 @@ using Apache.NMS; namespace Spring.Messaging.Nms.Support.Converter { /// A simple message converter that can handle ITextMessages, IBytesMessages, - /// IMapMessages, and IObjectMessages. Used as default by NmsTemplate, for + /// IMapMessages, and IObjectMessages. Used as default by MessageTemplate, for /// ConvertAndSend and ReceiveAndConvert operations. /// ///

Converts a String to a NMS ITextMessage, a byte array to a NMS IBytesMessage, diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/Destinations/IDestinationResolver.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/Destinations/IDestinationResolver.cs index 921305ae..d904b2a3 100644 --- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/Destinations/IDestinationResolver.cs +++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/Destinations/IDestinationResolver.cs @@ -25,13 +25,13 @@ namespace Spring.Messaging.Nms.Support.IDestinations ///

Strategy interface for resolving NMS destinations. /// /// - /// Used by NmsTemplate for resolving + /// Used by MessageTemplate for resolving /// destination names from simple Strings to actual /// IDestination implementation instances. /// /// /// The default DestinationResolver implementation used by - /// NmsTemplate instances is the + /// MessageTemplate instances is the /// DynamicDestinationResolver class. Consider using the /// JndiDestinationResolver for more advanced scenarios. /// diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/Destinations/NmsDestinationAccessor.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/Destinations/NmsDestinationAccessor.cs deleted file mode 100644 index bf33d704..00000000 --- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/Destinations/NmsDestinationAccessor.cs +++ /dev/null @@ -1,112 +0,0 @@ -#region License - -/* - * Copyright © 2002-2006 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#endregion - -using System; -using Spring.Objects.Factory; -using Spring.Util; -using Apache.NMS; - -namespace Spring.Messaging.Nms.Support.IDestinations -{ - /// Base class for NmsTemplate} and other - /// NMS-accessing gateway helpers, adding destination-related properties to - /// NmsAccessor's common properties. - /// - /// - ///

Not intended to be used directly. See NmsTemplate.

- /// - ///
- /// Juergen Hoeller - /// Mark Pollack (.NET) - public class NmsDestinationAccessor : NmsAccessor - { - #region Fields - - private IDestinationResolver destinationResolver = new DynamicDestinationResolver(); - - private bool pubSubDomain = false; - - #endregion - - #region Properties - - /// - /// Gets or sets the destination resolver that is to be used to resolve - /// IDestination references for this accessor. - /// - /// The default resolver is a DynamicDestinationResolver. Specify a - /// JndiDestinationResolver for resolving destination names as JNDI locations. - /// - /// The destination resolver. - virtual public IDestinationResolver DestinationResolver - { - get - { - return destinationResolver; - } - - set - { - AssertUtils.ArgumentNotNull(value, "DestinationResolver must not be null"); - this.destinationResolver = value; - } - - } - - - /// - /// Gets or sets a value indicating whether Publish/Subscribe - /// domain (Topics) is used. Otherwise, the Point-to-Point domain - /// (Queues) is used. - /// - /// - /// this - /// setting tells what type of destination to create if dynamic destinations are enabled. - /// true if Publish/Subscribe domain; otherwise, false - /// for the Point-to-Point domain. - public virtual bool PubSubDomain - { - get - { - return pubSubDomain; - } - - set - { - this.pubSubDomain = value; - } - - } - - #endregion - - /// - /// Resolves the given destination name to a NMS destination. - /// - /// The current session. - /// Name of the destination. - /// The located IDestination - /// If resolution failed. - public virtual IDestination ResolveDestinationName(ISession session, System.String destinationName) - { - return DestinationResolver.ResolveDestinationName(session, destinationName, PubSubDomain); - } - } -} diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/NmsAccessor.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/MessageAccessor.cs similarity index 92% rename from src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/NmsAccessor.cs rename to src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/MessageAccessor.cs index 4d088d95..24704c98 100644 --- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/NmsAccessor.cs +++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/MessageAccessor.cs @@ -25,20 +25,20 @@ using Apache.NMS; namespace Spring.Messaging.Nms.Support { - /// Base class for NmsTemplate and other NMS-accessing gateway helpers + /// Base class for MessageTemplate and other NMS-accessing gateway helpers /// It defines common properties like the ConnectionFactory}. The subclass /// NmsIDestinationAccessor adds further, destination-related properties. /// - /// Not intended to be used directly. See NmsTemplate. + /// Not intended to be used directly. See MessageTemplate. /// /// /// Juergen Hoeller /// Mark Pollack (.NET) - public class NmsAccessor : IInitializingObject + public class MessagingAccessor : IInitializingObject { #region Logging - private readonly ILog logger = LogManager.GetLogger(typeof(NmsAccessor)); + private readonly ILog logger = LogManager.GetLogger(typeof(MessagingAccessor)); #endregion diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/NmsUtils.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/MessageUtils.cs similarity index 96% rename from src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/NmsUtils.cs rename to src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/MessageUtils.cs index 47f3134b..8903083f 100644 --- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/NmsUtils.cs +++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/MessageUtils.cs @@ -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. ///
- public abstract class NmsUtils + public abstract class MessagingUtils { #region Logging - private static readonly ILog logger = LogManager.GetLogger(typeof(NmsUtils)); + private static readonly ILog logger = LogManager.GetLogger(typeof(MessagingUtils)); #endregion diff --git a/src/Spring/Spring.Messaging.Nms/Spring.Messaging.Nms.2005.csproj b/src/Spring/Spring.Messaging.Nms/Spring.Messaging.Nms.2005.csproj index 517aa631..386f67e7 100644 --- a/src/Spring/Spring.Messaging.Nms/Spring.Messaging.Nms.2005.csproj +++ b/src/Spring/Spring.Messaging.Nms/Spring.Messaging.Nms.2005.csproj @@ -54,34 +54,34 @@ - - + + + - + - - + - - + + - - - + + + diff --git a/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Connections/NmsTransactionManagerTests.cs b/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Connections/MessageTransactionManagerTests.cs similarity index 89% rename from test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Connections/NmsTransactionManagerTests.cs rename to test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Connections/MessageTransactionManagerTests.cs index aa56a9bb..a221f25e 100644 --- a/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Connections/NmsTransactionManagerTests.cs +++ b/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Connections/MessageTransactionManagerTests.cs @@ -62,9 +62,9 @@ namespace Spring.Messaging.Nms.Connections mocks.ReplayAll(); - NmsTransactionManager tm = new NmsTransactionManager(connectionFactory); + MessageTransactionManager tm = new MessageTransactionManager(connectionFactory); ITransactionStatus ts = tm.GetTransaction(new DefaultTransactionDefinition()); - NmsTemplate nt = new NmsTemplate(connectionFactory); + MessageTemplate nt = new MessageTemplate(connectionFactory); nt.Execute(new AssertSessionCallback(session)); tm.Commit(ts); @@ -83,9 +83,9 @@ namespace Spring.Messaging.Nms.Connections mocks.ReplayAll(); - NmsTransactionManager tm = new NmsTransactionManager(connectionFactory); + MessageTransactionManager tm = new MessageTransactionManager(connectionFactory); ITransactionStatus ts = tm.GetTransaction(new DefaultTransactionDefinition()); - NmsTemplate nt = new NmsTemplate(connectionFactory); + MessageTemplate nt = new MessageTemplate(connectionFactory); nt.Execute(new AssertSessionCallback(session)); tm.Rollback(ts); @@ -111,9 +111,9 @@ namespace Spring.Messaging.Nms.Connections mocks.ReplayAll(); - NmsTransactionManager tm = new NmsTransactionManager(connectionFactory); + MessageTransactionManager tm = new MessageTransactionManager(connectionFactory); ITransactionStatus ts = tm.GetTransaction(new DefaultTransactionDefinition()); - NmsTemplate nt = new NmsTemplate(connectionFactory); + MessageTemplate nt = new MessageTemplate(connectionFactory); nt.Execute(new AssertSessionCallback(session)); TransactionTemplate tt = new TransactionTemplate(tm); @@ -143,9 +143,9 @@ namespace Spring.Messaging.Nms.Connections mocks.ReplayAll(); - NmsTransactionManager tm = new NmsTransactionManager(connectionFactory); + MessageTransactionManager tm = new MessageTransactionManager(connectionFactory); ITransactionStatus ts = tm.GetTransaction(new DefaultTransactionDefinition()); - NmsTemplate nt = new NmsTemplate(connectionFactory); + MessageTemplate nt = new MessageTemplate(connectionFactory); nt.Execute(new AssertSessionCallback(session)); TransactionTemplate tt = new TransactionTemplate(tm); @@ -192,9 +192,9 @@ namespace Spring.Messaging.Nms.Connections mocks.ReplayAll(); - NmsTransactionManager tm = new NmsTransactionManager(connectionFactory); + MessageTransactionManager tm = new MessageTransactionManager(connectionFactory); ITransactionStatus ts = tm.GetTransaction(new DefaultTransactionDefinition()); - NmsTemplate nt = new NmsTemplate(connectionFactory); + MessageTemplate nt = new MessageTemplate(connectionFactory); nt.Execute(new AssertSessionCallback(session)); TransactionTemplate tt = new TransactionTemplate(tm); @@ -241,9 +241,9 @@ namespace Spring.Messaging.Nms.Connections mocks.ReplayAll(); - NmsTransactionManager tm = new NmsTransactionManager(connectionFactory); + MessageTransactionManager tm = new MessageTransactionManager(connectionFactory); ITransactionStatus ts = tm.GetTransaction(new DefaultTransactionDefinition()); - NmsTemplate nt = new NmsTemplate(connectionFactory); + MessageTemplate nt = new MessageTemplate(connectionFactory); TransactionTemplate tt = new TransactionTemplate(tm); diff --git a/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Integration/SimpleMessageListenerContainerTests.cs b/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Integration/SimpleMessageListenerContainerTests.cs index 3c9c831d..3181c8a9 100644 --- a/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Integration/SimpleMessageListenerContainerTests.cs +++ b/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Integration/SimpleMessageListenerContainerTests.cs @@ -50,11 +50,11 @@ namespace Spring.Messaging.Nms.Integration Assert.IsNotNull(listener); - NmsTemplate nmsTemplate = (NmsTemplate) applicationContext["NmsTemplate"] as NmsTemplate; - Assert.IsNotNull(nmsTemplate); + MessageTemplate messageTemplate = (MessageTemplate) applicationContext["MessageTemplate"] as MessageTemplate; + Assert.IsNotNull(messageTemplate); Assert.AreEqual(0, listener.MessageCount); - nmsTemplate.ConvertAndSend("Hello World 1"); + messageTemplate.ConvertAndSend("Hello World 1"); int waitInMillis = 2000; Thread.Sleep(waitInMillis); @@ -62,7 +62,7 @@ namespace Spring.Messaging.Nms.Integration container.Stop(); Console.WriteLine("container stopped."); - nmsTemplate.ConvertAndSend("Hello World 2"); + messageTemplate.ConvertAndSend("Hello World 2"); Thread.Sleep(waitInMillis); Assert.AreEqual(1, listener.MessageCount);