diff options
| author | Steven Shaw <steshaw@apache.org> | 2006-11-28 23:37:52 +0000 |
|---|---|---|
| committer | Steven Shaw <steshaw@apache.org> | 2006-11-28 23:37:52 +0000 |
| commit | 90218314a8ad1ed4bfb7c6dd1cbb23ee67bd502c (patch) | |
| tree | d6c85cf5631b18c507e10cc9d1dc0b732185a496 /qpid/dotnet/Qpid.Client.Tests | |
| parent | d83a0e745a70209785c12a8da1291cdcf6d0c1cd (diff) | |
| download | qpid-python-90218314a8ad1ed4bfb7c6dd1cbb23ee67bd502c.tar.gz | |
QPID-135 Ported enough transaction support to run FailoverTxTest. Still has same problem as the Java client in that on fail-over the "transaction" continues but the earlier part of the transaction is forgotten.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@480283 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/dotnet/Qpid.Client.Tests')
| -rw-r--r-- | qpid/dotnet/Qpid.Client.Tests/failover/FailoverTxTest.cs | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/qpid/dotnet/Qpid.Client.Tests/failover/FailoverTxTest.cs b/qpid/dotnet/Qpid.Client.Tests/failover/FailoverTxTest.cs index 4e10bcc98e..15be584031 100644 --- a/qpid/dotnet/Qpid.Client.Tests/failover/FailoverTxTest.cs +++ b/qpid/dotnet/Qpid.Client.Tests/failover/FailoverTxTest.cs @@ -59,32 +59,34 @@ namespace Qpid.Client.Tests.failover _log.Info("connectionInfo = " + connectionInfo); _log.Info("connection.asUrl = " + _connection.toURL()); - IChannel channel = _connection.CreateChannel(false, AcknowledgeMode.NoAcknowledge); + IChannel receivingChannel = _connection.CreateChannel(false, AcknowledgeMode.NoAcknowledge); - string queueName = channel.GenerateUniqueName(); + string queueName = receivingChannel.GenerateUniqueName(); // Queue.Declare - channel.DeclareQueue(queueName, false, true, true); + receivingChannel.DeclareQueue(queueName, false, true, true); // No need to call Queue.Bind as automatically bound to default direct exchange. - channel.Bind(queueName, "amq.direct", queueName); + receivingChannel.Bind(queueName, "amq.direct", queueName); - channel.CreateConsumerBuilder(queueName).Create().OnMessage = new MessageReceivedDelegate(onMessage); + receivingChannel.CreateConsumerBuilder(queueName).Create().OnMessage = new MessageReceivedDelegate(onMessage); _connection.Start(); - sendInTx(queueName); + publishInTx(queueName); + + Thread.Sleep(2000); // Wait a while for last messages. _connection.Close(); _log.Info("FailoverTxText complete"); } - private void sendInTx(string routingKey) + private void publishInTx(string routingKey) { _log.Info("sendInTx"); - bool transacted = false; - IChannel channel = _connection.CreateChannel(transacted, AcknowledgeMode.NoAcknowledge); - IMessagePublisher publisher = channel.CreatePublisherBuilder() + bool transacted = true; + IChannel publishingChannel = _connection.CreateChannel(transacted, AcknowledgeMode.NoAcknowledge); + IMessagePublisher publisher = publishingChannel.CreatePublisherBuilder() .withRoutingKey(routingKey) .Create(); @@ -92,12 +94,12 @@ namespace Qpid.Client.Tests.failover { for (int j = 1; j <= NUM_MESSAGES; ++j) { - ITextMessage msg = channel.CreateTextMessage("Tx=" + i + " msg=" + j); + ITextMessage msg = publishingChannel.CreateTextMessage("Tx=" + i + " msg=" + j); _log.Info("sending message = " + msg.Text); publisher.Send(msg); Thread.Sleep(SLEEP_MILLIS); } - if (transacted) channel.Commit(); + if (transacted) publishingChannel.Commit(); } } |
