Author: tabish
Date: Tue Sep 22 19:48:51 2009
New Revision: 817799
URL: http://svn.apache.org/viewvc?rev=817799&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQNET-189
Adds a Size method and an OnSend method to Message as well as adding in missing
read only flags for the Message body and properties.
Modified:
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/Message.cs
Modified:
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/Message.cs
URL:
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/Message.cs?rev=817799&r1=817798&r2=817799&view=diff
==============================================================================
---
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/Message.cs
(original)
+++
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/Message.cs
Tue Sep 22 19:48:51 2009
@@ -65,6 +65,11 @@
long brokerInTime;
long brokerOutTime;
+ protected bool readOnlyMsgProperties;
+ protected bool readOnlyMsgBody;
+
+ public const int DEFAULT_MINIMUM_MESSAGE_SIZE = 1024;
+
///
/// <summery>
/// Get the unique identifier that this object and its own
@@ -138,6 +143,28 @@
"]";
}
+ public int Size()
+ {
+ int size = DEFAULT_MINIMUM_MESSAGE_SIZE;
+
+ if(marshalledProperties != null)
+ {
+ size += marshalledProperties.Length;
+ }
+ if(content != null)
+ {
+ size += content.Length;
+ }
+
+ return size;
+ }
+
+ public void OnSend()
+ {
+ this.ReadOnlyProperties = true;
+ this.ReadOnlyBody = true;
+ }
+
public ProducerId ProducerId
{
get { return producerId; }
@@ -312,6 +339,18 @@
set { this.brokerOutTime = value; }
}
+ public bool ReadOnlyProperties
+ {
+ get { return readOnlyMsgProperties; }
+ set { readOnlyMsgProperties = value; }
+ }
+
+ public bool ReadOnlyBody
+ {
+ get { return readOnlyMsgBody; }
+ set { readOnlyMsgBody = value; }
+ }
+
///
/// <summery>
/// Return an answer of true to the isMessage() query.