You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the completion of uProtocol 1.5 specifications, the following change
moves the UAttributes documentation to proto and cleans up the
CloudEvent-to-UAttributes mapping requirements
Copy file name to clipboardExpand all lines: basics/cloudevents.adoc
+324-1Lines changed: 324 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
= CloudEvents
2
2
:toc:
3
3
:sectnums:
4
+
:stem: latexmath
4
5
5
6
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 https://www.rfc-editor.org/info/bcp14[IETF BCP14 (RFC2119 & RFC8174)]
6
7
@@ -54,7 +55,7 @@ Cloud Events answers the following in the metadata:
54
55
55
56
The specification is transport agnostic (can run over HTTP, MQTT, AMQP, NATS, Kafka), and comes with SDK in most common languages.
56
57
57
-
== CloudEvent Format vs Data Format
58
+
=== CloudEvent Format vs Data Format
58
59
59
60
CloudEvents can be represented as objects (in the programming language of choice) as well as serialized to any binary or text encoding formats such as protobuf, JSON, AVRO, XML, etc.... CloudEvent are often referred to as "the envelope for data" as it holds the data and metadata.
60
61
@@ -63,3 +64,325 @@ https://cloudevents.io/[CloudEvents] has defined a set of specifications for the
63
64
NOTE: Additional formats and transports not covered by https://cloudevents.io/[CloudEvents.io] shall be covered in link:../up-l1/README.adoc[uP-L1 Specifications]
64
65
65
66
67
+
== uProtocol CloudEvents
68
+
The following section we shall elaborate how map link:uattrbutes.adoc[uProtocol Header Attributes (uAttributes)] to CloudEvents attributes.
|https://github.com/eclipse-uprotocol/uprotocol-core-api/blob/main/src/main/proto/upayload.proto[UPayloadFormat] (not part of UAttributes)
178
+
|String
179
+
|*O*
180
+
a|Content type of data value. This attribute enables data to carry any type of content, whereby format and encoding might differ from that of the chosen event format
181
+
182
+
* *MUST* adhere to the format specified in https://tools.ietf.org/html/rfc2046[RFC 2046]
183
+
* *MUST* be application/octet-stream for binary encoded data that is not protobuf
184
+
* *SHALL* be application/x-protobuf if attribute is missing
185
+
186
+
187
+
|`hash`
188
+
|N/A. (Transport specific)
189
+
|Binary
190
+
|*O*
191
+
|HMAC generated on the data portion of the message using a device key
192
+
193
+
194
+
|`priority`
195
+
|`priority`
196
+
|String
197
+
|*O*
198
+
a| uProtocol Prioritization classifications per link:../../basics/qos.adoc[QoS]. When this field is missing, `CS0` is assumed.
199
+
When the message _type_ is `req.v1`:
200
+
201
+
* *MUST* be set to `CS4` or greater
202
+
203
+
204
+
|`ttl`
205
+
|`ttl`
206
+
|Uint32
207
+
a|*R\|O*
208
+
a|How long this event should live for after it was generated (in milliseconds). Event expires when:
209
+
210
+
stem:[t_current > t_{ce_id} + ce_ttl]
211
+
212
+
When the message _type_ is `req.v1`:
213
+
214
+
* Attribute *MUST* be present and value greater than 0
215
+
216
+
otherwise:
217
+
218
+
* Attribute *MAY* be present
219
+
* When not present, or value is 0, message *MUST NOT* time out
220
+
221
+
222
+
|===
223
+
224
+
225
+
=== RPC Attributes
226
+
Additional attributes are included for RPC for correlation, access control, and more.
227
+
228
+
NOTE: RPC response RESOURCE portion of a topic is: `rpc.response`
a|Access token per link:../up-l2/permissions.adoc#_token_based_access_permissionstaps[Token-Based uE Access Permissions (TAPs)]
245
+
246
+
|`*plevel*`
247
+
|`permission_level`
248
+
|Integer
249
+
|*R\|O*
250
+
|Source (senders) uE permission level as defined in link:../up-l2/permissions.adoc#_code_based_access_permissions_caps[Code-Based uE Access Permissions (CAPs)]
|Request Identifier a.k.a correlation ID between this response and the original request
272
+
a|
273
+
* *MUST* be the link:../basics/uuid.adoc[uProtocol UUID] from the original Request message (req.v1) that this response is for
274
+
275
+
|`*commstatus*`
276
+
|`commstatus`
277
+
|Integer
278
+
|*O*
279
+
|Communication error attribute populated by uP-L2 dispatchers only when an error has occurred in the delivery of RPC request or response events. +
280
+
The contents of this attribute, if present, is the integer representation of https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto[google.rpc.Code]
281
+
a|* *MUST* only be populated by Dispatchers when a deivery error has occured. See link:../../dispatchers/README.adoc[Dispatchers] for more information.
282
+
283
+
|===
284
+
285
+
286
+
287
+
== Data (Payload)
288
+
289
+
Data portion of the CE contains the application layer (uP-L2) message also known as the link:README.adoc#_upayload[UPayload].
290
+
291
+
292
+
== CloudEvent Format
293
+
In this section we will explain the format (encoding) for CloudEvent message and the impacts on the payload formats.
a|* *MUST* adhere to the https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/protobuf-format.md[Protobuf Event Format for CloudEvents - Version 1.0.2] specifications
305
+
306
+
If link:README.adoc#_upayload[UPayload] is a protobuf message:
307
+
308
+
* *MUST* be packed as google.protobuf.Any and stored in field proto_data
309
+
* *MUST NOT* set datacontenttype to "application/x-protobuf"
310
+
* *MUST NOT* set dataschema to the URI of the protobuf message, this is optional as this information is already stored in the google.protobuf.Any
311
+
312
+
If the link:/README.adoc#_upayload[UPayload] is binary and _NOT_ a protobuf message:
313
+
314
+
* *MUST* be stored in the field binary_data
315
+
* *MUST* set datacontenttype to "application/octet-stream"
316
+
* *MAY* set dataschema to the URI-Reference schema of the data
a|* *MUST* adhere to https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md[JSON Event Format for CloudEvents - Version 1.0.2] specifications
321
+
322
+
If link:README.adoc#_upayload[UPayload] is a protobuf message:
323
+
324
+
* *MUST* be packed as google.protobuf.Any and stored in field data_base64 attribute,
325
+
* *MUST NOT* set datacontenttype to "application/x-protobuf"
326
+
* *MUST NOT* set dataschema to the URI of the protobuf message, this is optional as this information is already stored in the google.protobuf.Any
327
+
328
+
If link:README.adoc#_upayload[UPayload] is binary and _NOT_ a protobuf message:
329
+
330
+
* *MUST* be base64 encoded and stored in data_base64 attribute
331
+
* *MUST* set datacontenttype to "application/octet-stream"
332
+
* *MAY* set dataschema to the URI-Reference schema of the data
333
+
334
+
|===
335
+
336
+
337
+
The following are additional recommendations when implementing the protocol:
338
+
339
+
* Data and CE *SHOULD* only be serialized once when it is to be transported over link:README.adoc#_utransport_interface[UTransport Interface]
340
+
341
+
342
+
== Examples
343
+
The following examples are using the JSON CE format
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 https://www.rfc-editor.org/info/bcp14[IETF BCP14 (RFC2119 & RFC8174)]
6
+
7
+
----
8
+
Copyright (c) 2023 General Motors GTO LLC
9
+
10
+
Licensed to the Apache Software Foundation (ASF) under one
11
+
or more contributor license agreements. See the NOTICE file
12
+
distributed with this work for additional information
13
+
regarding copyright ownership. The ASF licenses this file
14
+
to you under the Apache License, Version 2.0 (the
15
+
"License"); you may not use this file except in compliance
16
+
with the License. You may obtain a copy of the License at
17
+
18
+
http://www.apache.org/licenses/LICENSE-2.0
19
+
20
+
Unless required by applicable law or agreed to in writing,
21
+
software distributed under the License is distributed on an
22
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
23
+
KIND, either express or implied. See the License for the
24
+
specific language governing permissions and limitations
25
+
under the License.
26
+
27
+
SPDX-FileType: DOCUMENTATION
28
+
SPDX-FileCopyrightText: 2023 General Motors GTO LLC
29
+
SPDX-License-Identifier: Apache-2.0
30
+
----
31
+
32
+
== Overview
33
+
34
+
uProtocol Header attributes that are common for all transports. The UAttributes message holds routing and UMessage attributes such as priority, permission, communication status and more
35
+
36
+
NOTE: Please refer to https://github.com/eclipse-uprotocol/uprotocol-core-api/blob/main/src/main/proto/uattributes.proto[uattributes.proto] for the latest version of the UAttributes data model
0 commit comments