Issue #51: ActiveMQ 1.6 interfaces have changed
- Updated NMS.ActiveMQ to v1.6.1 and Apache.NMS API to v1.6.0 - Amended wrapper implementation to match new API
This commit is contained in:
Binary file not shown.
BIN
lib/Mono/2.0/Apache.NMS.ActiveMQ.dll.mdb
Normal file
BIN
lib/Mono/2.0/Apache.NMS.ActiveMQ.dll.mdb
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
lib/Mono/2.0/Apache.NMS.dll.mdb
Normal file
BIN
lib/Mono/2.0/Apache.NMS.dll.mdb
Normal file
Binary file not shown.
Binary file not shown.
BIN
lib/Mono/2.0/Ionic.Zlib.dll
Normal file
BIN
lib/Mono/2.0/Ionic.Zlib.dll
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -67,7 +67,7 @@ namespace Spring.Messaging.Nms.Connections
|
||||
{
|
||||
target = targetSession;
|
||||
this.sessionList = sessionList;
|
||||
this.sessionCacheSize = ccf.SessionCacheSize;
|
||||
sessionCacheSize = ccf.SessionCacheSize;
|
||||
shouldCacheProducers = ccf.CacheProducers;
|
||||
shouldCacheConsumers = ccf.CacheConsumers;
|
||||
this.ccf = ccf;
|
||||
@@ -204,17 +204,17 @@ namespace Spring.Messaging.Nms.Connections
|
||||
}
|
||||
|
||||
// Physically close durable subscribers at time of Session close call.
|
||||
List<ConsumerCacheKey> ToRemove = new List<ConsumerCacheKey>();
|
||||
List<ConsumerCacheKey> toRemove = new List<ConsumerCacheKey>();
|
||||
foreach (DictionaryEntry dictionaryEntry in cachedConsumers)
|
||||
{
|
||||
ConsumerCacheKey key = (ConsumerCacheKey) dictionaryEntry.Key;
|
||||
if (key.Subscription != null)
|
||||
{
|
||||
((IMessageConsumer) dictionaryEntry.Value).Close();
|
||||
ToRemove.Add(key);
|
||||
toRemove.Add(key);
|
||||
}
|
||||
}
|
||||
foreach (ConsumerCacheKey key in ToRemove)
|
||||
foreach (ConsumerCacheKey key in toRemove)
|
||||
{
|
||||
cachedConsumers.Remove(key);
|
||||
}
|
||||
@@ -529,6 +529,18 @@ namespace Spring.Messaging.Nms.Connections
|
||||
target.Commit();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops all Message delivery in this session and restarts it again with the oldest unacknowledged message. Messages that were delivered
|
||||
/// but not acknowledged should have their redelivered property set. This is an optional method that may not by implemented by all NMS
|
||||
/// providers, if not implemented an Exception will be thrown. Message redelivery is not requried to be performed in the original
|
||||
/// order. It is not valid to call this method on a Transacted Session.
|
||||
/// </summary>
|
||||
public void Recover()
|
||||
{
|
||||
this.transactionOpen = true;
|
||||
target.Recover();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Rollbacks this instance.
|
||||
/// </summary>
|
||||
@@ -597,6 +609,33 @@ namespace Spring.Messaging.Nms.Connections
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Occurs, when a transaction is started.
|
||||
/// </summary>
|
||||
public event SessionTxEventDelegate TransactionStartedListener
|
||||
{
|
||||
add { target.TransactionStartedListener += value; }
|
||||
remove { target.TransactionStartedListener -= value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Occurs, when a transaction is commited.
|
||||
/// </summary>
|
||||
public event SessionTxEventDelegate TransactionCommittedListener
|
||||
{
|
||||
add { target.TransactionCommittedListener += value; }
|
||||
remove { target.TransactionCommittedListener -= value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Occurs, when a transaction is rolled back.
|
||||
/// </summary>
|
||||
public event SessionTxEventDelegate TransactionRolledBackListener
|
||||
{
|
||||
add { target.TransactionRolledBackListener += value; }
|
||||
remove { target.TransactionRolledBackListener -= value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Call dispose on the target.
|
||||
/// </summary>
|
||||
|
||||
@@ -556,7 +556,11 @@ namespace Spring.Messaging.Nms.Connections
|
||||
|
||||
|
||||
#region Pass through implementations to the target connection
|
||||
|
||||
|
||||
public void PurgeTempDestinations()
|
||||
{
|
||||
target.PurgeTempDestinations();
|
||||
}
|
||||
|
||||
public event ExceptionListener ExceptionListener
|
||||
{
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
using Apache.NMS;
|
||||
using NUnit.Framework;
|
||||
using Spring.Collections;
|
||||
|
||||
namespace Spring.Messaging.Nms.Connections
|
||||
{
|
||||
/// <summary>
|
||||
/// Test suite for <see cref="CachedSession"/>.
|
||||
/// </summary>
|
||||
/// <author>Andreas Kluth</author>
|
||||
[TestFixture]
|
||||
public class CachedSessionTest
|
||||
{
|
||||
/// <summary>
|
||||
/// Validates that events raised by the session cached are propagated to a registered consumer.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void EventsArePropagated()
|
||||
{
|
||||
TestSession targetSession = new TestSession();
|
||||
CachedSession session = CreateCachedSession(targetSession);
|
||||
|
||||
bool committedWasRaised = false;
|
||||
bool rolledBackWasRaised = false;
|
||||
bool startedWasRaised = false;
|
||||
|
||||
session.TransactionCommittedListener += _ => committedWasRaised = true;
|
||||
session.TransactionRolledBackListener += _ => rolledBackWasRaised = true;
|
||||
session.TransactionStartedListener += _ => startedWasRaised = true;
|
||||
|
||||
targetSession.TransactionCommitted();
|
||||
targetSession.TransactionRolledBack();
|
||||
targetSession.TransactionStarted();
|
||||
|
||||
Assert.IsTrue(committedWasRaised);
|
||||
Assert.IsTrue(rolledBackWasRaised);
|
||||
Assert.IsTrue(startedWasRaised);
|
||||
}
|
||||
|
||||
private CachedSession CreateCachedSession(ISession targetSession)
|
||||
{
|
||||
return new CachedSession(targetSession, new LinkedList(), new CachingConnectionFactory());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,6 +54,8 @@ namespace Spring.Messaging.Nms.Connections
|
||||
|
||||
connection.Start();
|
||||
LastCall.On(connection).Repeat.Twice();
|
||||
connection.PurgeTempDestinations();
|
||||
LastCall.On( connection ).Repeat.Twice();
|
||||
connection.Stop();
|
||||
LastCall.On(connection).Repeat.Once();
|
||||
connection.Close();
|
||||
@@ -64,10 +66,12 @@ namespace Spring.Messaging.Nms.Connections
|
||||
SingleConnectionFactory scf = new SingleConnectionFactory(connection);
|
||||
IConnection con1 = scf.CreateConnection();
|
||||
con1.Start();
|
||||
con1.PurgeTempDestinations();
|
||||
con1.Stop(); // should be ignored
|
||||
con1.Close(); // should be ignored
|
||||
IConnection con2 = scf.CreateConnection();
|
||||
con2.Start();
|
||||
con1.PurgeTempDestinations();
|
||||
con2.Stop(); // should be ignored
|
||||
con2.Close(); // should be ignored.
|
||||
scf.Dispose();
|
||||
|
||||
@@ -50,6 +50,11 @@ namespace Spring.Messaging.Nms.Connections
|
||||
closeCount++;
|
||||
}
|
||||
|
||||
public void PurgeTempDestinations()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ConsumerTransformerDelegate ConsumerTransformer
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
|
||||
@@ -75,9 +75,6 @@ namespace Spring.Messaging.Nms.Connections
|
||||
public IMessageConsumer CreateConsumer(IDestination destination, string selector)
|
||||
{
|
||||
return new TestMessageConsumer();
|
||||
//IConnectionFactory connectionFactory = (IConnectionFactory)mocks.CreateMock(typeof(IConnectionFactory));
|
||||
//IMessageConsumer msgConsumer = (IMessageConsumer) mocks.CreateMock(typeof (IMessageConsumer));
|
||||
//return msgConsumer;
|
||||
}
|
||||
|
||||
public IMessageConsumer CreateConsumer(IDestination destination, string selector, TimeSpan requestTimeout)
|
||||
@@ -147,15 +144,11 @@ namespace Spring.Messaging.Nms.Connections
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
#region ISession Members
|
||||
|
||||
public void DeleteDestination(IDestination destination)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public IMessage CreateMessage()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -201,6 +194,11 @@ namespace Spring.Messaging.Nms.Connections
|
||||
closeCount++;
|
||||
}
|
||||
|
||||
public void Recover()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Commit()
|
||||
{
|
||||
|
||||
@@ -239,6 +237,40 @@ namespace Spring.Messaging.Nms.Connections
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
#region Transaction State Events
|
||||
|
||||
public void TransactionStarted()
|
||||
{
|
||||
if(TransactionStartedListener != null)
|
||||
{
|
||||
TransactionStartedListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void TransactionCommitted()
|
||||
{
|
||||
if(TransactionCommittedListener != null)
|
||||
{
|
||||
TransactionCommittedListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void TransactionRolledBack()
|
||||
{
|
||||
if(TransactionRolledBackListener != null)
|
||||
{
|
||||
TransactionRolledBackListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
public event SessionTxEventDelegate TransactionStartedListener;
|
||||
|
||||
public event SessionTxEventDelegate TransactionCommittedListener;
|
||||
|
||||
public event SessionTxEventDelegate TransactionRolledBackListener;
|
||||
|
||||
#endregion
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
@@ -90,6 +90,7 @@
|
||||
<Compile Include="NmsExceptionTests.cs" />
|
||||
<Compile Include="NmsCompilerOptionsTests.cs" />
|
||||
<Compile Include="Messaging\Nms\Config\NmsNamespaceHandlerTests.cs" />
|
||||
<Compile Include="Messaging\Nms\Connections\CachedSessionTest.cs" />
|
||||
<Compile Include="Messaging\Nms\Connections\CachingConnectionFactoryTests.cs" />
|
||||
<Compile Include="Messaging\Nms\Connections\MessageTransactionManagerTests.cs" />
|
||||
<Compile Include="Messaging\Nms\Connections\SingleConnectionFactoryTests.cs" />
|
||||
|
||||
Reference in New Issue
Block a user