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 | fabf031b77cbf1784a25039fc79bcb21b820d4b8 (patch) | |
| tree | cb2aed1968622147ffef540857205e5a24d5e604 /dotnet/Qpid.Client.Tests | |
| parent | 383a2c3ba7afb9f3c49b6980b3b64439e9e8e6ae (diff) | |
| download | qpid-python-fabf031b77cbf1784a25039fc79bcb21b820d4b8.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/qpid@480283 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'dotnet/Qpid.Client.Tests')
| -rw-r--r-- | dotnet/Qpid.Client.Tests/failover/FailoverTxTest.cs | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/dotnet/Qpid.Client.Tests/failover/FailoverTxTest.cs b/dotnet/Qpid.Client.Tests/failover/FailoverTxTest.cs index 4e10bcc98e..15be584031 100644 --- a/dotnet/Qpid.Client.Tests/failover/FailoverTxTest.cs +++ b/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(); } } |
