Exemple #1
0
 protected override void WriteMethodPayload(ByteBuffer buffer)
 {
     buffer.Put(ReplyCode);
     EncodingUtils.WriteShortStringBytes(buffer, ReplyText);
     buffer.Put(ClassId);
     buffer.Put(MethodId);
 }
Exemple #2
0
 protected override void PopulateMethodBodyFromBuffer(ByteBuffer buffer)
 {
     ReplyCode = buffer.GetUInt16();
     ReplyText = EncodingUtils.ReadShortString(buffer);
     ClassId   = buffer.GetUInt16();
     MethodId  = buffer.GetUInt16();
 }
Exemple #3
0
        private AMQTypedValue SetProperty(string key, AMQTypedValue value)
        {
            InitMapIfNecessary();
            _encodedForm = null;
            if (value == null)
            {
                RemoveKey(key);
            }
            AMQTypedValue oldVal = (AMQTypedValue)_properties[key];

            _properties.Add(key, value);
            if (oldVal != null)
            {
                _encodedSize -= oldVal.EncodingLength;
            }
            else
            {
                _encodedSize += EncodingUtils.EncodedShortStringLength(key) + (uint)1;
            }
            if (value != null)
            {
                _encodedSize += value.EncodingLength;
            }

            return(oldVal);
        }
Exemple #4
0
        private void SetFromBuffer(ByteBuffer buffer, uint length)
        {
            bool trace = _log.IsDebugEnabled;

            if (length > 0)
            {
                int expectedRemaining = buffer.Remaining - (int)length;
                _properties = new LinkedHashtable();

                do
                {
                    string        key   = EncodingUtils.ReadShortString(buffer);
                    AMQTypedValue value = AMQTypedValue.ReadFromBuffer(buffer);
                    if (trace)
                    {
                        _log.Debug(string.Format("FieldTable::PropFieldTable(buffer,{0}): Read type '{1}', key '{2}', value '{3}'", length, value.Type, key, value.Value));
                    }
                    _properties.Add(key, value);
                } while (buffer.Remaining > expectedRemaining);
                _encodedSize = length;
            }
            if (trace)
            {
                _log.Debug("FieldTable::FieldTable(buffer," + length + "): Done.");
            }
        }
Exemple #5
0
 protected override void PopulateMethodBodyFromBuffer(ByteBuffer buffer)
 {
     VersionMajor     = buffer.GetByte();
     VersionMinor     = buffer.GetByte();
     ServerProperties = EncodingUtils.ReadFieldTable(buffer);
     Mechanisms       = EncodingUtils.ReadLongstr(buffer);
     Locales          = EncodingUtils.ReadLongstr(buffer);
 }
Exemple #6
0
 protected override void WriteMethodPayload(ByteBuffer buffer)
 {
     buffer.Put(VersionMajor);
     buffer.Put(VersionMinor);
     EncodingUtils.WriteFieldTableBytes(buffer, ServerProperties);
     EncodingUtils.WriteLongstr(buffer, Mechanisms);
     EncodingUtils.WriteLongstr(buffer, Locales);
 }
Exemple #7
0
 protected override void WriteMethodPayload(ByteBuffer buffer)
 {
     buffer.Put(Ticket);
     EncodingUtils.WriteShortStringBytes(buffer, Queue);
     EncodingUtils.WriteShortStringBytes(buffer, ConsumerTag);
     EncodingUtils.WriteBooleans(buffer, new bool[] { NoLocal, NoAck, Exclusive, Nowait });
     EncodingUtils.WriteFieldTableBytes(buffer, Arguments);
 }
 protected override void PopulateMethodBodyFromBuffer(ByteBuffer buffer)
 {
     ConsumerTag = EncodingUtils.ReadShortString(buffer);
     DeliveryTag = buffer.GetUInt64();
     bool[] bools = EncodingUtils.ReadBooleans(buffer); Redelivered = bools[0];
     Exchange   = EncodingUtils.ReadShortString(buffer);
     RoutingKey = EncodingUtils.ReadShortString(buffer);
 }
 protected override void WriteMethodPayload(ByteBuffer buffer)
 {
     EncodingUtils.WriteShortStringBytes(buffer, ConsumerTag);
     buffer.Put(DeliveryTag);
     EncodingUtils.WriteBooleans(buffer, new bool[] { Redelivered });
     EncodingUtils.WriteShortStringBytes(buffer, Exchange);
     EncodingUtils.WriteShortStringBytes(buffer, RoutingKey);
 }
 protected override void WriteMethodPayload(ByteBuffer buffer)
 {
     buffer.Put(Ticket);
     EncodingUtils.WriteShortStringBytes(buffer, Exchange);
     EncodingUtils.WriteShortStringBytes(buffer, Type);
     EncodingUtils.WriteBooleans(buffer, new bool[] { Passive, Durable, AutoDelete, Internal, Nowait });
     EncodingUtils.WriteFieldTableBytes(buffer, Arguments);
 }
 protected override void PopulateMethodBodyFromBuffer(ByteBuffer buffer)
 {
     Ticket = buffer.GetUInt16();
     Queue  = EncodingUtils.ReadShortString(buffer);
     bool[] bools = EncodingUtils.ReadBooleans(buffer); IfUnused = bools[0];
     IfEmpty = bools[1];
     Nowait  = bools[2];
 }
