summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Greig <rgreig@apache.org>2007-01-05 12:11:56 +0000
committerRobert Greig <rgreig@apache.org>2007-01-05 12:11:56 +0000
commit317d2f923fc99e2b642c072d31b0570c649b0947 (patch)
tree08f53e78711e7a2053d8d5b5381051452d1e59fb
parentf792808251d9fd00dc45282a9a8a1d6e2dea37b5 (diff)
downloadqpid-python-317d2f923fc99e2b642c072d31b0570c649b0947.tar.gz
Qpid-238. Refactored out the ugly GetExchangeName method.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@493003 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs57
1 files changed, 25 insertions, 32 deletions
diff --git a/qpid/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs b/qpid/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs
index fe0915d4d6..85ac497ad2 100644
--- a/qpid/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs
+++ b/qpid/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs
@@ -172,17 +172,40 @@ namespace Qpid.Client.Message
}
}
+ /// <summary>
+ /// Decodes the replyto field if one is set.
+ ///
+ /// Splits a replyto field containing an exchange name followed by a ':', followed by a routing key into the exchange name and
+ /// routing key seperately. The exchange name may be empty in which case the empty string is returned. If the exchange name is
+ /// empty the replyto field is expected to being with ':'.
+ ///
+ /// Anyhting other than a two part replyto field sperated with a ':' will result in an exception.
+ /// </summary>
+ ///
+ /// <returns>A destination initialized to the replyto location if a replyto field was set, or an empty destination otherwise.</returns>
private Dest ReadReplyToHeader()
{
string replyToEncoding = ContentHeaderProperties.ReplyTo;
+
if (replyToEncoding == null)
{
return new Dest();
}
else
{
- string routingKey;
- string exchangeName = GetExchangeName(replyToEncoding, out routingKey);
+ // Split the replyto field on a ':'
+ string[] split = replyToEncoding.Split(':');
+
+ // Ensure that the replyto field argument only consisted of two parts.
+ if (split.Length != 2)
+ {
+ throw new QpidException("Illegal value in ReplyTo property: " + replyToEncoding);
+ }
+
+ // Extract the exchange name and routing key from the split replyto field.
+ string exchangeName = split[0];
+ string routingKey = split[1];
+
return new Dest(exchangeName, routingKey);
}
}
@@ -193,36 +216,6 @@ namespace Qpid.Client.Message
ContentHeaderProperties.ReplyTo = encodedDestination;
}
- /// <summary>
- /// Splits a replyto field containing an exchange name followed by a ':', followed by a routing key into the exchange name and
- /// routing key seperately. The exchange name may be empty in which case the empty string is returned. If the exchange name is
- /// empty the replyto field is expected to being with ':'.
- ///
- /// Anyhting other than a two part replyto field sperated with a ':' will result in an exception.
- /// </summary>
- ///
- /// <param name="replyToEncoding">The encoded replyto field to split.</param>
- /// <param name="routingKey">A reference to update with the extracted routing key.</param>
- ///
- /// <returns>The exchange name or the empty string when no exchange name is specified.</returns>
- private static string GetExchangeName(string replyToEncoding, out string routingKey)
- {
- // Split the replyto field on a ':'
- string[] split = replyToEncoding.Split(':');
-
- // Ensure that the replyto field argument only consisted of two parts.
- if (split.Length != 2)
- {
- throw new QpidException("Illegal value in ReplyTo property: " + replyToEncoding);
- }
-
- // Extract the exchange name and routing key from the split replyto field.
- string exchangeName = split[0];
- routingKey = split[1];
-
- return exchangeName;
- }
-
public DeliveryMode DeliveryMode
{
get