The AMQP Format for CloudEvents defines how event attributes are expressed in the AMQP 1.0 Type System.
This document is a working draft.
CloudEvents is a standardized and transport-neutral definition of the structure and metadata description of events. This specification defines how the elements defined in the CloudEvents specification are to be represented in the [AMQP 1.0 Type System][amqp-types].
The Attributes section describes the naming conventions and data type mappings for CloudEvents attributes for use as AMQP message properties.
This specification does not define an envelope format. The AMQP type system's intent is primarily to provide a consistent type system for AMQP itself and not for message payloads.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC2119.
This section defines how CloudEvents attributes are mapped to the AMQP type-system. This specification does not explicitly map each attribute, but provides a generic mapping model that applies to all current and future CloudEvents attributes, including extensions.
The core CloudEvents specification defines a minimal abstract type system, which this mapping leans on.
The CloudEvents type system MUST be mapped to AMQP types as follows, with exceptions noted below.
CloudEvents | AMQP |
---|---|
String | string |
Integer | long |
Binary | binary |
URI-reference | string |
Timestamp | timestamp |
Map | map |
Any | See 2.3. |
Extension specifications MAY define diverging mapping rules for the values of attributes they define.
For instance, the attribute value may be a data structure defined in a standard outside of CloudEvents, with a formal AMQP mapping, and there might be risk of translation errors or information loss when the original format is not preserved.
An extension specification that defines a diverging mapping rule for AMQP, and any revision of such a specification, MUST also define explicit mapping rules for all other event formats that are part of the CloudEvents core at the time of the submission or revision.
Any
-typed CloudEvents values can either hold a String
, or a Binary
value,
or a Map
. Map
entry values are also Any
typed. AMQP's type system natively
represents dynamic typing in its type system encoding,
and therefore immediately allows for the required variant type representation.