summaryrefslogtreecommitdiff
path: root/qpid/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs
diff options
context:
space:
mode:
authorTomas Restrepo <tomasr@apache.org>2007-05-18 00:51:12 +0000
committerTomas Restrepo <tomasr@apache.org>2007-05-18 00:51:12 +0000
commitad680e710c07c5ebfc0d391be98dd60ed0ccbaf9 (patch)
tree3ed0e02f1a2d42b82011c9a612c337570dd5beb9 /qpid/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs
parent297cbc84e777d48c2111baa688ba46383c068067 (diff)
downloadqpid-python-ad680e710c07c5ebfc0d391be98dd60ed0ccbaf9.tar.gz
Merged revisions 537954-538078,538080-538083,538085-538097,538099-538108,538110-538239,538241-538881,538883-538906,538908-538911,538913-538921,538923-539191 via svnmerge from
https://svn.apache.org/repos/asf/incubator/qpid/branches/M2 ........ r537954 | tomasr | 2007-05-14 14:10:59 -0500 (Mon, 14 May 2007) | 4 lines * QPID-487 (Contributed by Carlos Medina) Fix QpidConnectionInfo.ToString() * QPID-485 (Contributed by Carlos Medina) Fix AmqBrokerInfo.Equals() * QPID-456 Enforce virtual host names start with '/' ........ r538035 | tomasr | 2007-05-14 20:33:00 -0500 (Mon, 14 May 2007) | 6 lines * QPID-452 Improve message classes API * Add XML documentation to IChannel and IMessage * Add missing BrokerDetailTests * Add new tests for message creation and message factories * Fix wrong default encoding for text messages ........ r539178 | tomasr | 2007-05-17 18:50:50 -0500 (Thu, 17 May 2007) | 6 lines * QPID-492 Fix Race condition in message decoding * QPID-249 Make ServiceRequestingClient and ServiceProvidingClient a single, self contained test * Fix incorrect exception message in Qpid.Buffers, improve tests * Make ContentBody use an sliced buffer to avoid extra data copy * Remove useless tests in Qpid.Client (Blocking IO tests) ........ r539191 | tomasr | 2007-05-17 19:18:26 -0500 (Thu, 17 May 2007) | 1 line QPID-490 (Contributed by Carlos Medina) Implement PurgeQueue and DeleteQueue ........ git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@539198 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs')
-rw-r--r--qpid/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs318
1 files changed, 167 insertions, 151 deletions
diff --git a/qpid/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs b/qpid/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs
index 1d2b2db3ca..8e90e852dd 100644
--- a/qpid/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs
+++ b/qpid/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs
@@ -72,24 +72,29 @@ namespace Qpid.Client.Message
#endregion
+ #region Properties
+ //
+ // Properties
+ //
+
+ /// <summary>
+ /// The application message identifier
+ /// </summary>
public string MessageId
{
- get
- {
+ get {
if (ContentHeaderProperties.MessageId == null)
{
ContentHeaderProperties.MessageId = "ID:" + DeliveryTag;
}
return ContentHeaderProperties.MessageId;
}
- set
- {
- ContentHeaderProperties.MessageId = value;
- }
-
-
- }
+ set { ContentHeaderProperties.MessageId = value; }
+ }
+ /// <summary>
+ /// The message timestamp
+ /// </summary>
public long Timestamp
{
get
@@ -103,36 +108,22 @@ namespace Qpid.Client.Message
}
}
- protected void CheckReadable()
- {
- if (!_readableMessage)
- {
- throw new MessageNotReadableException("You need to call reset() to make the message readable");
- }
- }
-
+ /// <summary>
+ /// The <see cref="CorrelationId"/> as a byte array.
+ /// </summary>
public byte[] CorrelationIdAsBytes
{
- get
- {
- return Encoding.Default.GetBytes(ContentHeaderProperties.CorrelationId);
- }
- set
- {
- ContentHeaderProperties.CorrelationId = Encoding.Default.GetString(value);
- }
+ get { return Encoding.Default.GetBytes(ContentHeaderProperties.CorrelationId); }
+ set { ContentHeaderProperties.CorrelationId = Encoding.Default.GetString(value); }
}
+ /// <summary>
+ /// The application correlation identifier
+ /// </summary>
public string CorrelationId
{
- get
- {
- return ContentHeaderProperties.CorrelationId;
- }
- set
- {
- ContentHeaderProperties.ContentType = value;
- }
+ get { return ContentHeaderProperties.CorrelationId; }
+ set { ContentHeaderProperties.CorrelationId = value; }
}
struct Dest
@@ -147,6 +138,9 @@ namespace Qpid.Client.Message
}
}
+ /// <summary>
+ /// Exchange name of the reply-to address
+ /// </summary>
public string ReplyToExchangeName
{
get
@@ -162,6 +156,9 @@ namespace Qpid.Client.Message
}
}
+ /// <summary>
+ /// Routing key of the reply-to address
+ /// </summary>
public string ReplyToRoutingKey
{
get
@@ -177,50 +174,11 @@ 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
- {
- // 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);
- }
- }
-
- private void WriteReplyToHeader(Dest dest)
- {
- string encodedDestination = string.Format("{0}:{1}", dest.ExchangeName, dest.RoutingKey);
- ContentHeaderProperties.ReplyTo = encodedDestination;
- }
+ /// <summary>
+ /// Non-persistent (1) or persistent (2)
+ /// </summary>
public DeliveryMode DeliveryMode
{
get
@@ -242,100 +200,94 @@ namespace Qpid.Client.Message
}
}
+ /// <summary>
+ /// True, if this is a redelivered message
+ /// </summary>
public bool Redelivered
{
- get
- {
- return _redelivered;
- }
- set
- {
- _redelivered = value;
- }
- }
+ get { return _redelivered; }
+ set { _redelivered = value; }
+ }
+ /// <summary>
+ /// The message type name
+ /// </summary>
public string Type
{
- get
- {
- return MimeType;
- }
- set
- {
- //MimeType = value;
- }
+ get { return ContentHeaderProperties.Type; }
+ set { ContentHeaderProperties.Type = value; }
}
-
+
+ /// <summary>
+ /// Message expiration specification
+ /// </summary>
public long Expiration
{
- get
- {
- return ContentHeaderProperties.Expiration;
- }
- set
- {
- ContentHeaderProperties.Expiration = value;
- }
+ get { return ContentHeaderProperties.Expiration; }
+ set { ContentHeaderProperties.Expiration = value; }
}
- public int Priority
+ /// <summary>
+ /// The message priority, 0 to 9
+ /// </summary>
+ public byte Priority
{
- get
- {
- return ContentHeaderProperties.Priority;
- }
- set
- {
- ContentHeaderProperties.Priority = (byte) value;
- }
+ get { return ContentHeaderProperties.Priority; }
+ set { ContentHeaderProperties.Priority = (byte) value; }
}
- // FIXME: implement
+ /// <summary>
+ /// The MIME Content Type
+ /// </summary>
public string ContentType
{
- get { throw new NotImplementedException(); }
- set { throw new NotImplementedException(); }
+ get { return ContentHeaderProperties.ContentType; }
+ set { ContentHeaderProperties.ContentType = value; }
}
- // FIXME: implement
+ /// <summary>
+ /// The MIME Content Encoding
+ /// </summary>
public string ContentEncoding
{
- get { throw new NotImplementedException(); }
- set { throw new NotImplementedException(); }
- }
-
- public void Acknowledge()
- {
- // the JMS 1.1 spec says in section 3.6 that calls to acknowledge are ignored when client acknowledge
- // is not specified. In our case, we only set the session field where client acknowledge mode is specified.
- if (_channel != null)
- {
- // we set multiple to true here since acknowledgement implies acknowledge of all previous messages
- // received on the session
- _channel.AcknowledgeMessage((ulong)DeliveryTag, true);
- }
-
+ get { return ContentHeaderProperties.Encoding; }
+ set { ContentHeaderProperties.Encoding = value; }
}
+ /// <summary>
+ /// Headers of this message
+ /// </summary>
public IHeaders Headers
{
get { return _headers; }
}
- public abstract void ClearBodyImpl();
+ /// <summary>
+ /// The creating user id
+ /// </summary>
+ public string UserId
+ {
+ get { return ContentHeaderProperties.UserId; }
+ set { ContentHeaderProperties.UserId = value; }
+ }
- public void ClearBody()
+ /// <summary>
+ /// The creating application id
+ /// </summary>
+ public string AppId
{
- ClearBodyImpl();
- _readableMessage = false;
+ get { return ContentHeaderProperties.AppId; }
+ set { ContentHeaderProperties.AppId = value; }
}
/// <summary>
- /// Get a String representation of the body of the message. Used in the
- /// toString() method which outputs this before message properties.
+ /// Intra-cluster routing identifier
/// </summary>
- /// <exception cref="QpidException"></exception>
- public abstract string ToBodyString();
+ public string ClusterId
+ {
+ get { return ContentHeaderProperties.ClusterId; }
+ set { ContentHeaderProperties.ClusterId = value; }
+ }
/// <summary>
/// Return the raw byte array that is used to populate the frame when sending
@@ -367,12 +319,37 @@ namespace Qpid.Client.Message
_data = value;
}
}
+ #endregion // Properties
+
- public abstract string MimeType
+ public void Acknowledge()
{
- get;
+ // the JMS 1.1 spec says in section 3.6 that calls to acknowledge are ignored when client acknowledge
+ // is not specified. In our case, we only set the session field where client acknowledge mode is specified.
+ if (_channel != null)
+ {
+ // we set multiple to true here since acknowledgement implies acknowledge of all previous messages
+ // received on the session
+ _channel.AcknowledgeMessage((ulong)DeliveryTag, true);
+ }
+
}
+ public abstract void ClearBodyImpl();
+
+ public void ClearBody()
+ {
+ ClearBodyImpl();
+ _readableMessage = false;
+ }
+
+ /// <summary>
+ /// Get a String representation of the body of the message. Used in the
+ /// toString() method which outputs this before message properties.
+ /// </summary>
+ /// <exception cref="QpidException"></exception>
+ public abstract string ToBodyString();
+
public override string ToString()
{
try
@@ -403,18 +380,6 @@ namespace Qpid.Client.Message
}
}
- public IFieldTable UnderlyingMessagePropertiesMap
- {
- get
- {
- return ContentHeaderProperties.Headers;
- }
- set
- {
- ContentHeaderProperties.Headers = (FieldTable)value;
- }
- }
-
public FieldTable PopulateHeadersFromMessageProperties()
{
if (ContentHeaderProperties.Headers == null)
@@ -466,5 +431,56 @@ namespace Qpid.Client.Message
{
get { return !_readableMessage; }
}
+
+ protected void CheckReadable()
+ {
+ if ( !_readableMessage )
+ {
+ throw new MessageNotReadableException("You need to call reset() to make the message readable");
+ }
+ }
+
+ /// <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
+ {
+ // 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);
+ }
+ }
+
+ private void WriteReplyToHeader(Dest dest)
+ {
+ string encodedDestination = string.Format("{0}:{1}", dest.ExchangeName, dest.RoutingKey);
+ ContentHeaderProperties.ReplyTo = encodedDestination;
+ }
}
}