properties(属性)是可以附加到在队列中结束的消息的attributes。这些不是任意的attributes,而是具有特定的定义。特别是,这些属性被定义为BASIC类的成员(即类#60)。 BASIC类是唯一具有属性的类。这些属性出现在内容标题帧的尾部。它们的规范分为两部分:
property flags(属性标志)
properties属性列表
属性标志用于指定属性列表中记录的14个属性中的哪一个。这些在属性标志中被编码为单独的位。 BASIC类定义按顺序列出属性(请参阅:),它按照在属性标志中引用它们的顺序。因此,属性标记八位字节:http://www.rabbitmq.com/resources/specs/amqp0-9-1.xml
00010000 01000000(0x 10 40)引用14个属性中的2个:“delivery-mode”和“timestamp” ”。如果标志中的所有位都是“0”,则表示没有引用属性。
procedure TAMQPMessageProperties.LoadFromStream(AStream: TStream); var Flags: UInt16; begin AStream.ReadUInt16( Flags ); if Flags and $8000 = $8000 then FContentType.LoadFromStream( AStream ); if Flags and $4000 = $4000 then FContentEncoding.LoadFromStream( AStream ); if Flags and $2000 = $2000 then FApplicationHeaders.LoadFromStream( AStream ); if Flags and $1000 = $1000 then FDeliveryMode.LoadFromStream( AStream ); if Flags and $0800 = $0800 then FPriority.LoadFromStream( AStream ); if Flags and $0400 = $0400 then FCorrelationID.LoadFromStream( AStream ); if Flags and $0200 = $0200 then FReplyTo.LoadFromStream( AStream ); if Flags and $0100 = $0100 then FExpiration.LoadFromStream( AStream ); if Flags and $0080 = $0080 then FMessageID.LoadFromStream( AStream ); if Flags and $0040 = $0040 then FTimestamp.LoadFromStream( AStream ); if Flags and $0020 = $0020 then FType.LoadFromStream( AStream ); if Flags and $0010 = $0010 then FUserID.LoadFromStream( AStream ); if Flags and $0008 = $0008 then FAppID.LoadFromStream( AStream ); if Flags and $0004 = $0004 then FReserved.LoadFromStream( AStream );
end;
$8000用二进制表示就是1000 0000 0000 0000 ,C++语法形式为15<<1,从右向左移动15位。
$4000用二进制表示就是0100 0000 0000 0000 ,C++语法形式为14<<1,从右向左移动14位。余下类推。
|
请发表评论