Exemple #12
0
 protected override void WriteMethodPayload(ByteBuffer buffer)
 {
     buffer.Put(Ticket);
     EncodingUtils.WriteShortStringBytes(buffer, Exchange);
     EncodingUtils.WriteShortStringBytes(buffer, RoutingKey);
     EncodingUtils.WriteBooleans(buffer, new bool[] { Mandatory, Immediate });
     EncodingUtils.WriteShortStringBytes(buffer, Identifier);
 }
Exemple #13
0
 protected override void PopulateMethodBodyFromBuffer(ByteBuffer buffer)
 {
     Ticket     = buffer.GetUInt16();
     Exchange   = EncodingUtils.ReadShortString(buffer);
     RoutingKey = EncodingUtils.ReadShortString(buffer);
     bool[] bools = EncodingUtils.ReadBooleans(buffer); Mandatory = bools[0];
     Immediate = bools[1];
 }
 protected override void PopulateMethodBodyFromBuffer(ByteBuffer buffer)
 {
     Ticket     = buffer.GetUInt16();
     Queue      = EncodingUtils.ReadShortString(buffer);
     Exchange   = EncodingUtils.ReadShortString(buffer);
     RoutingKey = EncodingUtils.ReadShortString(buffer);
     bool[] bools = EncodingUtils.ReadBooleans(buffer); Nowait = bools[0];
     Arguments = EncodingUtils.ReadFieldTable(buffer);
 }
 protected override void WriteMethodPayload(ByteBuffer buffer)
 {
     buffer.Put(Ticket);
     EncodingUtils.WriteShortStringBytes(buffer, Queue);
     EncodingUtils.WriteShortStringBytes(buffer, Exchange);
     EncodingUtils.WriteShortStringBytes(buffer, RoutingKey);
     EncodingUtils.WriteBooleans(buffer, new bool[] { Nowait });
     EncodingUtils.WriteFieldTableBytes(buffer, Arguments);
 }
 protected override void PopulateMethodBodyFromBuffer(ByteBuffer buffer)
 {
     Realm = EncodingUtils.ReadShortString(buffer);
     bool[] bools = EncodingUtils.ReadBooleans(buffer); Exclusive = bools[0];
     Passive = bools[1];
     Active  = bools[2];
     Write   = bools[3];
     Read    = bools[4];
 }
 protected override void PopulateMethodBodyFromBuffer(ByteBuffer buffer)
 {
     Ticket      = buffer.GetUInt16();
     Queue       = EncodingUtils.ReadShortString(buffer);
     ConsumerTag = EncodingUtils.ReadShortString(buffer);
     bool[] bools = EncodingUtils.ReadBooleans(buffer); NoLocal = bools[0];
     Exclusive = bools[1];
     Nowait    = bools[2];
 }
Exemple #18
0
        /// <summary>
        /// Serializes this instance to the specified <see cref="ByteBuffer"/>.
        /// </summary>
        /// <param name="buffer">The buffer to write to</param>
        public void WriteToBuffer(ByteBuffer buffer)
        {
            if (_log.IsDebugEnabled)
            {
                _log.Debug("FieldTable::writeToBuffer: Writing encoded length of " + EncodedSize + "...");
            }

            EncodingUtils.WriteUnsignedInteger(buffer, EncodedSize);
            WritePayload(buffer);
        }
 protected override void PopulateMethodBodyFromBuffer(ByteBuffer buffer)
 {
     Ticket = buffer.GetUInt16();
     Queue  = EncodingUtils.ReadShortString(buffer);
     bool[] bools = EncodingUtils.ReadBooleans(buffer); Passive = bools[0];
     Durable    = bools[1];
     Exclusive  = bools[2];
     AutoDelete = bools[3];
     Nowait     = bools[4];
     Arguments  = EncodingUtils.ReadFieldTable(buffer);
 }
