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 IETF BCP14 (RFC2119 & RFC8174)
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
The following section will elaborate on the uProtocol message header attributes.
Common attributes apply to all message types.
Attribute | Type | RFC2119 | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
String |
R |
CloudEvent specification version. This is NOT the uProtocol version
|
|||||||||||
String |
R |
Unique identifier for the CE
|
|||||||||||
R |
The Source (address) of the message per source Description
|
||||||||||||
String |
R |
uProtocol CE type
|
|||||||||||
R|O |
URI pointing to the method to be invoked
|
||||||||||||
String |
O |
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
|
|||||||||||
O|R |
Identifies the schema that data adheres to. The dataschema is required only when the data is not of type google.protobuf.Any:
|
||||||||||||
hash |
Binary |
O |
HMAC generated on the data portion of the message using a device key |
||||||||||
priority |
String |
0 |
uProtocol Prioritization classifications per QoS. When this field is missing,
|
||||||||||
ttl |
Uint32 |
R|O |
How long this event should live for after it was generated (in milliseconds). Event expires when: \(t_current > t_{ce_id} + ce_ttl\) When the message type is
otherwise:
|
Additional attributes are included for RPC for correlation, access control, and more.
Note
|
RPC response RESOURCE portion of a topic is: rpc.response
|
Attribute | Type | RFC2119 | Description |
---|---|---|---|
token |
String |
R|O |
Access token per Token-Based uE Access Permissions (TAPs) |
permission_level |
Integer |
R|O |
Source (senders) uE permission level as defined in Code-Based uE Access Permissions (CAPs) |
Attribute | Type | RFC 2119 | Description | Requirements |
---|---|---|---|---|
reqid |
String |
R |
Request Identifier a.k.a correlation ID between this response and the original request |
|
commstatus |
Integer |
O |
Communication error attribute populated by uP-L2 dispatchers only when an error has occurred in the delivery of RPC request or response events. |
|
Data portion of the CE contains the application layer (uP-L2) message. the format of the data varies slightly depending on the CloudEvent format that we will describe in the next section.
In this section we will explain both the message format and the message payload (data) formats building upon uProtocol CloudEvent (CE) specifications.
Note
|
data in the following section refers to the message payload. please see uProtocol Layers for more information. |
CE Format | Encoding | Data Format Considerations |
---|---|---|
Binary |
If data is a protobuf message:
If the data is binary and NOT a protobuf message:
|
|
Text |
If data is a protobuf message:
If the data is binary and NOT a protobuf message:
|
The following are additional recommendations when implementing the protocol:
-
Data and CE MUST only be serialized once when it is to be transported over a uP-L1 transport
-
CE MUST be serialized to the event format per uP-L1 transport requirements
The following examples are using the JSON CE format
{
"specversion": "1.0",
"id" : "cf8b1bcd-30bd-43be-a8d3-ad1cde652e10",
"source": "up://VCU.VIN.veh.up.gm.com/body.access/1/door.front_left#Door",
"type": "pub.v1",
"datacontenttype" : "application/protobuf",
"dataschema": "/org.eclipse.uprotocol.vehicle.body.access.v1.Door",
"priority" : "CS1",
"ttl" : 10000,
"data": /* Protobuf serialized Door Message*/
}
{
"specversion": "1.0",
"id" : "5b9fe861-8c1c-4899-9b07-ad1cde652e10",
"source": "up://VCU.VIN.veh.up.gm.com/body.access/1/rpc.UpdateDoor",
"sink": "up://VCU.VIN.veh.up.gm.com/MyAppp/1/rpc.response",
"type": "res.v1",
"datacontenttype" : "application/protobuf",
"dataschema": "/google.rpc.Status",
"priority" : "CS4",
"reqid" : "cf8b1bcd-30bd-43be-a8d3-ad1cde652e10",
"ttl" : 50000,
"data": /* Protobuf serialized google.rpc.Status Message*/
}
{
"specversion": "1.0",
"id" : "cf8b1bcd-30bd-43be-a8d3-ad1cde652e10",
"source": "up://VCU.VIN.veh.up.gm.com/MyAppp/1/rpc.response",
"sink": "up://VCU.VIN.veh.up.gm.com/body.access/1/rpc.UpdateDoor",
"type": "req.v1",
"datacontenttype" : "application/protobuf",
"dataschema": "/org.eclipse.uprotocol.vehicle.body.access.v1.UpdateDoorRequest",
"priority" : "CS4",
"ttl" : 50000,
"data": /* Protobuf serialized UpdateDoorRequest Message*/
}
{
"specversion": "1.0",
"id" : "5b9fe861-8c1c-4899-9b07-ad1cde652e10",
"source": "up://VCU.VIN.veh.up.gm.com/body.access/1/rpc.UpdateDoor",
"sink": "up://VCU.VIN.veh.up.gm.com/MyAppp/1/rpc.response",
"type": "res.v1",
"datacontenttype" : "application/protobuf",
"dataschema": "/google.rpc.Status",
"priority" : "CS4",
"reqid" : "cf8b1bcd-30bd-43be-a8d3-ad1cde652e10",
"ttl" : 50000,
"data": /* Protobuf serialized google.rpc.Status Message*/
}