@@ -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 needed (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,53 @@ 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+ "specversion" : " 1.0" ,
63+ "type" : " com.example.user.updated" ,
64+ "source" : " https://example.com/users/service" ,
65+ "id" : " event-1" ,
66+ "sequence" : " 001"
67+ }
68+
69+ {
70+ "specversion" : " 1.0" ,
71+ "type" : " com.example.user.updated" ,
72+ "source" : " https://example.com/users/service" ,
73+ "id" : " event-2" ,
74+ "sequence" : " 002"
75+ }
76+ ```
77+
78+ The second event comes after the first (` "002" > "001" ` ).
79+
80+ ### Separate Sequences from Different Sources
81+
82+ ``` json
83+ {
84+ "specversion" : " 1.0" ,
85+ "type" : " com.example.user.updated" ,
86+ "source" : " https://example.com/users/service" ,
87+ "id" : " event-1" ,
88+ "sequence" : " 005"
89+ }
90+
91+ {
92+ "specversion" : " 1.0" ,
93+ "type" : " com.example.order.created" ,
94+ "source" : " https://example.com/orders/service" ,
95+ "id" : " event-2" ,
96+ "sequence" : " 003"
97+ }
98+ ```
99+
100+ Both events above are ** valid** and have valid sequence values. However, since
101+ they have different ` source ` values, they represent two separate sequences that
102+ cannot be meaningfully compared.
0 commit comments