diff options
Diffstat (limited to 'dotnet/Qpid.Integration.Tests/interop')
7 files changed, 0 insertions, 1502 deletions
diff --git a/dotnet/Qpid.Integration.Tests/interop/InteropClientTestCase.cs b/dotnet/Qpid.Integration.Tests/interop/InteropClientTestCase.cs deleted file mode 100644 index 09361b33e8..0000000000 --- a/dotnet/Qpid.Integration.Tests/interop/InteropClientTestCase.cs +++ /dev/null @@ -1,87 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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. - * - */ -using System; -using System.Text; -using Apache.Qpid.Messaging; - -namespace Apache.Qpid.Integration.Tests.interop -{ - /// <summary> Defines the possible test case roles that an interop test case can take on. </summary> - public enum Roles { SENDER, RECEIVER }; - - /// <summary> - /// InteropClientTestCase provides an interface that classes implementing test cases from the interop testing spec - /// (http://cwiki.apache.org/confluence/display/qpid/Interop+Testing+Specification) should implement. - /// - /// <p><table id="crc"><caption>CRC Card</caption> - /// <tr><th> Responsibilities - /// <tr><td> Supply the name of the test case that this implements. - /// <tr><td> Accept/Reject invites based on test parameters. - /// <tr><td> Adapt to assigned roles. - /// <tr><td> Perform test case actions. - /// <tr><td> Generate test reports. - /// </table> - /// </summary> - interface InteropClientTestCase - { - /// <summary> - /// Should provide the name of the test case that this class implements. The exact names are defined in the - /// interop testing spec. - /// </summary> - /// - /// <returns> The name of the test case that this implements. </returns> - string GetName(); - - /// <summary> - /// Determines whether the test invite that matched this test case is acceptable. - /// </summary> - /// - /// <param name="inviteMessage"> The invitation to accept or reject. </param> - /// - /// <returns> <tt>true</tt> to accept the invitation, <tt>false</tt> to reject it. </returns> - /// - /// @throws JMSException Any JMSException resulting from reading the message are allowed to fall through. - bool AcceptInvite(IMessage inviteMessage); - - /// <summary> - /// Assigns the role to be played by this test case. The test parameters are fully specified in the - /// assignment message. When this method return the test case will be ready to execute. - /// </summary> - /// - /// <param name="role"> The role to be played; sender or receiver. </param> - /// <param name="assignRoleMessage"> The role assingment message, contains the full test parameters. </param> - void AssignRole(Roles role, IMessage assignRoleMessage); - - /// <summary> - /// Performs the test case actions. - /// </summary> - void Start(); - - /// <summary> - /// Gets a report on the actions performed by the test case in its assigned role. - /// </summary> - /// - /// <param name="session"> The session to create the report message in. </param> - /// - /// <returns> The report message. </returns> - IMessage GetReport(IChannel channel); - } -} diff --git a/dotnet/Qpid.Integration.Tests/interop/TestCases/TestCase1DummyRun.cs b/dotnet/Qpid.Integration.Tests/interop/TestCases/TestCase1DummyRun.cs deleted file mode 100644 index d908b7af0b..0000000000 --- a/dotnet/Qpid.Integration.Tests/interop/TestCases/TestCase1DummyRun.cs +++ /dev/null @@ -1,89 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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. - * - */ -using System; -using System.Text; -using log4net; -using Apache.Qpid.Messaging; - -namespace Apache.Qpid.Integration.Tests.interop.TestCases -{ - /// <summary> - /// Implements tet case 1, dummy run. This test case sends no test messages, it exists to confirm that the test harness - /// is interacting with the coordinator correctly. - /// - /// <p><table id="crc"><caption>CRC Card</caption> - /// <tr><th> Responsibilities <th> Collaborations - /// <tr><td> Supply the name of the test case that this implements. - /// <tr><td> Accept/Reject invites based on test parameters. - /// <tr><td> Adapt to assigned roles. - /// <tr><td> Perform test case actions. - /// <tr><td> Generate test reports. - /// </table> - /// </summary> - public class TestCase1DummyRun : InteropClientTestCase - { - private static ILog log = LogManager.GetLogger(typeof(TestCase1DummyRun)); - - public String GetName() - { - log.Debug("public String getName(): called"); - - return "TC1_DummyRun"; - } - - public bool AcceptInvite(IMessage inviteMessage) - { - log.Debug("public boolean acceptInvite(Message inviteMessage): called"); - - // Test parameters don't matter, accept all invites. - return true; - } - - public void AssignRole(Roles role, IMessage assignRoleMessage) - { - log.Debug("public void assignRole(Roles role, Message assignRoleMessage): called"); - - // Do nothing, both roles are the same. - } - - public void Start() - { - log.Debug("public void start(): called"); - - // Do nothing. - } - - public IMessage GetReport(IChannel channel) - { - log.Debug("public Message getReport(Session session): called"); - - // Generate a dummy report, the coordinator expects a report but doesn't care what it is. - return channel.CreateTextMessage("Dummy Run, Ok."); - } - - public void OnMessage(IMessage message) - { - log.Debug("public void onMessage(Message message = " + message + "): called"); - - // Ignore any messages. - } - } -} diff --git a/dotnet/Qpid.Integration.Tests/interop/TestCases/TestCase2BasicP2P.cs b/dotnet/Qpid.Integration.Tests/interop/TestCases/TestCase2BasicP2P.cs deleted file mode 100644 index 8993da832e..0000000000 --- a/dotnet/Qpid.Integration.Tests/interop/TestCases/TestCase2BasicP2P.cs +++ /dev/null @@ -1,205 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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. - * - */ -using System; -using System.Text; -using log4net; -using Apache.Qpid.Messaging; - -namespace Apache.Qpid.Integration.Tests.interop.TestCases -{ - /// <summary> - /// Implements test case 2, basic P2P. Sends/receives a specified number of messages to a specified route on the - /// default direct exchange. Produces reports on the actual number of messages sent/received. - /// - /// <p><table id="crc"><caption>CRC Card</caption> - /// <tr><th> Responsibilities <th> Collaborations - /// <tr><td> Supply the name of the test case that this implements. - /// <tr><td> Accept/Reject invites based on test parameters. - /// <tr><td> Adapt to assigned roles. - /// <tr><td> Send required number of test messages. - /// <tr><td> Generate test reports. - /// </table> - /// </summary> - public class TestCase2BasicP2P : InteropClientTestCase - { - /// <summary> Used for debugging. </summary> - private static ILog log = LogManager.GetLogger(typeof(TestCase2BasicP2P)); - - /// <summary> Holds the count of test messages received. </summary> - private int messageCount; - - /// <summary> The role to be played by the test. </summary> - private Roles role; - - /// <summary> The number of test messages to send. </summary> - private int numMessages; - - /// <summary> The routing key to send them to on the default direct exchange. </summary> - private string sendDestination; - - /// <summary> The connection to send the test messages on. </summary> - private IConnection connection; - - /// <summary> The session to send the test messages on. </summary> - private IChannel channel; - - /// <summary> The producer to send the test messages with. </summary> - private IMessagePublisher publisher; - - /// <summary> - /// Should provide the name of the test case that this class implements. The exact names are defined in the - /// interop testing spec. - /// </summary> - /// - /// <returns> The name of the test case that this implements. </returns> - public String GetName() - { - log.Debug("public String GetName(): called"); - - return "TC2_BasicP2P"; - } - - /// <summary> - /// Determines whether the test invite that matched this test case is acceptable. - /// </summary> - /// - /// <param name="inviteMessage"> The invitation to accept or reject. </param> - /// - /// <returns> <tt>true</tt> to accept the invitation, <tt>false</tt> to reject it. </returns> - public bool AcceptInvite(IMessage inviteMessage) - { - log.Debug("public boolean AcceptInvite(Message inviteMessage = " + inviteMessage + "): called"); - - // All invites are acceptable. - return true; - } - - /// <summary> - /// Assigns the role to be played by this test case. The test parameters are fully specified in the - /// assignment message. When this method return the test case will be ready to execute. - /// </summary> - /// - /// <param name="role"> The role to be played; sender or receiver. </param> - /// <param name="assignRoleMessage"> The role assingment message, contains the full test parameters. </param> - public void AssignRole(Roles role, IMessage assignRoleMessage) - { - log.Debug("public void AssignRole(Roles role = " + role + ", Message assignRoleMessage = " + assignRoleMessage - + "): called"); - - // Reset the message count for a new test. - messageCount = 0; - - // Take note of the role to be played. - this.role = role; - - // Create a new connection to pass the test messages on. - connection = - TestClient.CreateConnection(TestClient.brokerUrl, TestClient.virtualHost); - channel = connection.CreateChannel(false, AcknowledgeMode.AutoAcknowledge); - - // Extract and retain the test parameters. - numMessages = assignRoleMessage.Headers.GetInt("P2P_NUM_MESSAGES"); - string queueAndKeyName = assignRoleMessage.Headers.GetString("P2P_QUEUE_AND_KEY_NAME"); - channel.DeclareQueue(queueAndKeyName, false, true, true); - channel.Bind(queueAndKeyName, ExchangeNameDefaults.DIRECT, queueAndKeyName); - sendDestination = queueAndKeyName; - - log.Debug("numMessages = " + numMessages); - log.Debug("sendDestination = " + sendDestination); - log.Debug("role = " + role); - - switch (role) - { - // Check if the sender role is being assigned, and set up a message producer if so. - case Roles.SENDER: - publisher = channel.CreatePublisherBuilder() - .WithExchangeName(ExchangeNameDefaults.DIRECT) - .WithRoutingKey(sendDestination) - .Create(); - break; - - // Otherwise the receiver role is being assigned, so set this up to listen for messages. - case Roles.RECEIVER: - IMessageConsumer consumer = channel.CreateConsumerBuilder(sendDestination).Create(); - consumer.OnMessage += new MessageReceivedDelegate(OnMessage); - - break; - } - - connection.Start(); - } - - /// <summary> Performs the test case actions. </summary> - public void Start() - { - log.Debug("public void start(): called"); - - // Check that the sender role is being performed. - if (role == Roles.SENDER) - { - IMessage testMessage = channel.CreateTextMessage("test"); - - for (int i = 0; i < numMessages; i++) - { - publisher.Send(testMessage); - - // Increment the message count. - messageCount++; - } - } - } - - /// <summary> - /// Gets a report on the actions performed by the test case in its assigned role. - /// </summary> - /// - /// <param name="session"> The session to create the report message in. </param> - /// - /// <returns> The report message. </returns> - public IMessage GetReport(IChannel channel) - { - log.Debug("public Message GetReport(IChannel channel): called"); - - // Close the test connection. - //connection.Stop(); - - // Generate a report message containing the count of the number of messages passed. - IMessage report = channel.CreateMessage(); - //report.Headers.SetString("CONTROL_TYPE", "REPORT"); - report.Headers.SetInt("MESSAGE_COUNT", messageCount); - - return report; - } - - /// <summary> - /// Counts incoming test messages. - /// </summary> - /// - /// <param name="message"> The incoming test message. </param> - public void OnMessage(IMessage message) - { - log.Debug("public void OnMessage(IMessage message = " + message + "): called"); - - // Increment the message count. - messageCount++; - } - } -} diff --git a/dotnet/Qpid.Integration.Tests/interop/TestCases/TestCase3BasicPubSub.cs b/dotnet/Qpid.Integration.Tests/interop/TestCases/TestCase3BasicPubSub.cs deleted file mode 100644 index 79c0322bcd..0000000000 --- a/dotnet/Qpid.Integration.Tests/interop/TestCases/TestCase3BasicPubSub.cs +++ /dev/null @@ -1,244 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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. - * - */ -using System; -using System.Text; -using log4net; -using Apache.Qpid.Messaging; - -namespace Apache.Qpid.Integration.Tests.interop.TestCases -{ - /// <summary> - /// Implements test case 3, basic pub/sub. Sends/received a specified number of messages to a specified route on the - /// default topic exchange, using the specified number of receiver connections. Produces reports on the actual number of - /// messages sent/received. - /// - /// <p><table id="crc"><caption>CRC Card</caption> - /// <tr><th> Responsibilities <th> Collaborations - /// <tr><td> Supply the name of the test case that this implements. - /// <tr><td> Accept/Reject invites based on test parameters. - /// <tr><td> Adapt to assigned roles. - /// <tr><td> Send required number of test messages using pub/sub. - /// <tr><td> Generate test reports. - /// </table> - /// </summary> - public class TestCase3BasicPubSub : InteropClientTestCase - { - /// <summary> Used for debugging. </summary> - private static ILog log = LogManager.GetLogger(typeof(TestCase3BasicPubSub)); - - /// <summary> Holds the count of test messages received. </summary> - private int messageCount; - - /// <summary> The role to be played by the test. </summary> - private Roles role; - - /// <summary> The number of test messages to send. </summary> - private int numMessages; - - /// <summary> The number of receiver connection to use. </summary> - private int numReceivers; - - /// <summary> The routing key to send them to on the default direct exchange. </summary> - private string sendDestination; - - /// <summary> The connections to send/receive the test messages on. </summary> - private IConnection[] connection; - - /// <summary> The sessions to send/receive the test messages on. </summary> - private IChannel[] channel; - - /// <summary> The producer to send the test messages with. </summary> - IMessagePublisher publisher; - - /// <summary> - /// Should provide the name of the test case that this class implements. The exact names are defined in the - /// interop testing spec. - /// </summary> - /// - /// <returns> The name of the test case that this implements. </returns> - public String GetName() - { - log.Debug("public String GetName(): called"); - - return "TC3_BasicPubSub"; - } - - /// <summary> - /// Determines whether the test invite that matched this test case is acceptable. - /// </summary> - /// - /// <param name="inviteMessage"> The invitation to accept or reject. </param> - /// - /// <returns> <tt>true</tt> to accept the invitation, <tt>false</tt> to reject it. </returns> - public bool AcceptInvite(IMessage inviteMessage) - { - log.Debug("public boolean AcceptInvite(IMessage inviteMessage = " + inviteMessage + "): called"); - - // All invites are acceptable. - return true; - } - - /// <summary> - /// Assigns the role to be played by this test case. The test parameters are fully specified in the - /// assignment message. When this method return the test case will be ready to execute. - /// </summary> - /// - /// <param name="role"> The role to be played; sender or receiver. </param> - /// <param name="assignRoleMessage"> The role assingment message, contains the full test parameters. </param> - public void AssignRole(Roles role, IMessage assignRoleMessage) - { - log.Debug("public void assignRole(Roles role = " + role + ", IMessage assignRoleMessage = " + assignRoleMessage - + "): called"); - - // Reset the message count for a new test. - messageCount = 0; - - // Take note of the role to be played. - this.role = role; - - // Extract and retain the test parameters. - numMessages = assignRoleMessage.Headers.GetInt("PUBSUB_NUM_MESSAGES"); - numReceivers = assignRoleMessage.Headers.GetInt("PUBSUB_NUM_RECEIVERS"); - string sendKey = assignRoleMessage.Headers.GetString("PUBSUB_KEY"); - sendDestination = sendKey; - - log.Debug("numMessages = " + numMessages); - log.Debug("numReceivers = " + numReceivers); - log.Debug("sendKey = " + sendKey); - log.Debug("role = " + role); - - switch (role) - { - // Check if the sender role is being assigned, and set up a single message producer if so. - case Roles.SENDER: - // Create a new connection to pass the test messages on. - connection = new IConnection[1]; - channel = new IChannel[1]; - - connection[0] = - TestClient.CreateConnection(TestClient.brokerUrl, TestClient.virtualHost); - channel[0] = connection[0].CreateChannel(false, AcknowledgeMode.AutoAcknowledge); - - // Extract and retain the test parameters. - publisher = channel[0].CreatePublisherBuilder() - .WithExchangeName(ExchangeNameDefaults.TOPIC) - .WithRoutingKey(sendDestination) - .WithMandatory(false) - .WithImmediate(false) - .Create(); - break; - - // Otherwise the receiver role is being assigned, so set this up to listen for messages on the required number - // of receiver connections. - case Roles.RECEIVER: - // Create the required number of receiver connections. - connection = new IConnection[numReceivers]; - channel = new IChannel[numReceivers]; - - for (int i = 0; i < numReceivers; i++) - { - connection[i] = - TestClient.CreateConnection(TestClient.brokerUrl, TestClient.virtualHost); - channel[i] = connection[i].CreateChannel(false, AcknowledgeMode.AutoAcknowledge); - - IMessageConsumer consumer = channel[i].CreateConsumerBuilder(sendDestination).Create(); - consumer.OnMessage += new MessageReceivedDelegate(OnMessage); - } - - break; - } - - // Start all the connection dispatcher threads running. - foreach (IConnection con in connection) - { - con.Start(); - } - } - - /// <summary> - /// Performs the test case actions. - /// </summary> - public void Start() - { - log.Debug("public void Start(): called"); - - // Check that the sender role is being performed. - if (role == Roles.SENDER) - { - IMessage testMessage = channel[0].CreateTextMessage("test"); - - for (int i = 0; i < numMessages; i++) - { - publisher.Send(testMessage); - - // Increment the message count. - messageCount++; - } - } - } - - /// <summary> - /// Gets a report on the actions performed by the test case in its assigned role. - /// </summary> - /// - /// <param name="session"> The session to create the report message in. </param> - /// - /// <returns> The report message. </returns> - public IMessage GetReport(IChannel channel) - { - log.Debug("public IMessage getReport(IChannel channel): called"); - - // Close the test connections. - /*foreach (IConnection con in connection) - { - try - { - con.Stop(); - } - catch (AMQConnectionClosedException e) - { - // The connection has already died due to an error. Log this as a warning. - log.Warn("Connection already closed."); - } - }*/ - - // Generate a report message containing the count of the number of messages passed. - IMessage report = channel.CreateMessage(); - //report.Headers.SetString("CONTROL_TYPE", "REPORT"); - report.Headers.SetInt("MESSAGE_COUNT", messageCount); - - return report; - } - - /// <summary> - /// Counts incoming test messages. - /// </summary> - /// - /// <param name="message"> The incoming test message. </param> - public void OnMessage(IMessage message) - { - log.Debug("public void onMessage(IMessage message = " + message + "): called"); - - // Increment the message count. - messageCount++; - } - } -} diff --git a/dotnet/Qpid.Integration.Tests/interop/TestCases/TestCase4P2PMessageSize.cs b/dotnet/Qpid.Integration.Tests/interop/TestCases/TestCase4P2PMessageSize.cs deleted file mode 100644 index fd83825a61..0000000000 --- a/dotnet/Qpid.Integration.Tests/interop/TestCases/TestCase4P2PMessageSize.cs +++ /dev/null @@ -1,244 +0,0 @@ -/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
- */
-
-using System;
-using System.Text;
-using log4net;
-using Apache.Qpid.Messaging;
-
-namespace Apache.Qpid.Integration.Tests.interop.TestCases
-{
- ///
- /// Implements test case 4, from the interop test specification. This test sets up the TC2_P2PMessageSize test for 50
- /// messages, and a variety of message sizes. It checks that the sender and receivers reports both indicate that all
- /// the test messages were transmitted successfully.
- ///
- /// <p><table id="crc"><caption>CRC Card</caption>
- /// <tr><th> Responsibilities <th> Collaborations
- /// <tr><td> Setup p2p test parameters and compare with test output. <td> {@link FrameworkBaseCase}
- /// </table>
- ///
- public class TestCase4P2PMessageSize : InteropClientTestCase
- {
- /// Used for debugging.
- private static ILog log = LogManager.GetLogger(typeof(TestCase4P2PMessageSize));
-
- /// <summary> The role to be played by the test. </summary>
- private Roles role;
-
- /// <summary> Holds the count of test messages received. </summary>
- private int messageCount;
-
- ///<summary>The size of the message to be sent </summary>
- private int messageSize;
-
- /// <summary> The number of test messages to send. </summary>
- private int numMessages;
-
- /// <summary> The number of receiver connection to use. </summary>
- private int numReceivers;
-
- /// <summary> The routing key to send them to on the default direct exchange. </summary>
- private string sendDestination;
-
- /// <summary> The connections to send/receive the test messages on. </summary>
- private IConnection[] connection;
-
- /// <summary> The sessions to send/receive the test messages on. </summary>
- private IChannel[] channel;
-
- /// <summary> The producer to send the test messages with. </summary>
- IMessagePublisher publisher;
-
- /// <summary>
- /// Creates a new coordinating test case with the specified name.
- ///</summary>
- /// <returns>The test case name.</returns>
- ///
- public String GetName()
- {
- log.Info("public String GetName(): called");
- return "TC4_P2PMessageSize";
- }
-
- /// <summary>
- /// Determines whether the test invite that matched this test case is acceptable.
- /// </summary>
- ///
- /// <param name="inviteMessage"> The invitation to accept or reject. </param>
- ///
- /// <returns> <tt>true</tt> to accept the invitation, <tt>false</tt> to reject it. </returns>
- public bool AcceptInvite(IMessage inviteMessage)
- {
- log.Info("public boolean AcceptInvite(IMessage inviteMessage = " + inviteMessage + "): called");
- // All invites are acceptable.
- return true;
- }
-
- public void Start()
- {
- log.Info("public void start(): called");
- // Assuming numMessages = 1
- Start(1);
- }
-
- public void Start(int numMessages)
- {
- log.Info("public void start("+numMessages+"): called");
-
- // Check that the sender role is being performed.
- if (role == Roles.SENDER)
- {
- IMessage testMessage = createMessageOfSize(messageSize);
-
-
- for (int i = 0; i < numMessages; i++)
- {
- publisher.Send(testMessage);
-
- // Increment the message count.
- messageCount++;
- }
- }
-
- }
-
- private IMessage createMessageOfSize(int size)
- {
- IBytesMessage message = channel[0].CreateBytesMessage();
- string messageStr = "Test Message -- Test Message -- Test Message -- Test Message -- Test Message -- Test Message -- Test Message -- ";
- System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
- byte[] messageBytes = encoding.GetBytes(messageStr);
-
- if (size > 0)
- {
- int div = size / messageBytes.Length;
- int mod = size % messageBytes.Length;
-
- for (int i = 0; i < div; i++)
- {
- message.WriteBytes(messageBytes);
- }
- if (mod != 0)
- {
- message.WriteBytes(messageBytes, 0, mod);
- }
- }
- return message;
- }
-
- public void AssignRole(Roles role, IMessage assignRoleMessage)
- {
- log.Info("public void assignRole(Roles role = " + role + ", IMessage assignRoleMessage = " + assignRoleMessage
- + "): called");
-
- // Reset the message count for a new test.
- messageCount = 0;
-
- // Take note of the role to be played.
- this.role = role;
-
- // Extract and retain the test parameters.
- numMessages = assignRoleMessage.Headers.GetInt("P2P_NUM_MESSAGES");
- messageSize = assignRoleMessage.Headers.GetInt("messageSize");
-
- string sendKey = assignRoleMessage.Headers.GetString("P2P_QUEUE_AND_KEY_NAME");
- sendDestination = sendKey;
-
- log.Info("numMessages = " + numMessages);
- log.Info("messageSize = " + messageSize);
- log.Info("sendKey = " + sendKey);
- log.Info("role = " + role);
-
- switch (role)
- {
- // Check if the sender role is being assigned, and set up a single message producer if so.
- case Roles.SENDER:
- // Create a new connection to pass the test messages on.
- connection = new IConnection[1];
- channel = new IChannel[1];
-
- connection[0] =
- TestClient.CreateConnection(TestClient.brokerUrl, TestClient.virtualHost);
- channel[0] = connection[0].CreateChannel(false, AcknowledgeMode.AutoAcknowledge);
-
- // Extract and retain the test parameters.
- publisher = channel[0].CreatePublisherBuilder()
- .WithExchangeName(ExchangeNameDefaults.TOPIC)
- .WithRoutingKey(sendDestination)
- .WithMandatory(false)
- .WithImmediate(false)
- .Create();
- break;
-
- // Otherwise the receiver role is being assigned, so set this up to listen for messages on the required number
- // of receiver connections.
- case Roles.RECEIVER:
- // Create the required number of receiver connections.
- connection = new IConnection[1];
- channel = new IChannel[1];
- connection[0] = TestClient.CreateConnection(TestClient.brokerUrl, TestClient.virtualHost);
- channel[0] = connection[0].CreateChannel(false, AcknowledgeMode.AutoAcknowledge);
- IMessageConsumer consumer = channel[0].CreateConsumerBuilder(sendDestination).Create();
- consumer.OnMessage += new MessageReceivedDelegate(OnMessage);
- break;
- }
-
- // Start all the connection dispatcher threads running.
- foreach (IConnection con in connection)
- {
- con.Start();
- }
-
- }
-
- public IMessage GetReport(IChannel channel)
- {
-
- log.Info("public Message GetReport(IChannel channel): called");
-
- // Close the test connection.
- //connection.Stop();
-
- // Generate a report message containing the count of the number of messages passed.
- IMessage report = channel.CreateMessage();
- //report.Headers.SetString("CONTROL_TYPE", "REPORT");
- report.Headers.SetInt("MESSAGE_COUNT", messageCount);
-
- return report;
- }
-
-
- /// <summary>
- /// Counts incoming test messages.
- /// </summary>
- ///
- /// <param name="message"> The incoming test message. </param>
- public void OnMessage(IMessage message)
- {
- log.Info("public void onMessage(IMessage message = " + message + "): called");
-
- // Increment the message count.
- messageCount++;
- }
-
- }
-}
diff --git a/dotnet/Qpid.Integration.Tests/interop/TestCases/TestCase5PubSubMessageSize.cs b/dotnet/Qpid.Integration.Tests/interop/TestCases/TestCase5PubSubMessageSize.cs deleted file mode 100644 index 8fddaeafa2..0000000000 --- a/dotnet/Qpid.Integration.Tests/interop/TestCases/TestCase5PubSubMessageSize.cs +++ /dev/null @@ -1,252 +0,0 @@ -/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
- */
-
-using System;
-using System.Text;
-using log4net;
-using Apache.Qpid.Messaging;
-
-namespace Apache.Qpid.Integration.Tests.interop.TestCases
-{
- ///
- /// Implements test case 4, from the interop test specification. This test sets up the TC2_P2PMessageSize test for 50
- /// messages, and a variety of message sizes. It checks that the sender and receivers reports both indicate that all
- /// the test messages were transmitted successfully.
- ///
- /// <p><table id="crc"><caption>CRC Card</caption>
- /// <tr><th> Responsibilities <th> Collaborations
- /// <tr><td> Setup p2p test parameters and compare with test output. <td> {@link FrameworkBaseCase}
- /// </table>
- ///
- public class TestCase5PubSubMessageSize : InteropClientTestCase
- {
- /// Used for debugging.
- private static ILog log = LogManager.GetLogger(typeof(TestCase5PubSubMessageSize));
-
- /// <summary> The role to be played by the test. </summary>
- private Roles role;
-
- /// <summary> Holds the count of test messages received. </summary>
- private int messageCount;
-
- ///<summary>The size of the message to be sent </summary>
- private int messageSize;
-
- /// <summary> The number of test messages to send. </summary>
- private int numMessages;
-
- /// <summary> The number of receiver connection to use. </summary>
- private int numReceivers;
-
- /// <summary> The routing key to send them to on the default direct exchange. </summary>
- private string sendDestination;
-
- /// <summary> The connections to send/receive the test messages on. </summary>
- private IConnection[] connection;
-
- /// <summary> The sessions to send/receive the test messages on. </summary>
- private IChannel[] channel;
-
- /// <summary> The producer to send the test messages with. </summary>
- IMessagePublisher publisher;
-
- /// <summary>
- /// Creates a new coordinating test case with the specified name.
- ///</summary>
- /// <returns>The test case name.</returns>
- ///
- public String GetName()
- {
- log.Info("public String GetName(): called");
- return "TC5_PubSubMessageSize";
- }
-
- /// <summary>
- /// Determines whether the test invite that matched this test case is acceptable.
- /// </summary>
- ///
- /// <param name="inviteMessage"> The invitation to accept or reject. </param>
- ///
- /// <returns> <tt>true</tt> to accept the invitation, <tt>false</tt> to reject it. </returns>
- public bool AcceptInvite(IMessage inviteMessage)
- {
- log.Info("public boolean AcceptInvite(IMessage inviteMessage = " + inviteMessage + "): called");
- // All invites are acceptable.
- return true;
- }
-
- public void Start()
- {
- log.Info("public void start(): called");
- // Assuming numMessages = 1
- Start(1);
- }
-
- public void Start(int numMessages)
- {
- log.Info("public void start("+numMessages+"): called");
-
- // Check that the sender role is being performed.
- if (role == Roles.SENDER)
- {
- IMessage testMessage = createMessageOfSize(messageSize);
-
-
- for (int i = 0; i < numMessages; i++)
- {
- publisher.Send(testMessage);
-
- // Increment the message count.
- messageCount++;
- }
- }
-
- }
-
- private IMessage createMessageOfSize(int size)
- {
- IBytesMessage message = channel[0].CreateBytesMessage();
- string messageStr = "Test Message -- Test Message -- Test Message -- Test Message -- Test Message -- Test Message -- Test Message -- ";
- System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
- byte[] messageBytes = encoding.GetBytes(messageStr);
-
- if (size > 0)
- {
- int div = size / messageBytes.Length;
- int mod = size % messageBytes.Length;
-
- for (int i = 0; i < div; i++)
- {
- message.WriteBytes(messageBytes);
- }
- if (mod != 0)
- {
- message.WriteBytes(messageBytes, 0, mod);
- }
- }
- return message;
- }
-
- public void AssignRole(Roles role, IMessage assignRoleMessage)
- {
- log.Info("public void assignRole(Roles role = " + role + ", IMessage assignRoleMessage = " + assignRoleMessage
- + "): called");
-
- // Reset the message count for a new test.
- messageCount = 0;
-
- // Take note of the role to be played.
- this.role = role;
-
- // Extract and retain the test parameters.
- numMessages = assignRoleMessage.Headers.GetInt("PUBSUB_NUM_MESSAGES");
- messageSize = assignRoleMessage.Headers.GetInt("messageSize");
- numReceivers = assignRoleMessage.Headers.GetInt("PUBSUB_NUM_RECEIVERS");
-
- string sendKey = assignRoleMessage.Headers.GetString("PUBSUB_KEY");
- sendDestination = sendKey;
-
- log.Info("numMessages = " + numMessages);
- log.Info("messageSize = " + messageSize);
- log.Info("sendKey = " + sendKey);
- log.Info("role = " + role);
-
- switch (role)
- {
- // Check if the sender role is being assigned, and set up a single message producer if so.
- case Roles.SENDER:
- // Create a new connection to pass the test messages on.
- connection = new IConnection[1];
- channel = new IChannel[1];
-
- connection[0] =
- TestClient.CreateConnection(TestClient.brokerUrl, TestClient.virtualHost);
- channel[0] = connection[0].CreateChannel(false, AcknowledgeMode.AutoAcknowledge);
-
- // Extract and retain the test parameters.
- publisher = channel[0].CreatePublisherBuilder()
- .WithExchangeName(ExchangeNameDefaults.TOPIC)
- .WithRoutingKey(sendDestination)
- .WithMandatory(false)
- .WithImmediate(false)
- .Create();
- break;
-
- // Otherwise the receiver role is being assigned, so set this up to listen for messages on the required number
- // of receiver connections.
- case Roles.RECEIVER:
- // Create the required number of receiver connections.
- connection = new IConnection[numReceivers];
- channel = new IChannel[numReceivers];
-
- for (int i = 0; i < numReceivers; i++)
- {
- connection[i] =
- TestClient.CreateConnection(TestClient.brokerUrl, TestClient.virtualHost);
- channel[i] = connection[i].CreateChannel(false, AcknowledgeMode.AutoAcknowledge);
-
- IMessageConsumer consumer = channel[i].CreateConsumerBuilder(sendDestination).Create();
- consumer.OnMessage += new MessageReceivedDelegate(OnMessage);
- }
-
- break;
- }
-
- // Start all the connection dispatcher threads running.
- foreach (IConnection con in connection)
- {
- con.Start();
- }
-
- }
-
- public IMessage GetReport(IChannel channel)
- {
-
- log.Info("public Message GetReport(IChannel channel): called");
-
- // Close the test connection.
- //connection.Stop();
-
- // Generate a report message containing the count of the number of messages passed.
- IMessage report = channel.CreateMessage();
- //report.Headers.SetString("CONTROL_TYPE", "REPORT");
- report.Headers.SetInt("MESSAGE_COUNT", messageCount);
-
- return report;
- }
-
-
- /// <summary>
- /// Counts incoming test messages.
- /// </summary>
- ///
- /// <param name="message"> The incoming test message. </param>
- public void OnMessage(IMessage message)
- {
- log.Info("public void onMessage(IMessage message = " + message + "): called");
-
- // Increment the message count.
- messageCount++;
- }
-
- }
-}
diff --git a/dotnet/Qpid.Integration.Tests/interop/TestClient.cs b/dotnet/Qpid.Integration.Tests/interop/TestClient.cs deleted file mode 100644 index 0def89c6da..0000000000 --- a/dotnet/Qpid.Integration.Tests/interop/TestClient.cs +++ /dev/null @@ -1,381 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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. - * - */ -using System; -using System.Collections; -using System.Text; -using System.Threading; -using Apache.Qpid.Messaging; -using Apache.Qpid.Client.Qms; -using Apache.Qpid.Client; -using log4net; -using Apache.Qpid.Integration.Tests.interop.TestCases; - -namespace Apache.Qpid.Integration.Tests.interop -{ - /// <summary> - /// Implements a test client as described in the interop testing spec - /// (http://cwiki.apache.org/confluence/display/qpid/Interop+Testing+Specification). A test client is an agent that - /// reacts to control message sequences send by the test coordinator. - /// - /// <p/><table><caption>Messages Handled by TestClient</caption> - /// <tr><th> Message <th> Action - /// <tr><td> Invite(compulsory) <td> Reply with Enlist. - /// <tr><td> Invite(test case) <td> Reply with Enlist if test case available. - /// <tr><td> AssignRole(test case) <td> Reply with Accept Role if matches an enlisted test. Keep test parameters. - /// <tr><td> Start <td> Send test messages defined by test parameters. Send report on messages sent. - /// <tr><td> Status Request <td> Send report on messages received. - /// </table> - /// - /// <p><table id="crc"><caption>CRC Card</caption> - /// <tr><th> Responsibilities <th> Collaborations - /// <tr><td> Handle all incoming control messages. <td> {@link InteropClientTestCase} - /// <tr><td> Configure and look up test cases by name. <td> {@link InteropClientTestCase} - /// </table> - /// </summary> - public class TestClient - { - private static ILog log = LogManager.GetLogger(typeof(TestClient)); - - /// <summary> Defines the default broker for the tests, localhost, default port. </summary> - public static string DEFAULT_BROKER_URL = "amqp://guest:guest@clientid/?brokerlist='tcp://localhost:5672'"; - - /// <summary> Defines the default virtual host to use for the tests, none. </summary> - public static string DEFAULT_VIRTUAL_HOST = ""; - - /// <summary> Defines the default identifying name of this test client. </summary> - public static string DEFAULT_CLIENT_NAME = "dotnet"; - - /// <summary> Holds the URL of the broker to run the tests on. </summary> - public static string brokerUrl; - - /// <summary> Holds the virtual host to run the tests on. If <tt>null</tt>, then the default virtual host is used. </summary> - public static string virtualHost; - - /// <summary> The clients identifying name to print in test results and to distinguish from other clients. </summary> - private string clientName; - - /// <summary> Holds all the test cases. </summary> - private IDictionary testCases = new Hashtable(); - - InteropClientTestCase currentTestCase; - - private MessagePublisherBuilder publisherBuilder; - - private IChannel channel; - - /// <summary> Monitor to wait for termination events on. </summary> - private static object terminationMonitor = new Object(); - - /// <summary> - /// Creates a new interop test client, listenting to the specified broker and virtual host, with the specified - /// client identifying name. - /// </summary> - /// - /// <param name="brokerUrl"> The url of the broker to connect to. </param> - /// <param name="virtualHost"> The virtual host to conect to. </param> - /// <param name="clientName"> The client name to use. </param> - public TestClient(string brokerUrl, string virtualHost, string clientName) - { - log.Info("public TestClient(string brokerUrl = " + brokerUrl + ", string virtualHost = " + virtualHost - + ", string clientName = " + clientName + "): called"); - - // Retain the connection parameters. - TestClient.brokerUrl = brokerUrl; - TestClient.virtualHost = virtualHost; - this.clientName = clientName; - } - - - /// <summary> - /// The entry point for the interop test coordinator. This client accepts the following command line arguments: - /// </summary> - /// - /// <p/><table> - /// <tr><td> -b <td> The broker URL. <td> Optional. - /// <tr><td> -h <td> The virtual host. <td> Optional. - /// <tr><td> -n <td> The test client name. <td> Optional. - /// <tr><td> name=value <td> Trailing argument define name/value pairs. Added to system properties. <td> Optional. - /// </table> - /// - /// <param name="args"> The command line arguments. </param> - public static void Main(string[] args) - { - // Extract the command line options (Not exactly Posix but it will do for now...). - string brokerUrl = DEFAULT_BROKER_URL; - string virtualHost = DEFAULT_VIRTUAL_HOST; - string clientName = DEFAULT_CLIENT_NAME; - - foreach (string nextArg in args) - { - if (nextArg.StartsWith("-b")) - { - brokerUrl = nextArg.Substring(2); - } - else if (nextArg.StartsWith("-h")) - { - virtualHost = nextArg.Substring(2); - } - else if (nextArg.StartsWith("-n")) - { - clientName = nextArg.Substring(2); - } - } - - NDC.Push(clientName); - - // Create a test client and start it running. - TestClient client = new TestClient(brokerUrl, virtualHost, clientName); - - try - { - client.Start(); - } - catch (Exception e) - { - log.Error("The test client was unable to start.", e); - System.Environment.Exit(1); - } - - // Wait for a signal on the termination monitor before quitting. - lock (terminationMonitor) - { - Monitor.Wait(terminationMonitor); - } - - NDC.Pop(); - } - - /// <summary> - /// Starts the interop test client running. This causes it to start listening for incoming test invites. - /// </summary> - private void Start() - { - log.Info("private void Start(): called"); - - // Use a class path scanner to find all the interop test case implementations. - ArrayList testCaseClasses = new ArrayList(); - - // ClasspathScanner.getMatches(InteropClientTestCase.class, "^TestCase.*", true); - // Hard code the test classes till the classpath scanner is fixed. - testCaseClasses.Add(typeof(TestCase1DummyRun)); - testCaseClasses.Add(typeof(TestCase2BasicP2P)); - testCaseClasses.Add(typeof(TestCase3BasicPubSub)); - testCaseClasses.Add(typeof(TestCase4P2PMessageSize)); - testCaseClasses.Add(typeof(TestCase5PubSubMessageSize)); - - // Create all the test case implementations and index them by the test names. - foreach (Type testClass in testCaseClasses) - { - InteropClientTestCase testCase = (InteropClientTestCase)Activator.CreateInstance(testClass); - testCases.Add(testCase.GetName(), testCase); - - log.Info("Found test case: " + testClass); - } - - // Open a connection to communicate with the coordinator on. - log.Info("brokerUrl = " + brokerUrl); - IConnection connection = CreateConnection(brokerUrl, virtualHost); - - channel = connection.CreateChannel(false, AcknowledgeMode.AutoAcknowledge); - - // Set this up to listen for control messages. - string responseQueueName = channel.GenerateUniqueName(); - channel.DeclareQueue(responseQueueName, false, true, true); - - channel.Bind(responseQueueName, ExchangeNameDefaults.TOPIC, "iop.control." + clientName); - channel.Bind(responseQueueName, ExchangeNameDefaults.TOPIC, "iop.control"); - - IMessageConsumer consumer = channel.CreateConsumerBuilder(responseQueueName) - .Create(); - consumer.OnMessage += new MessageReceivedDelegate(OnMessage); - - // Create a publisher to send replies with. - publisherBuilder = channel.CreatePublisherBuilder() - .WithExchangeName(ExchangeNameDefaults.DIRECT); - - - // Start listening for incoming control messages. - connection.Start(); - Console.WriteLine("Test client " + clientName + " ready to receive test control messages..."); - } - - /// <summary> - /// Establishes an AMQ connection. This is a simple convenience method for code that does not anticipate handling connection failures. - /// All exceptions that indicate that the connection has failed, are allowed to fall through. - /// </summary> - /// - /// <param name="brokerUrl"> The broker url to connect to, <tt>null</tt> to use the default from the properties. </param> - /// <param name="virtualHost"> The virtual host to connectio to, <tt>null</tt> to use the default. </param> - /// - /// <returns> A JMS conneciton. </returns> - public static IConnection CreateConnection(string brokerUrl, string virtualHost) - { - log.Info("public static Connection createConnection(string brokerUrl = " + brokerUrl + ", string virtualHost = " - + virtualHost + "): called"); - - // Create a connection to the broker. - IConnectionInfo connectionInfo = QpidConnectionInfo.FromUrl(brokerUrl); - connectionInfo.VirtualHost = virtualHost; - IConnection connection = new AMQConnection(connectionInfo); - - return connection; - } - - /// <summary> - /// Handles all incoming control messages. - /// </summary> - /// - /// <param name="message"> The incoming message. </param> - public void OnMessage(IMessage message) - { - log.Info("public void OnMessage(IMessage message = " + message + "): called"); - - try - { - string controlType = message.Headers.GetString("CONTROL_TYPE"); - string testName = message.Headers.GetString("TEST_NAME"); - - // Check if the message is a test invite. - if ("INVITE" == controlType) - { - string testCaseName = message.Headers.GetString("TEST_NAME"); - - // Flag used to indicate that an enlist should be sent. Only enlist to compulsory invites or invites - // for which test cases exist. - bool enlist = false; - - if (testCaseName != null) - { - log.Info("Got an invite to test: " + testCaseName); - - // Check if the requested test case is available. - InteropClientTestCase testCase = (InteropClientTestCase)testCases[testCaseName]; - - if (testCase != null) - { - // Make the requested test case the current test case. - currentTestCase = testCase; - enlist = true; - } - } - else - { - log.Info("Got a compulsory invite."); - - enlist = true; - } - - log.Info("enlist = " + enlist); - - if (enlist) - { - // Reply with the client name in an Enlist message. - IMessage enlistMessage = channel.CreateMessage(); - enlistMessage.Headers.SetString("CONTROL_TYPE", "ENLIST"); - enlistMessage.Headers.SetString("CLIENT_NAME", clientName); - enlistMessage.Headers.SetString("CLIENT_PRIVATE_CONTROL_KEY", "iop.control." + clientName); - enlistMessage.CorrelationId = message.CorrelationId; - - Send(enlistMessage, message.ReplyToRoutingKey); - } - } - else if ("ASSIGN_ROLE" == controlType) - { - // Assign the role to the current test case. - string roleName = message.Headers.GetString("ROLE"); - - log.Info("Got a role assignment to role: " + roleName); - - Roles role; - - if (roleName == "SENDER") - { - role = Roles.SENDER; - } - else - { - role = Roles.RECEIVER; - } - - currentTestCase.AssignRole(role, message); - - // Reply by accepting the role in an Accept Role message. - IMessage acceptRoleMessage = channel.CreateMessage(); - acceptRoleMessage.Headers.SetString("CONTROL_TYPE", "ACCEPT_ROLE"); - acceptRoleMessage.CorrelationId = message.CorrelationId; - - Send(acceptRoleMessage, message.ReplyToRoutingKey); - } - else if ("START" == controlType || "STATUS_REQUEST" == controlType) - { - if ("START" == controlType) - { - log.Info("Got a start notification."); - - // Start the current test case. - currentTestCase.Start(); - } - else - { - log.Info("Got a status request."); - } - - // Generate the report from the test case and reply with it as a Report message. - IMessage reportMessage = currentTestCase.GetReport(channel); - reportMessage.Headers.SetString("CONTROL_TYPE", "REPORT"); - reportMessage.CorrelationId = message.CorrelationId; - - Send(reportMessage, message.ReplyToRoutingKey); - } - else if ("TERMINATE" == controlType) - { - Console.WriteLine("Received termination instruction from coordinator."); - - // Is a cleaner shutdown needed? - System.Environment.Exit(1); - } - else - { - // Log a warning about this but otherwise ignore it. - log.Warn("Got an unknown control message, controlType = " + controlType + ", message = " + message); - } - } - catch (QpidException e) - { - // Log a warning about this, but otherwise ignore it. - log.Warn("A QpidException occurred whilst handling a message."); - log.Info("Got QpidException whilst handling message: " + message, e); - } - } - - /// <summary> - /// Send the specified message using the specified routing key on the direct exchange. - /// </summary> - /// - /// <param name="message"> The message to send.</param> - /// <param name="routingKey"> The routing key to send the message with.</param> - public void Send(IMessage message, string routingKey) - { - IMessagePublisher publisher = publisherBuilder.WithRoutingKey(routingKey).Create(); - publisher.Send(message); - } - } -} |
