Skip to content
This repository has been archived by the owner on Dec 14, 2020. It is now read-only.

Commit

Permalink
Add descriptions to MessageProperties
Browse files Browse the repository at this point in the history
  • Loading branch information
vcabbage committed Feb 12, 2018
1 parent c2a889f commit 749c2de
Showing 1 changed file with 77 additions and 14 deletions.
91 changes: 77 additions & 14 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2010,21 +2010,84 @@ func (h *MessageHeader) unmarshal(r *buffer) error {

// MessageProperties is the defined set of properties for AMQP messages.
type MessageProperties struct {
// TODO: add useful descriptions from spec

MessageID interface{} // uint64, UUID, []byte, or string
UserID []byte
To string
Subject string
ReplyTo string
CorrelationID interface{} // uint64, UUID, []byte, or string
ContentType string
ContentEncoding string
// Message-id, if set, uniquely identifies a message within the message system.
// The message producer is usually responsible for setting the message-id in
// such a way that it is assured to be globally unique. A broker MAY discard a
// message as a duplicate if the value of the message-id matches that of a
// previously received message sent to the same node.
MessageID interface{} // uint64, UUID, []byte, or string

// The identity of the user responsible for producing the message.
// The client sets this value, and it MAY be authenticated by intermediaries.
UserID []byte

// The to field identifies the node that is the intended destination of the message.
// On any given transfer this might not be the node at the receiving end of the link.
To string

// A common field for summary information about the message content and purpose.
Subject string

// The address of the node to send replies to.
ReplyTo string

// This is a client-specific id that can be used to mark or identify messages
// between clients.
CorrelationID interface{} // uint64, UUID, []byte, or string

// The RFC-2046 [RFC2046] MIME type for the message's application-data section
// (body). As per RFC-2046 [RFC2046] this can contain a charset parameter defining
// the character encoding used: e.g., 'text/plain; charset="utf-8"'.
//
// For clarity, as per section 7.2.1 of RFC-2616 [RFC2616], where the content type
// is unknown the content-type SHOULD NOT be set. This allows the recipient the
// opportunity to determine the actual type. Where the section is known to be truly
// opaque binary data, the content-type SHOULD be set to application/octet-stream.
//
// When using an application-data section with a section code other than data,
// content-type SHOULD NOT be set.
ContentType string

// The content-encoding property is used as a modifier to the content-type.
// When present, its value indicates what additional content encodings have been
// applied to the application-data, and thus what decoding mechanisms need to be
// applied in order to obtain the media-type referenced by the content-type header
// field.
//
// Content-encoding is primarily used to allow a document to be compressed without
// losing the identity of its underlying content type.
//
// Content-encodings are to be interpreted as per section 3.5 of RFC 2616 [RFC2616].
// Valid content-encodings are registered at IANA [IANAHTTPPARAMS].
//
// The content-encoding MUST NOT be set when the application-data section is other
// than data. The binary representation of all other application-data section types
// is defined completely in terms of the AMQP type system.
//
// Implementations MUST NOT use the identity encoding. Instead, implementations
// SHOULD NOT set this property. Implementations SHOULD NOT use the compress encoding,
// except as to remain compatible with messages originally sent with other protocols,
// e.g. HTTP or SMTP.
//
// Implementations SHOULD NOT specify multiple content-encoding values except as to
// be compatible with messages originally sent with other protocols, e.g. HTTP or SMTP.
ContentEncoding string

// An absolute time when this message is considered to be expired.
AbsoluteExpiryTime time.Time
CreationTime time.Time
GroupID string
GroupSequence uint32 // RFC-1982 sequence number
ReplyToGroupID string

// An absolute time when this message was created.
CreationTime time.Time

// Identifies the group the message belongs to.
GroupID string

// The relative position of this message within its group.
GroupSequence uint32 // RFC-1982 sequence number

// This is a client-specific id that is used so that client can send replies to this
// message to a specific group.
ReplyToGroupID string
}

func (p *MessageProperties) marshal(wr *buffer) error {
Expand Down

0 comments on commit 749c2de

Please sign in to comment.