You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2014/01/25 00:25:34 UTC
svn commit: r1561226 [1/2] -
/activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/
Author: tabish
Date: Fri Jan 24 23:25:34 2014
New Revision: 1561226
URL: http://svn.apache.org/r1561226
Log:
https://issues.apache.org/jira/browse/AMQNET-454
applied:
https://issues.apache.org/jira/secure/attachment/12625134/Apache.NMS.AMQP-fix-destination-to-use-qpid-address-10.patch
Modified:
activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/BaseMessage.cs
activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/BytesMessage.cs
activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/ConnectionClosedException.cs
activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/DefaultMessageConverter.cs
activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/Destination.cs
activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/IMessageConverter.cs
activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/MapMessage.cs
activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/MessageConsumer.cs
activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/MessageProducer.cs
activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/ObjectMessage.cs
activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/Queue.cs
activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/Session.cs
activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/SessionClosedException.cs
activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/StreamMessage.cs
activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/TextMessage.cs
activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/Topic.cs
Modified: activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/BaseMessage.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/BaseMessage.cs?rev=1561226&r1=1561225&r2=1561226&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/BaseMessage.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/BaseMessage.cs Fri Jan 24 23:25:34 2014
@@ -20,196 +20,196 @@ using Apache.NMS.Util;
namespace Apache.NMS.Amqp
{
- public delegate void AcknowledgeHandler(BaseMessage baseMessage);
+ public delegate void AcknowledgeHandler(BaseMessage baseMessage);
- public class BaseMessage : IMessage
- {
- private PrimitiveMap propertiesMap = new PrimitiveMap();
- private IDestination destination;
- private string correlationId;
- private TimeSpan timeToLive;
- private string messageId;
- private MsgDeliveryMode deliveryMode;
- private MsgPriority priority;
- private Destination replyTo;
- private byte[] content;
- private string type;
- private event AcknowledgeHandler Acknowledger;
- private DateTime timestamp = new DateTime();
- private bool readOnlyMsgBody = false;
-
- public bool ReadOnlyBody
- {
- get { return readOnlyMsgBody; }
- set { readOnlyMsgBody = value; }
- }
-
- // IMessage interface
-
- public void Acknowledge()
- {
- if(null != Acknowledger)
- {
- Acknowledger(this);
- }
- }
-
- /// <summary>
- /// Clears out the message body. Clearing a message's body does not clear its header
- /// values or property entries.
- ///
- /// If this message body was read-only, calling this method leaves the message body in
- /// the same state as an empty body in a newly created message.
- /// </summary>
- public virtual void ClearBody()
- {
- this.Content = null;
- this.readOnlyMsgBody = false;
- }
-
- /// <summary>
- /// Clears a message's properties.
- ///
- /// The message's header fields and body are not cleared.
- /// </summary>
- public virtual void ClearProperties()
- {
- propertiesMap.Clear();
- }
-
- // Properties
-
- public IPrimitiveMap Properties
- {
- get { return propertiesMap; }
- }
-
-
- // NMS headers
-
- /// <summary>
- /// The correlation ID used to correlate messages with conversations or long running business processes
- /// </summary>
- public string NMSCorrelationID
- {
- get { return correlationId; }
- set { correlationId = value; }
- }
-
- /// <summary>
- /// The destination of the message
- /// </summary>
- public IDestination NMSDestination
- {
- get { return destination; }
- set { destination = value; }
- }
-
- /// <summary>
- /// The time in milliseconds that this message should expire in
- /// </summary>
- public TimeSpan NMSTimeToLive
- {
- get { return timeToLive; }
- set { timeToLive = value; }
- }
-
- /// <summary>
- /// The message ID which is set by the provider
- /// </summary>
- public string NMSMessageId
- {
- get { return messageId; }
- set { messageId = value; }
- }
-
- /// <summary>
- /// Whether or not this message is persistent
- /// </summary>
- public MsgDeliveryMode NMSDeliveryMode
- {
- get { return deliveryMode; }
- set { deliveryMode = value; }
- }
-
- /// <summary>
- /// The Priority on this message
- /// </summary>
- public MsgPriority NMSPriority
- {
- get { return priority; }
- set { priority = value; }
- }
-
- /// <summary>
- /// Returns true if this message has been redelivered to this or another consumer before being acknowledged successfully.
- /// </summary>
- public bool NMSRedelivered
- {
- get { return false; }
+ public class BaseMessage : IMessage
+ {
+ private PrimitiveMap propertiesMap = new PrimitiveMap();
+ private IDestination destination;
+ private string correlationId;
+ private TimeSpan timeToLive;
+ private string messageId;
+ private MsgDeliveryMode deliveryMode;
+ private MsgPriority priority;
+ private Destination replyTo;
+ private byte[] content;
+ private string type;
+ private event AcknowledgeHandler Acknowledger;
+ private DateTime timestamp = new DateTime();
+ private bool readOnlyMsgBody = false;
+
+ public bool ReadOnlyBody
+ {
+ get { return readOnlyMsgBody; }
+ set { readOnlyMsgBody = value; }
+ }
+
+ // IMessage interface
+
+ public void Acknowledge()
+ {
+ if(null != Acknowledger)
+ {
+ Acknowledger(this);
+ }
+ }
+
+ /// <summary>
+ /// Clears out the message body. Clearing a message's body does not clear its header
+ /// values or property entries.
+ ///
+ /// If this message body was read-only, calling this method leaves the message body in
+ /// the same state as an empty body in a newly created message.
+ /// </summary>
+ public virtual void ClearBody()
+ {
+ this.Content = null;
+ this.readOnlyMsgBody = false;
+ }
+
+ /// <summary>
+ /// Clears a message's properties.
+ ///
+ /// The message's header fields and body are not cleared.
+ /// </summary>
+ public virtual void ClearProperties()
+ {
+ propertiesMap.Clear();
+ }
+
+ // Properties
+
+ public IPrimitiveMap Properties
+ {
+ get { return propertiesMap; }
+ }
+
+
+ // NMS headers
+
+ /// <summary>
+ /// The correlation ID used to correlate messages with conversations or long running business processes
+ /// </summary>
+ public string NMSCorrelationID
+ {
+ get { return correlationId; }
+ set { correlationId = value; }
+ }
+
+ /// <summary>
+ /// The destination of the message
+ /// </summary>
+ public IDestination NMSDestination
+ {
+ get { return destination; }
+ set { destination = value; }
+ }
+
+ /// <summary>
+ /// The time in milliseconds that this message should expire in
+ /// </summary>
+ public TimeSpan NMSTimeToLive
+ {
+ get { return timeToLive; }
+ set { timeToLive = value; }
+ }
+
+ /// <summary>
+ /// The message ID which is set by the provider
+ /// </summary>
+ public string NMSMessageId
+ {
+ get { return messageId; }
+ set { messageId = value; }
+ }
+
+ /// <summary>
+ /// Whether or not this message is persistent
+ /// </summary>
+ public MsgDeliveryMode NMSDeliveryMode
+ {
+ get { return deliveryMode; }
+ set { deliveryMode = value; }
+ }
+
+ /// <summary>
+ /// The Priority on this message
+ /// </summary>
+ public MsgPriority NMSPriority
+ {
+ get { return priority; }
+ set { priority = value; }
+ }
+
+ /// <summary>
+ /// Returns true if this message has been redelivered to this or another consumer before being acknowledged successfully.
+ /// </summary>
+ public bool NMSRedelivered
+ {
+ get { return false; }
set { }
- }
+ }
- /// <summary>
- /// The destination that the consumer of this message should send replies to
- /// </summary>
- public IDestination NMSReplyTo
- {
- get { return replyTo; }
- set { replyTo = (Destination) value; }
- }
-
-
- /// <summary>
- /// The timestamp the broker added to the message
- /// </summary>
- public DateTime NMSTimestamp
- {
- get { return timestamp; }
- set { timestamp = value; }
- }
-
- public byte[] Content
- {
- get { return content; }
- set { this.content = value; }
- }
-
- /// <summary>
- /// The type name of this message
- /// </summary>
- public string NMSType
- {
- get { return type; }
- set { type = value; }
- }
-
-
- public object GetObjectProperty(string name)
- {
- return null;
- }
-
- public void SetObjectProperty(string name, object value)
- {
- }
-
- protected void FailIfReadOnlyBody()
- {
- if(ReadOnlyBody == true)
- {
- throw new MessageNotWriteableException("Message is in Read-Only mode.");
- }
- }
-
- protected void FailIfWriteOnlyBody()
- {
- if( ReadOnlyBody == false )
- {
- throw new MessageNotReadableException("Message is in Write-Only mode.");
- }
- }
- }
+ /// <summary>
+ /// The destination that the consumer of this message should send replies to
+ /// </summary>
+ public IDestination NMSReplyTo
+ {
+ get { return replyTo; }
+ set { replyTo = (Destination) value; }
+ }
+
+
+ /// <summary>
+ /// The timestamp the broker added to the message
+ /// </summary>
+ public DateTime NMSTimestamp
+ {
+ get { return timestamp; }
+ set { timestamp = value; }
+ }
+
+ public byte[] Content
+ {
+ get { return content; }
+ set { this.content = value; }
+ }
+
+ /// <summary>
+ /// The type name of this message
+ /// </summary>
+ public string NMSType
+ {
+ get { return type; }
+ set { type = value; }
+ }
+
+
+ public object GetObjectProperty(string name)
+ {
+ return null;
+ }
+
+ public void SetObjectProperty(string name, object value)
+ {
+ }
+
+ protected void FailIfReadOnlyBody()
+ {
+ if(ReadOnlyBody == true)
+ {
+ throw new MessageNotWriteableException("Message is in Read-Only mode.");
+ }
+ }
+
+ protected void FailIfWriteOnlyBody()
+ {
+ if( ReadOnlyBody == false )
+ {
+ throw new MessageNotReadableException("Message is in Write-Only mode.");
+ }
+ }
+ }
}
Modified: activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/BytesMessage.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/BytesMessage.cs?rev=1561226&r1=1561225&r2=1561226&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/BytesMessage.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/BytesMessage.cs Fri Jan 24 23:25:34 2014
@@ -21,491 +21,491 @@ using System.IO;
using System;
namespace Apache.NMS.Amqp
{
- /// <summary>
- ///
- /// A BytesMessage object is used to send a message containing a stream of uninterpreted
- /// bytes. It inherits from the Message interface and adds a bytes message body. The
- /// receiver of the message supplies the interpretation of the bytes.
- ///
- /// This message type is for client encoding of existing message formats. If possible,
- /// one of the other self-defining message types should be used instead.
- ///
- /// Although the NMS API allows the use of message properties with byte messages, they
- /// are typically not used, since the inclusion of properties may affect the format.
- ///
- /// When the message is first created, and when ClearBody is called, the body of the
- /// message is in write-only mode. After the first call to Reset has been made, the
- /// message body is in read-only mode. After a message has been sent, the client that
- /// sent it can retain and modify it without affecting the message that has been sent.
- /// The same message object can be sent multiple times. When a message has been received,
- /// the provider has called Reset so that the message body is in read-only mode for the
- /// client.
- ///
- /// If ClearBody is called on a message in read-only mode, the message body is cleared and
- /// the message is in write-only mode.
- ///
- /// If a client attempts to read a message in write-only mode, a MessageNotReadableException
- /// is thrown.
- ///
- /// If a client attempts to write a message in read-only mode, a MessageNotWriteableException
- /// is thrown.
- /// </summary>
- public class BytesMessage : BaseMessage, IBytesMessage
- {
- private EndianBinaryReader dataIn = null;
- private EndianBinaryWriter dataOut = null;
- private MemoryStream outputBuffer = null;
-
- // Need this later when we add compression to store true content length.
- private long length = 0;
-
- public override void ClearBody()
- {
- base.ClearBody();
- this.outputBuffer = null;
- this.dataIn = null;
- this.dataOut = null;
- this.length = 0;
- }
-
- public long BodyLength
- {
- get
- {
- InitializeReading();
- return this.length;
- }
- }
-
- public byte ReadByte()
- {
- InitializeReading();
- try
- {
- return dataIn.ReadByte();
- }
- catch(EndOfStreamException e)
- {
- throw NMSExceptionSupport.CreateMessageEOFException(e);
- }
- catch(IOException e)
- {
- throw NMSExceptionSupport.CreateMessageFormatException(e);
- }
- }
-
- public void WriteByte( byte value )
- {
- InitializeWriting();
- try
- {
- dataOut.Write( value );
- }
- catch(Exception e)
- {
- throw NMSExceptionSupport.Create(e);
- }
- }
-
- public bool ReadBoolean()
- {
- InitializeReading();
- try
- {
- return dataIn.ReadBoolean();
- }
- catch(EndOfStreamException e)
- {
- throw NMSExceptionSupport.CreateMessageEOFException(e);
- }
- catch(IOException e)
- {
- throw NMSExceptionSupport.CreateMessageFormatException(e);
- }
- }
-
- public void WriteBoolean( bool value )
- {
- InitializeWriting();
- try
- {
- dataOut.Write( value );
- }
- catch(Exception e)
- {
- throw NMSExceptionSupport.Create(e);
- }
- }
-
- public char ReadChar()
- {
- InitializeReading();
- try
- {
- return dataIn.ReadChar();
- }
- catch(EndOfStreamException e)
- {
- throw NMSExceptionSupport.CreateMessageEOFException(e);
- }
- catch(IOException e)
- {
- throw NMSExceptionSupport.CreateMessageFormatException(e);
- }
- }
-
- public void WriteChar( char value )
- {
- InitializeWriting();
- try
- {
- dataOut.Write( value );
- }
- catch(Exception e)
- {
- throw NMSExceptionSupport.Create(e);
- }
- }
-
- public short ReadInt16()
- {
- InitializeReading();
- try
- {
- return dataIn.ReadInt16();
- }
- catch(EndOfStreamException e)
- {
- throw NMSExceptionSupport.CreateMessageEOFException(e);
- }
- catch(IOException e)
- {
- throw NMSExceptionSupport.CreateMessageFormatException(e);
- }
- }
-
- public void WriteInt16( short value )
- {
- InitializeWriting();
- try
- {
- dataOut.Write( value );
- }
- catch(Exception e)
- {
- throw NMSExceptionSupport.Create(e);
- }
- }
-
- public int ReadInt32()
- {
- InitializeReading();
- try
- {
- return dataIn.ReadInt32();
- }
- catch(EndOfStreamException e)
- {
- throw NMSExceptionSupport.CreateMessageEOFException(e);
- }
- catch(IOException e)
- {
- throw NMSExceptionSupport.CreateMessageFormatException(e);
- }
- }
-
- public void WriteInt32( int value )
- {
- InitializeWriting();
- try
- {
- dataOut.Write( value );
- }
- catch(Exception e)
- {
- throw NMSExceptionSupport.Create(e);
- }
- }
-
- public long ReadInt64()
- {
- InitializeReading();
- try
- {
- return dataIn.ReadInt64();
- }
- catch(EndOfStreamException e)
- {
- throw NMSExceptionSupport.CreateMessageEOFException(e);
- }
- catch(IOException e)
- {
- throw NMSExceptionSupport.CreateMessageFormatException(e);
- }
- }
-
- public void WriteInt64( long value )
- {
- InitializeWriting();
- try
- {
- dataOut.Write( value );
- }
- catch(Exception e)
- {
- throw NMSExceptionSupport.Create(e);
- }
- }
-
- public float ReadSingle()
- {
- InitializeReading();
- try
- {
- return dataIn.ReadSingle();
- }
- catch(EndOfStreamException e)
- {
- throw NMSExceptionSupport.CreateMessageEOFException(e);
- }
- catch(IOException e)
- {
- throw NMSExceptionSupport.CreateMessageFormatException(e);
- }
- }
-
- public void WriteSingle( float value )
- {
- InitializeWriting();
- try
- {
- dataOut.Write( value );
- }
- catch(Exception e)
- {
- throw NMSExceptionSupport.Create(e);
- }
- }
-
- public double ReadDouble()
- {
- InitializeReading();
- try
- {
- return dataIn.ReadDouble();
- }
- catch(EndOfStreamException e)
- {
- throw NMSExceptionSupport.CreateMessageEOFException(e);
- }
- catch(IOException e)
- {
- throw NMSExceptionSupport.CreateMessageFormatException(e);
- }
- }
-
- public void WriteDouble( double value )
- {
- InitializeWriting();
- try
- {
- dataOut.Write( value );
- }
- catch(Exception e)
- {
- throw NMSExceptionSupport.Create(e);
- }
- }
-
- public int ReadBytes( byte[] value )
- {
- InitializeReading();
- try
- {
- return dataIn.Read( value, 0, value.Length );
- }
- catch(EndOfStreamException e)
- {
- throw NMSExceptionSupport.CreateMessageEOFException(e);
- }
- catch(IOException e)
- {
- throw NMSExceptionSupport.CreateMessageFormatException(e);
- }
- }
-
- public int ReadBytes( byte[] value, int length )
- {
- InitializeReading();
- try
- {
- return dataIn.Read( value, 0, length );
- }
- catch(EndOfStreamException e)
- {
- throw NMSExceptionSupport.CreateMessageEOFException(e);
- }
- catch(IOException e)
- {
- throw NMSExceptionSupport.CreateMessageFormatException(e);
- }
- }
-
- public void WriteBytes( byte[] value )
- {
- InitializeWriting();
- try
- {
- dataOut.Write( value, 0, value.Length );
- }
- catch(Exception e)
- {
- throw NMSExceptionSupport.Create(e);
- }
- }
-
- public void WriteBytes( byte[] value, int offset, int length )
- {
- InitializeWriting();
- try
- {
- dataOut.Write( value, offset, length );
- }
- catch(Exception e)
- {
- throw NMSExceptionSupport.Create(e);
- }
- }
-
- public string ReadString()
- {
- InitializeReading();
- try
- {
- // JMS, CMS and NMS all encode the String using a 16 bit size header.
- return dataIn.ReadString16();
- }
- catch(EndOfStreamException e)
- {
- throw NMSExceptionSupport.CreateMessageEOFException(e);
- }
- catch(IOException e)
- {
- throw NMSExceptionSupport.CreateMessageFormatException(e);
- }
- }
-
- public void WriteString( string value )
- {
- InitializeWriting();
- try
- {
- // JMS, CMS and NMS all encode the String using a 16 bit size header.
- dataOut.WriteString16(value);
- }
- catch(Exception e)
- {
- throw NMSExceptionSupport.Create(e);
- }
- }
-
- public void WriteObject( System.Object value )
- {
- InitializeWriting();
- if( value is System.Byte )
- {
- this.dataOut.Write( (byte) value );
- }
- else if( value is Char )
- {
- this.dataOut.Write( (char) value );
- }
- else if( value is Boolean )
- {
- this.dataOut.Write( (bool) value );
- }
- else if( value is Int16 )
- {
- this.dataOut.Write( (short) value );
- }
- else if( value is Int32 )
- {
- this.dataOut.Write( (int) value );
- }
- else if( value is Int64 )
- {
- this.dataOut.Write( (long) value );
- }
- else if( value is Single )
- {
- this.dataOut.Write( (float) value );
- }
- else if( value is Double )
- {
- this.dataOut.Write( (double) value );
- }
- else if( value is byte[] )
- {
- this.dataOut.Write( (byte[]) value );
- }
- else if( value is String )
- {
- this.dataOut.WriteString16( (string) value );
- }
- else
- {
- throw new MessageFormatException("Cannot write non-primitive type:" + value.GetType());
- }
- }
-
- public void Reset()
- {
- StoreContent();
- this.dataIn = null;
- this.dataOut = null;
- this.outputBuffer = null;
- this.ReadOnlyBody = true;
- }
-
- private void InitializeReading()
- {
- FailIfWriteOnlyBody();
- if(this.dataIn == null)
- {
- if(this.Content != null)
- {
- this.length = this.Content.Length;
- }
-
- // TODO - Add support for Message Compression.
- MemoryStream bytesIn = new MemoryStream(this.Content, false);
- dataIn = new EndianBinaryReader(bytesIn);
- }
- }
-
- private void InitializeWriting()
- {
- FailIfReadOnlyBody();
- if(this.dataOut == null)
- {
- // TODO - Add support for Message Compression.
- this.outputBuffer = new MemoryStream();
- this.dataOut = new EndianBinaryWriter(outputBuffer);
- }
- }
-
- private void StoreContent()
- {
- if( dataOut != null)
- {
- dataOut.Close();
- // TODO - Add support for Message Compression.
-
- this.Content = outputBuffer.ToArray();
- this.dataOut = null;
- this.outputBuffer = null;
- }
- }
- }
+ /// <summary>
+ ///
+ /// A BytesMessage object is used to send a message containing a stream of uninterpreted
+ /// bytes. It inherits from the Message interface and adds a bytes message body. The
+ /// receiver of the message supplies the interpretation of the bytes.
+ ///
+ /// This message type is for client encoding of existing message formats. If possible,
+ /// one of the other self-defining message types should be used instead.
+ ///
+ /// Although the NMS API allows the use of message properties with byte messages, they
+ /// are typically not used, since the inclusion of properties may affect the format.
+ ///
+ /// When the message is first created, and when ClearBody is called, the body of the
+ /// message is in write-only mode. After the first call to Reset has been made, the
+ /// message body is in read-only mode. After a message has been sent, the client that
+ /// sent it can retain and modify it without affecting the message that has been sent.
+ /// The same message object can be sent multiple times. When a message has been received,
+ /// the provider has called Reset so that the message body is in read-only mode for the
+ /// client.
+ ///
+ /// If ClearBody is called on a message in read-only mode, the message body is cleared and
+ /// the message is in write-only mode.
+ ///
+ /// If a client attempts to read a message in write-only mode, a MessageNotReadableException
+ /// is thrown.
+ ///
+ /// If a client attempts to write a message in read-only mode, a MessageNotWriteableException
+ /// is thrown.
+ /// </summary>
+ public class BytesMessage : BaseMessage, IBytesMessage
+ {
+ private EndianBinaryReader dataIn = null;
+ private EndianBinaryWriter dataOut = null;
+ private MemoryStream outputBuffer = null;
+
+ // Need this later when we add compression to store true content length.
+ private long length = 0;
+
+ public override void ClearBody()
+ {
+ base.ClearBody();
+ this.outputBuffer = null;
+ this.dataIn = null;
+ this.dataOut = null;
+ this.length = 0;
+ }
+
+ public long BodyLength
+ {
+ get
+ {
+ InitializeReading();
+ return this.length;
+ }
+ }
+
+ public byte ReadByte()
+ {
+ InitializeReading();
+ try
+ {
+ return dataIn.ReadByte();
+ }
+ catch(EndOfStreamException e)
+ {
+ throw NMSExceptionSupport.CreateMessageEOFException(e);
+ }
+ catch(IOException e)
+ {
+ throw NMSExceptionSupport.CreateMessageFormatException(e);
+ }
+ }
+
+ public void WriteByte( byte value )
+ {
+ InitializeWriting();
+ try
+ {
+ dataOut.Write( value );
+ }
+ catch(Exception e)
+ {
+ throw NMSExceptionSupport.Create(e);
+ }
+ }
+
+ public bool ReadBoolean()
+ {
+ InitializeReading();
+ try
+ {
+ return dataIn.ReadBoolean();
+ }
+ catch(EndOfStreamException e)
+ {
+ throw NMSExceptionSupport.CreateMessageEOFException(e);
+ }
+ catch(IOException e)
+ {
+ throw NMSExceptionSupport.CreateMessageFormatException(e);
+ }
+ }
+
+ public void WriteBoolean( bool value )
+ {
+ InitializeWriting();
+ try
+ {
+ dataOut.Write( value );
+ }
+ catch(Exception e)
+ {
+ throw NMSExceptionSupport.Create(e);
+ }
+ }
+
+ public char ReadChar()
+ {
+ InitializeReading();
+ try
+ {
+ return dataIn.ReadChar();
+ }
+ catch(EndOfStreamException e)
+ {
+ throw NMSExceptionSupport.CreateMessageEOFException(e);
+ }
+ catch(IOException e)
+ {
+ throw NMSExceptionSupport.CreateMessageFormatException(e);
+ }
+ }
+
+ public void WriteChar( char value )
+ {
+ InitializeWriting();
+ try
+ {
+ dataOut.Write( value );
+ }
+ catch(Exception e)
+ {
+ throw NMSExceptionSupport.Create(e);
+ }
+ }
+
+ public short ReadInt16()
+ {
+ InitializeReading();
+ try
+ {
+ return dataIn.ReadInt16();
+ }
+ catch(EndOfStreamException e)
+ {
+ throw NMSExceptionSupport.CreateMessageEOFException(e);
+ }
+ catch(IOException e)
+ {
+ throw NMSExceptionSupport.CreateMessageFormatException(e);
+ }
+ }
+
+ public void WriteInt16( short value )
+ {
+ InitializeWriting();
+ try
+ {
+ dataOut.Write( value );
+ }
+ catch(Exception e)
+ {
+ throw NMSExceptionSupport.Create(e);
+ }
+ }
+
+ public int ReadInt32()
+ {
+ InitializeReading();
+ try
+ {
+ return dataIn.ReadInt32();
+ }
+ catch(EndOfStreamException e)
+ {
+ throw NMSExceptionSupport.CreateMessageEOFException(e);
+ }
+ catch(IOException e)
+ {
+ throw NMSExceptionSupport.CreateMessageFormatException(e);
+ }
+ }
+
+ public void WriteInt32( int value )
+ {
+ InitializeWriting();
+ try
+ {
+ dataOut.Write( value );
+ }
+ catch(Exception e)
+ {
+ throw NMSExceptionSupport.Create(e);
+ }
+ }
+
+ public long ReadInt64()
+ {
+ InitializeReading();
+ try
+ {
+ return dataIn.ReadInt64();
+ }
+ catch(EndOfStreamException e)
+ {
+ throw NMSExceptionSupport.CreateMessageEOFException(e);
+ }
+ catch(IOException e)
+ {
+ throw NMSExceptionSupport.CreateMessageFormatException(e);
+ }
+ }
+
+ public void WriteInt64( long value )
+ {
+ InitializeWriting();
+ try
+ {
+ dataOut.Write( value );
+ }
+ catch(Exception e)
+ {
+ throw NMSExceptionSupport.Create(e);
+ }
+ }
+
+ public float ReadSingle()
+ {
+ InitializeReading();
+ try
+ {
+ return dataIn.ReadSingle();
+ }
+ catch(EndOfStreamException e)
+ {
+ throw NMSExceptionSupport.CreateMessageEOFException(e);
+ }
+ catch(IOException e)
+ {
+ throw NMSExceptionSupport.CreateMessageFormatException(e);
+ }
+ }
+
+ public void WriteSingle( float value )
+ {
+ InitializeWriting();
+ try
+ {
+ dataOut.Write( value );
+ }
+ catch(Exception e)
+ {
+ throw NMSExceptionSupport.Create(e);
+ }
+ }
+
+ public double ReadDouble()
+ {
+ InitializeReading();
+ try
+ {
+ return dataIn.ReadDouble();
+ }
+ catch(EndOfStreamException e)
+ {
+ throw NMSExceptionSupport.CreateMessageEOFException(e);
+ }
+ catch(IOException e)
+ {
+ throw NMSExceptionSupport.CreateMessageFormatException(e);
+ }
+ }
+
+ public void WriteDouble( double value )
+ {
+ InitializeWriting();
+ try
+ {
+ dataOut.Write( value );
+ }
+ catch(Exception e)
+ {
+ throw NMSExceptionSupport.Create(e);
+ }
+ }
+
+ public int ReadBytes( byte[] value )
+ {
+ InitializeReading();
+ try
+ {
+ return dataIn.Read( value, 0, value.Length );
+ }
+ catch(EndOfStreamException e)
+ {
+ throw NMSExceptionSupport.CreateMessageEOFException(e);
+ }
+ catch(IOException e)
+ {
+ throw NMSExceptionSupport.CreateMessageFormatException(e);
+ }
+ }
+
+ public int ReadBytes( byte[] value, int length )
+ {
+ InitializeReading();
+ try
+ {
+ return dataIn.Read( value, 0, length );
+ }
+ catch(EndOfStreamException e)
+ {
+ throw NMSExceptionSupport.CreateMessageEOFException(e);
+ }
+ catch(IOException e)
+ {
+ throw NMSExceptionSupport.CreateMessageFormatException(e);
+ }
+ }
+
+ public void WriteBytes( byte[] value )
+ {
+ InitializeWriting();
+ try
+ {
+ dataOut.Write( value, 0, value.Length );
+ }
+ catch(Exception e)
+ {
+ throw NMSExceptionSupport.Create(e);
+ }
+ }
+
+ public void WriteBytes( byte[] value, int offset, int length )
+ {
+ InitializeWriting();
+ try
+ {
+ dataOut.Write( value, offset, length );
+ }
+ catch(Exception e)
+ {
+ throw NMSExceptionSupport.Create(e);
+ }
+ }
+
+ public string ReadString()
+ {
+ InitializeReading();
+ try
+ {
+ // JMS, CMS and NMS all encode the String using a 16 bit size header.
+ return dataIn.ReadString16();
+ }
+ catch(EndOfStreamException e)
+ {
+ throw NMSExceptionSupport.CreateMessageEOFException(e);
+ }
+ catch(IOException e)
+ {
+ throw NMSExceptionSupport.CreateMessageFormatException(e);
+ }
+ }
+
+ public void WriteString( string value )
+ {
+ InitializeWriting();
+ try
+ {
+ // JMS, CMS and NMS all encode the String using a 16 bit size header.
+ dataOut.WriteString16(value);
+ }
+ catch(Exception e)
+ {
+ throw NMSExceptionSupport.Create(e);
+ }
+ }
+
+ public void WriteObject( System.Object value )
+ {
+ InitializeWriting();
+ if( value is System.Byte )
+ {
+ this.dataOut.Write( (byte) value );
+ }
+ else if( value is Char )
+ {
+ this.dataOut.Write( (char) value );
+ }
+ else if( value is Boolean )
+ {
+ this.dataOut.Write( (bool) value );
+ }
+ else if( value is Int16 )
+ {
+ this.dataOut.Write( (short) value );
+ }
+ else if( value is Int32 )
+ {
+ this.dataOut.Write( (int) value );
+ }
+ else if( value is Int64 )
+ {
+ this.dataOut.Write( (long) value );
+ }
+ else if( value is Single )
+ {
+ this.dataOut.Write( (float) value );
+ }
+ else if( value is Double )
+ {
+ this.dataOut.Write( (double) value );
+ }
+ else if( value is byte[] )
+ {
+ this.dataOut.Write( (byte[]) value );
+ }
+ else if( value is String )
+ {
+ this.dataOut.WriteString16( (string) value );
+ }
+ else
+ {
+ throw new MessageFormatException("Cannot write non-primitive type:" + value.GetType());
+ }
+ }
+
+ public void Reset()
+ {
+ StoreContent();
+ this.dataIn = null;
+ this.dataOut = null;
+ this.outputBuffer = null;
+ this.ReadOnlyBody = true;
+ }
+
+ private void InitializeReading()
+ {
+ FailIfWriteOnlyBody();
+ if(this.dataIn == null)
+ {
+ if(this.Content != null)
+ {
+ this.length = this.Content.Length;
+ }
+
+ // TODO - Add support for Message Compression.
+ MemoryStream bytesIn = new MemoryStream(this.Content, false);
+ dataIn = new EndianBinaryReader(bytesIn);
+ }
+ }
+
+ private void InitializeWriting()
+ {
+ FailIfReadOnlyBody();
+ if(this.dataOut == null)
+ {
+ // TODO - Add support for Message Compression.
+ this.outputBuffer = new MemoryStream();
+ this.dataOut = new EndianBinaryWriter(outputBuffer);
+ }
+ }
+
+ private void StoreContent()
+ {
+ if( dataOut != null)
+ {
+ dataOut.Close();
+ // TODO - Add support for Message Compression.
+
+ this.Content = outputBuffer.ToArray();
+ this.dataOut = null;
+ this.outputBuffer = null;
+ }
+ }
+ }
}
Modified: activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/ConnectionClosedException.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/ConnectionClosedException.cs?rev=1561226&r1=1561225&r2=1561226&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/ConnectionClosedException.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/ConnectionClosedException.cs Fri Jan 24 23:25:34 2014
@@ -19,51 +19,51 @@ using System;
namespace Apache.NMS.Amqp
{
- /// <summary>
- /// Exception thrown when a connection is used that it already closed
- /// </summary>
- [Serializable]
- public class ConnectionClosedException : NMSException
- {
- public ConnectionClosedException()
- : base("The connection is already closed!")
- {
- }
-
- public ConnectionClosedException(string message)
- : base(message)
- {
- }
-
- public ConnectionClosedException(string message, string errorCode)
- : base(message, errorCode)
- {
- }
-
- public ConnectionClosedException(string message, Exception innerException)
- : base(message, innerException)
- {
- }
-
- public ConnectionClosedException(string message, string errorCode, Exception innerException)
- : base(message, errorCode, innerException)
- {
- }
-
- #region ISerializable interface implementation
-
- /// <summary>
- /// Initializes a new instance of the ConnectionClosedException class with serialized data.
- /// Throws System.ArgumentNullException if the info parameter is null.
- /// Throws System.Runtime.Serialization.SerializationException if the class name is null or System.Exception.HResult is zero (0).
- /// </summary>
- /// <param name="info">The SerializationInfo that holds the serialized object data about the exception being thrown.</param>
- /// <param name="context">The StreamingContext that contains contextual information about the source or destination.</param>
- protected ConnectionClosedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
- : base(info, context)
- {
- }
+ /// <summary>
+ /// Exception thrown when a connection is used that it already closed
+ /// </summary>
+ [Serializable]
+ public class ConnectionClosedException : NMSException
+ {
+ public ConnectionClosedException()
+ : base("The connection is already closed!")
+ {
+ }
+
+ public ConnectionClosedException(string message)
+ : base(message)
+ {
+ }
+
+ public ConnectionClosedException(string message, string errorCode)
+ : base(message, errorCode)
+ {
+ }
+
+ public ConnectionClosedException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ public ConnectionClosedException(string message, string errorCode, Exception innerException)
+ : base(message, errorCode, innerException)
+ {
+ }
+
+ #region ISerializable interface implementation
+
+ /// <summary>
+ /// Initializes a new instance of the ConnectionClosedException class with serialized data.
+ /// Throws System.ArgumentNullException if the info parameter is null.
+ /// Throws System.Runtime.Serialization.SerializationException if the class name is null or System.Exception.HResult is zero (0).
+ /// </summary>
+ /// <param name="info">The SerializationInfo that holds the serialized object data about the exception being thrown.</param>
+ /// <param name="context">The StreamingContext that contains contextual information about the source or destination.</param>
+ protected ConnectionClosedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
+ : base(info, context)
+ {
+ }
- #endregion
- }
+ #endregion
+ }
}
Modified: activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/DefaultMessageConverter.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/DefaultMessageConverter.cs?rev=1561226&r1=1561225&r2=1561226&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/DefaultMessageConverter.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/DefaultMessageConverter.cs Fri Jan 24 23:25:34 2014
@@ -98,7 +98,7 @@ namespace Apache.NMS.Amqp
{
answer.NMSCorrelationID = message.CorrelationId;
answer.NMSDeliveryMode = (message.Durable ? MsgDeliveryMode.Persistent : MsgDeliveryMode.NonPersistent);
- answer.NMSMessageId = message.Subject;
+ answer.NMSMessageId = message.MessageId;
answer.NMSPriority = ToNmsPriority(message.Priority);
answer.NMSRedelivered = message.Redelivered;
answer.NMSReplyTo = ToNmsDestination(message.ReplyTo);
Modified: activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/Destination.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/Destination.cs?rev=1561226&r1=1561225&r2=1561226&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/Destination.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/Destination.cs Fri Jan 24 23:25:34 2014
@@ -15,134 +15,260 @@
* limitations under the License.
*/
using System;
+using System.Collections.Generic;
+using Org.Apache.Qpid.Messaging;
+
+// Typedef for options map
+using OptionsMap = System.Collections.Generic.Dictionary<System.String, System.Object>;
+
namespace Apache.NMS.Amqp
{
- /// <summary>
- /// Summary description for Destination.
- /// </summary>
- public abstract class Destination : IDestination
- {
-
- private String path = "";
-
- /**
- * The Default Constructor
- */
- protected Destination()
- {
- }
-
- /**
- * Construct the Destination with a defined physical name;
- *
- * @param name
- */
- protected Destination(String name)
- {
- Path = name;
- }
-
- public String Path
- {
- get { return this.path; }
- set
- {
- this.path = value;
- //if(!this.path.Contains("\\"))
- //{
- // // Queues must have paths in them. If no path specified, then
- // // default to local machine.
- // this.path = ".\\" + this.path;
- //}
- }
- }
-
-
- public bool IsTopic
- {
- get
- {
- return DestinationType == DestinationType.Topic
- || DestinationType == DestinationType.TemporaryTopic;
- }
- }
-
- public bool IsQueue
- {
- get
- {
- return !IsTopic;
- }
- }
-
-
- public bool IsTemporary
- {
- get
- {
- return DestinationType == DestinationType.TemporaryQueue
- || DestinationType == DestinationType.TemporaryTopic;
- }
- }
-
- /**
- * @return string representation of this instance
- */
- public override String ToString()
- {
- return this.path;
- }
-
- /**
- * @return hashCode for this instance
- */
- public override int GetHashCode()
- {
- int answer = 37;
-
- if(this.path != null)
- {
- answer = path.GetHashCode();
- }
- if(IsTopic)
- {
- answer ^= 0xfabfab;
- }
- return answer;
- }
-
- /**
- * if the object passed in is equivalent, return true
- *
- * @param obj the object to compare
- * @return true if this instance and obj are equivalent
- */
- public override bool Equals(Object obj)
- {
- bool result = this == obj;
- if(!result && obj != null && obj is Destination)
- {
- Destination other = (Destination) obj;
- result = this.DestinationType == other.DestinationType
- && this.path.Equals(other.path);
- }
- return result;
- }
-
- /**
- * Factory method to create a child destination if this destination is a composite
- * @param name
- * @return the created Destination
- */
- public abstract Destination CreateDestination(String name);
-
-
- public abstract DestinationType DestinationType
- {
- get;
- }
+ /// <summary>
+ /// Summary description for Destination.
+ ///
+ /// A Destination in Amqp is contained in a Qpid.Messaging.Address.
+ /// Destination constructors:
+ /// * from strings in the form:
+ /// name[/subject];[{keyword:value, ...}]
+ /// Where:
+ /// name - is the simple name of the queue or topic
+ /// subject - is the associated subject
+ /// options are supplied in a map of keyword:value pairs
+ /// * from (string, string, OptionsMap)
+ /// * from other Destinations of the same type
+ /// Properties:
+ /// Path - the full ToStr() value of the Messaging.Address.
+ /// Name - Messaging.Address name
+ /// Subject - Messaging.Address subject
+ /// Options - Messaging.Address OptionsMap dictionary
+ /// Address - the whole Messaging.Address
+ /// See http://qpid.apache.org/releases/qpid-0.24/programming/book/
+ /// for more information about the Qpid Messaging API and Addresses
+ /// </summary>
+ public abstract class Destination : IDestination
+ {
+ private Address qpidAddress = null;
+
+ /**
+ * The Default Constructor
+ */
+ protected Destination()
+ {
+ qpidAddress = new Address();
+ }
+
+ /**
+ * Construct the Destination with a defined physical name;
+ *
+ * @param name
+ */
+ protected Destination(String name)
+ {
+ qpidAddress = new Address(name);
+ }
+
+ /**
+ * Construct the Destination with name, subject, and options
+ *
+ * @param name
+ * @param subject
+ * @param options dictionary
+ */
+ protected Destination(String name, String subject, OptionsMap options)
+ {
+ qpidAddress = new Address(name, subject, options);
+ }
+
+
+ /**
+ * Construct the Destination with name, subject, options, and type
+ *
+ * @param name
+ * @param subject
+ * @param options dictionary
+ * @param type
+ */
+ protected Destination(String name, String subject, OptionsMap options, String type)
+ {
+ qpidAddress = new Address(name, subject, options, type);
+ }
+
+
+ protected Destination(Destination other)
+ {
+ qpidAddress = new Org.Apache.Qpid.Messaging.Address(other.Address);
+ }
+
+
+ /**
+ * Path property
+ * get - returns Messaging.Address full string
+ * set - creates new Messaging.Address from string
+ */
+ public String Path
+ {
+ get { return qpidAddress.ToStr(); }
+ set
+ {
+ qpidAddress = new Address(value);
+ }
+ }
+
+
+ public bool IsTopic
+ {
+ get
+ {
+ return DestinationType == DestinationType.Topic
+ || DestinationType == DestinationType.TemporaryTopic;
+ }
+ }
+
+ public bool IsQueue
+ {
+ get
+ {
+ return !IsTopic;
+ }
+ }
+
+
+ public bool IsTemporary
+ {
+ get
+ {
+ return DestinationType == DestinationType.TemporaryQueue
+ || DestinationType == DestinationType.TemporaryTopic;
+ }
+ }
+
+
+ /**
+ * @return string representation of this instance
+ */
+ public override String ToString()
+ {
+ return Path;
+ }
+
+
+ /**
+ * @return hashCode for this instance
+ * TODO: figure this out
+ */
+ public override int GetHashCode()
+ {
+ int answer = 37;
+
+ if(!String.IsNullOrEmpty(qpidAddress.Name))
+ {
+ answer = qpidAddress.Name.GetHashCode();
+ }
+ if(IsTopic)
+ {
+ answer ^= 0xfabfab;
+ }
+ return answer;
+ }
+
+
+ /**
+ * if the object passed in is equivalent, return true
+ *
+ * @param obj the object to compare
+ * @return true if this instance and obj are equivalent
+ */
+ public override bool Equals(Object obj)
+ {
+ bool result = this == obj;
+ if(!result && obj != null && obj is Destination)
+ {
+ Destination other = (Destination) obj;
+ result = this.DestinationType == other.DestinationType;
+ if (!result)
+ {
+ String myPath = qpidAddress.ToStr();
+ result = myPath.Equals(other.Path);
+ }
+ }
+ return result;
+ }
+
+
+ /**
+ * Qpid Address accessor
+ * Name property
+ */
+ public String Name
+ {
+ get { return qpidAddress.Name; }
+ set { qpidAddress.Name = value; }
+ }
+
+ /**
+ * Qpid Address accessor
+ * Subject property
+ */
+ public String Subject
+ {
+ get { return qpidAddress.Subject; }
+ set { qpidAddress.Subject = value; }
+ }
+
+ /**
+ * Qpid Address accessor
+ * Options property
+ */
+ public OptionsMap Options
+ {
+ get { return qpidAddress.Options; }
+ set { qpidAddress.Options = value; }
+ }
+
+
+ /**
+ * Qpid Address accessor
+ * Address property
+ */
+ public Org.Apache.Qpid.Messaging.Address Address
+ {
+ get { return qpidAddress; }
+ set
+ {
+ string type = qpidAddress.Type;
+ if (!type.Equals(value.Type))
+ {
+ throw new NMSException("Cannot change Destination type through Address assignment");
+ }
+ qpidAddress = value;
+ }
+ }
+
+
+ /**
+ * Factory method to create a child destination
+ * @param name
+ * @return the created Destination
+ */
+ public abstract Destination CreateDestination(String name);
+
+
+ /**
+ * Factory method to create a child destination
+ * @param name
+ * @param subject
+ * @param options variant map
+ * @return the created Destination
+ */
+ public abstract Destination CreateDestination(String name, String subject, OptionsMap options);
+
+
+ public abstract DestinationType DestinationType
+ {
+ get;
+ }
- }
+ }
}
Modified: activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/IMessageConverter.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/IMessageConverter.cs?rev=1561226&r1=1561225&r2=1561226&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/IMessageConverter.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/IMessageConverter.cs Fri Jan 24 23:25:34 2014
@@ -18,10 +18,10 @@ using Org.Apache.Qpid.Messaging;
namespace Apache.NMS.Amqp
{
- public interface IMessageConverter
- {
+ public interface IMessageConverter
+ {
- Message ToAmqpMessage(IMessage message);
- IMessage ToNmsMessage(Message message);
- }
+ Message ToAmqpMessage(IMessage message);
+ IMessage ToNmsMessage(Message message);
+ }
}
Modified: activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/MapMessage.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/MapMessage.cs?rev=1561226&r1=1561225&r2=1561226&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/MapMessage.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/MapMessage.cs Fri Jan 24 23:25:34 2014
@@ -19,15 +19,15 @@ using Apache.NMS.Util;
namespace Apache.NMS.Amqp
{
- public class MapMessage : BaseMessage, IMapMessage
- {
- private IPrimitiveMap body = new PrimitiveMap();
+ public class MapMessage : BaseMessage, IMapMessage
+ {
+ private IPrimitiveMap body = new PrimitiveMap();
- public IPrimitiveMap Body
- {
- get { return body; }
- set { body = value; }
- }
- }
+ public IPrimitiveMap Body
+ {
+ get { return body; }
+ set { body = value; }
+ }
+ }
}
Modified: activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/MessageConsumer.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/MessageConsumer.cs?rev=1561226&r1=1561225&r2=1561226&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/MessageConsumer.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/MessageConsumer.cs Fri Jan 24 23:25:34 2014
@@ -79,7 +79,7 @@ namespace Apache.NMS.Amqp
Tracer.DebugFormat("Start Consumer Id = " + ConsumerId.ToString());
if (qpidReceiver == null)
{
- qpidReceiver = session.CreateQpidReceiver(destination.ToString());
+ qpidReceiver = session.CreateQpidReceiver(destination.Address);
}
}
catch (Org.Apache.Qpid.Messaging.QpidException e)
Modified: activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/MessageProducer.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/MessageProducer.cs?rev=1561226&r1=1561225&r2=1561226&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/MessageProducer.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/MessageProducer.cs Fri Jan 24 23:25:34 2014
@@ -79,7 +79,7 @@ namespace Apache.NMS.Amqp
Tracer.DebugFormat("Start Producer Id = " + ProducerId.ToString());
if (qpidSender == null)
{
- qpidSender = session.CreateQpidSender(destination.ToString());
+ qpidSender = session.CreateQpidSender(destination.Address);
}
}
catch (Org.Apache.Qpid.Messaging.QpidException e)
Modified: activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/ObjectMessage.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/ObjectMessage.cs?rev=1561226&r1=1561225&r2=1561226&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/ObjectMessage.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/ObjectMessage.cs Fri Jan 24 23:25:34 2014
@@ -22,73 +22,69 @@ using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
#endif
+// TODO: Any support
+
namespace Apache.NMS.Amqp
{
- public class ObjectMessage : BaseMessage, IObjectMessage
- {
- private object body;
+ public class ObjectMessage : BaseMessage, IObjectMessage
+ {
+ private object body;
#if !(PocketPC||NETCF||NETCF_2_0)
- private IFormatter formatter;
+ private IFormatter formatter;
#endif
- public ObjectMessage()
- {
- }
-
- public ObjectMessage(object body)
- {
- this.body = body;
- }
-
- public object Body
- {
- get
- {
+ public ObjectMessage()
+ {
+ }
+
+ public ObjectMessage(object body)
+ {
+ this.body = body;
+ }
+
+ public object Body
+ {
+ get
+ {
#if !(PocketPC||NETCF||NETCF_2_0)
- if(body == null)
- {
- body = Formatter.Deserialize(new MemoryStream(Content));
- }
+ if(body == null)
+ {
+ body = Formatter.Deserialize(new MemoryStream(Content));
+ }
#else
#endif
- return body;
- }
+ return body;
+ }
- set
- {
+ set
+ {
#if !(PocketPC||NETCF||NETCF_2_0)
- body = value;
+ body = value;
#else
- throw new NotImplementedException();
+ throw new NotImplementedException();
#endif
- }
- }
+ }
+ }
#if !(PocketPC||NETCF||NETCF_2_0)
- public IFormatter Formatter
- {
- get
- {
- if(formatter == null)
- {
- formatter = new BinaryFormatter();
- }
- return formatter;
- }
-
- set
- {
- formatter = value;
- }
- }
+ public IFormatter Formatter
+ {
+ get
+ {
+ if(formatter == null)
+ {
+ formatter = new BinaryFormatter();
+ }
+ return formatter;
+ }
+
+ set
+ {
+ formatter = value;
+ }
+ }
#endif
- }
+ }
}
-
-
-
-
-
-
Modified: activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/Queue.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/Queue.cs?rev=1561226&r1=1561225&r2=1561226&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/Queue.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/Queue.cs Fri Jan 24 23:25:34 2014
@@ -16,45 +16,56 @@
*/
using System;
+// Typedef for options map
+using OptionsMap = System.Collections.Generic.Dictionary<System.String, System.Object>;
+
namespace Apache.NMS.Amqp
{
- /// <summary>
- /// Summary description for Queue.
- /// </summary>
- public class Queue : Destination, IQueue
- {
-
- public Queue()
- : base()
- {
- }
-
- public Queue(String name)
- : base(name)
- {
- }
-
- override public DestinationType DestinationType
- {
- get
- {
- return DestinationType.Queue;
- }
- }
-
- public String QueueName
- {
- get { return Path; }
- }
-
-
- public override Destination CreateDestination(String name)
- {
- return new Queue(name);
- }
-
-
- }
+ /// <summary>
+ /// Summary description for Queue.
+ /// </summary>
+ public class Queue : Destination, IQueue
+ {
+
+ public Queue()
+ : base()
+ {
+ }
+
+ public Queue(String name)
+ : base(name)
+ {
+ }
+
+ public Queue(String name, string subject, OptionsMap options)
+ : base(name, subject, options, "queue")
+ {
+ }
+
+ override public DestinationType DestinationType
+ {
+ get
+ {
+ return DestinationType.Queue;
+ }
+ }
+
+ public String QueueName
+ {
+ get { return Path; }
+ }
+
+
+ public override Destination CreateDestination(String name)
+ {
+ return new Queue(name);
+ }
+
+ public override Destination CreateDestination(String name, string subject, OptionsMap options)
+ {
+ return new Queue(name, subject, options);
+ }
+ }
}
Modified: activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/Session.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/Session.cs?rev=1561226&r1=1561225&r2=1561226&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/Session.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/Session.cs Fri Jan 24 23:25:34 2014
@@ -20,6 +20,9 @@ using System.Threading;
using Apache.NMS.Util;
using Org.Apache.Qpid.Messaging;
+// Typedef for options map
+using OptionsMap = System.Collections.Generic.Dictionary<System.String, System.Object>;
+
namespace Apache.NMS.Amqp
{
/// <summary>
@@ -382,6 +385,16 @@ namespace Apache.NMS.Amqp
return new Topic(name);
}
+ public IQueue GetQueue(string name, string subject, OptionsMap options)
+ {
+ return new Queue(name, subject, options);
+ }
+
+ public ITopic GetTopic(string name, string subject, OptionsMap options)
+ {
+ return new Topic(name, subject, options);
+ }
+
public ITemporaryQueue CreateTemporaryQueue()
{
throw new NotSupportedException("TODO: Temp queue");
@@ -558,7 +571,7 @@ namespace Apache.NMS.Amqp
}
- public Org.Apache.Qpid.Messaging.Receiver CreateQpidReceiver(string address)
+ public Org.Apache.Qpid.Messaging.Receiver CreateQpidReceiver(Address address)
{
if (!IsStarted)
{
@@ -567,7 +580,7 @@ namespace Apache.NMS.Amqp
return qpidSession.CreateReceiver(address);
}
- public Org.Apache.Qpid.Messaging.Sender CreateQpidSender(string address)
+ public Org.Apache.Qpid.Messaging.Sender CreateQpidSender(Address address)
{
if (!IsStarted)
{
Modified: activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/SessionClosedException.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/SessionClosedException.cs?rev=1561226&r1=1561225&r2=1561226&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/SessionClosedException.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/SessionClosedException.cs Fri Jan 24 23:25:34 2014
@@ -19,51 +19,51 @@ using System;
namespace Apache.NMS.Amqp
{
- /// <summary>
- /// Exception thrown when a session is used that it already closed
- /// </summary>
- [Serializable]
- public class SessionClosedException : NMSException
- {
- public SessionClosedException()
- : base("The session is already closed!")
- {
- }
-
- public SessionClosedException(string message)
- : base(message)
- {
- }
-
- public SessionClosedException(string message, string errorCode)
- : base(message, errorCode)
- {
- }
-
- public SessionClosedException(string message, Exception innerException)
- : base(message, innerException)
- {
- }
-
- public SessionClosedException(string message, string errorCode, Exception innerException)
- : base(message, errorCode, innerException)
- {
- }
-
- #region ISerializable interface implementation
-
- /// <summary>
- /// Initializes a new instance of the SessionClosedException class with serialized data.
- /// Throws System.ArgumentNullException if the info parameter is null.
- /// Throws System.Runtime.Serialization.SerializationException if the class name is null or System.Exception.HResult is zero (0).
- /// </summary>
- /// <param name="info">The SerializationInfo that holds the serialized object data about the exception being thrown.</param>
- /// <param name="context">The StreamingContext that contains contextual information about the source or destination.</param>
- protected SessionClosedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
- : base(info, context)
- {
- }
+ /// <summary>
+ /// Exception thrown when a session is used that it already closed
+ /// </summary>
+ [Serializable]
+ public class SessionClosedException : NMSException
+ {
+ public SessionClosedException()
+ : base("The session is already closed!")
+ {
+ }
+
+ public SessionClosedException(string message)
+ : base(message)
+ {
+ }
+
+ public SessionClosedException(string message, string errorCode)
+ : base(message, errorCode)
+ {
+ }
+
+ public SessionClosedException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ public SessionClosedException(string message, string errorCode, Exception innerException)
+ : base(message, errorCode, innerException)
+ {
+ }
+
+ #region ISerializable interface implementation
+
+ /// <summary>
+ /// Initializes a new instance of the SessionClosedException class with serialized data.
+ /// Throws System.ArgumentNullException if the info parameter is null.
+ /// Throws System.Runtime.Serialization.SerializationException if the class name is null or System.Exception.HResult is zero (0).
+ /// </summary>
+ /// <param name="info">The SerializationInfo that holds the serialized object data about the exception being thrown.</param>
+ /// <param name="context">The StreamingContext that contains contextual information about the source or destination.</param>
+ protected SessionClosedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
+ : base(info, context)
+ {
+ }
- #endregion
- }
+ #endregion
+ }
}
\ No newline at end of file