completed messaging documentation. Minor improvements to NMS apis using delegates.

This commit is contained in:
markpollack
2008-08-07 05:16:34 +00:00
parent bc6029a8a7
commit f2410efaf6
21 changed files with 1247 additions and 429 deletions

View File

@@ -20,6 +20,7 @@
#region Imports
using System;
using System.Collections;
using Apache.NMS;
using NUnit.Framework;
@@ -62,6 +63,7 @@ namespace Spring.Messaging.Nms.Core
return template;
}
protected virtual bool UseTransactedSession
{
get { return false; }
@@ -163,25 +165,25 @@ namespace Spring.Messaging.Nms.Core
});
Assert.AreSame(mockSession, ConnectionFactoryUtils.GetTransactionalSession(scf, null, false));
Assert.AreSame(mockSession, ConnectionFactoryUtils.GetTransactionalSession(scf, scf.CreateConnection(), false));
Assert.AreSame(mockSession,
ConnectionFactoryUtils.GetTransactionalSession(scf, scf.CreateConnection(), false));
//In Java this test was doing 'double-duty' and testing TransactionAwareConnectionFactoryProxy, which has
//not been implemented in .NET
template.Execute(delegate(ISession session)
{
bool b = session.Transacted;
return null;
});
{
bool b = session.Transacted;
return null;
});
IList synchs = TransactionSynchronizationManager.Synchronizations;
Assert.AreEqual(1, synchs.Count);
ITransactionSynchronization synch = (ITransactionSynchronization)synchs[0];
ITransactionSynchronization synch = (ITransactionSynchronization) synchs[0];
synch.BeforeCommit(false);
synch.BeforeCompletion();
synch.AfterCommit();
synch.AfterCompletion(TransactionSynchronizationStatus.Unknown);
}
finally
{

View File

@@ -34,6 +34,14 @@ namespace Spring.Messaging.Nms.Integration
lastReceivedMessage = message;
messageCount++;
LOG.Debug("Message listener count = " + messageCount);
ITextMessage textMessage = message as ITextMessage;
if (textMessage != null)
{
LOG.Info("Message Text = " + textMessage.Text);
} else
{
LOG.Warn("Can not process message of type " message.GetType());
}
}
#endregion