Exemple #20
0
        //
        // Public Methods
        //

        /// <summary>
        /// Removes the property with the specified name
        /// </summary>
        /// <param name="key">The name of the property to remove</param>
        /// <returns>The previous value of the property or null</returns>
        public AMQTypedValue RemoveKey(string key)
        {
            InitMapIfNecessary();
            _encodedForm = null;
            AMQTypedValue value = (AMQTypedValue)_properties[key];

            if (value != null)
            {
                _properties.Remove(key);
                _encodedSize -= EncodingUtils.EncodedShortStringLength(key);
                _encodedSize--;
                _encodedSize -= value.EncodingLength;
            }
            return(value);
        }
 public void WritePropertyListPayload(ByteBuffer buffer)
 {
     EncodingUtils.WriteShortStringBytes(buffer, ContentType);
     EncodingUtils.WriteShortStringBytes(buffer, Encoding);
     EncodingUtils.WriteFieldTableBytes(buffer, Headers);
     buffer.Put(DeliveryMode);
     buffer.Put(Priority);
     EncodingUtils.WriteShortStringBytes(buffer, CorrelationId);
     EncodingUtils.WriteShortStringBytes(buffer, ReplyTo);
     EncodingUtils.WriteShortStringBytes(buffer, String.Format("{0:D}", Expiration));
     EncodingUtils.WriteShortStringBytes(buffer, MessageId);
     buffer.Put(Timestamp);
     EncodingUtils.WriteShortStringBytes(buffer, Type);
     EncodingUtils.WriteShortStringBytes(buffer, UserId);
     EncodingUtils.WriteShortStringBytes(buffer, AppId);
     EncodingUtils.WriteShortStringBytes(buffer, ClusterId);
 }
Exemple #22
0
 public void WritePayload(ByteBuffer buffer)
 {
     if (_encodedForm != null)
     {
         lock ( _syncLock )
         {
             buffer.Put(_encodedForm);
             _encodedForm.Flip();
         }
     }
     else if (_properties != null)
     {
         foreach (DictionaryEntry de in _properties)
         {
             string        key   = (string)de.Key;
             AMQTypedValue value = (AMQTypedValue)de.Value;
             try
             {
                 if (_log.IsDebugEnabled)
                 {
                     _log.Debug("Writing Property:" + key +
                                " Type:" + value.Type +
                                " Value:" + value.Value);
                     _log.Debug("Buffer Position:" + buffer.Position +
                                " Remaining:" + buffer.Remaining);
                 }
                 //Write the actual parameter name
                 EncodingUtils.WriteShortStringBytes(buffer, key);
                 value.WriteToBuffer(buffer);
             } catch (Exception ex)
             {
                 if (_log.IsDebugEnabled)
                 {
                     _log.Debug("Exception thrown:" + ex);
                     _log.Debug("Writing Property:" + key +
                                " Type:" + value.Type +
                                " Value:" + value.Value);
                     _log.Debug("Buffer Position:" + buffer.Position +
                                " Remaining:" + buffer.Remaining);
                 }
                 throw;
             }
         }
     }
 }
 protected override void PopulateMethodBodyFromBuffer(ByteBuffer buffer)
 {
     DtxIdentifier = EncodingUtils.ReadShortString(buffer);
 }
 protected override void WriteMethodPayload(ByteBuffer buffer)
 {
     EncodingUtils.WriteShortStringBytes(buffer, DtxIdentifier);
 }
 protected override void PopulateMethodBodyFromBuffer(ByteBuffer buffer)
 {
     Result = EncodingUtils.ReadLongstr(buffer);
 }
 protected override void WriteMethodPayload(ByteBuffer buffer)
 {
     EncodingUtils.WriteLongstr(buffer, Result);
 }
 protected override void PopulateMethodBodyFromBuffer(ByteBuffer buffer)
 {
     DeliveryTag = buffer.GetUInt64();
     bool[] bools = EncodingUtils.ReadBooleans(buffer); Requeue = bools[0];
 }
 protected override void WriteMethodPayload(ByteBuffer buffer)
 {
     buffer.Put(DeliveryTag);
     EncodingUtils.WriteBooleans(buffer, new bool[] { Requeue });
 }
 protected override void PopulateMethodBodyFromBuffer(ByteBuffer buffer)
 {
     ConsumerTag = EncodingUtils.ReadShortString(buffer);
     bool[] bools = EncodingUtils.ReadBooleans(buffer); Nowait = bools[0];
 }
 protected override void WriteMethodPayload(ByteBuffer buffer)
 {
     EncodingUtils.WriteShortStringBytes(buffer, Realm);
     EncodingUtils.WriteBooleans(buffer, new bool[] { Exclusive, Passive, Active, Write, Read });
 }