@@ -14,6 +14,12 @@ value comes first.
1414Produces and consumers are free to define an out-of-band agreement on the
1515semantic meaning, or valid values, for the attribute.
1616
17+ If sequence comparison across multiple dimensions is required (e.g., per source
18+ AND subject), implementers have two options:
19+ - Include the additional dimension in the ` source ` attribute value
20+ (e.g., ` "source": "https://example.com/users/service/subject123" ` )
21+ - Define a new extension that meets their specific sequencing requirements
22+
1723## Notational Conventions
1824
1925As with the main [ CloudEvents specification] ( ../spec.md ) , the key words "MUST",
@@ -31,8 +37,8 @@ this extension is being used.
3137### sequence
3238
3339- Type: ` String `
34- - Description: Value expressing the relative order of the event. This enables
35- interpretation of data supercedence .
40+ - Description: Value expressing the relative order of the event within the scope
41+ of its ` source ` attribute .
3642- Constraints
3743 - REQUIRED
3844 - MUST be a non-empty lexicographically-orderable string
@@ -44,3 +50,39 @@ can determine the order of the events via a simple string-compare type of
4450operation. This means that it might be necessary for the value to include
4551some kind of padding (e.g. leading zeros in the case of the value being the
4652string representation of an integer).
53+
54+ ## Examples
55+
56+ ### Valid Usage
57+
58+ Events from the same source with properly ordered sequences:
59+
60+ ``` json
61+ {
62+ "source" : " https://example.com/users/service" ,
63+ "sequence" : " 001" ,
64+ "id" : " event-1"
65+ }
66+
67+ {
68+ "source" : " https://example.com/users/service" ,
69+ "sequence" : " 002" ,
70+ "id" : " event-2"
71+ }
72+ ```
73+
74+ The second event comes after the first (` "002" > "001" ` ).
75+
76+ ### Invalid Cross-Source Comparison
77+
78+ ``` json
79+ {
80+ "source" : " https://example.com/users/service" ,
81+ "sequence" : " 005"
82+ }
83+
84+ {
85+ "source" : " https://example.com/orders/service" ,
86+ "sequence" : " 003"
87+ }
88+ ```
0 commit comments