Skip to content

Commit 276b125

Browse files
committed
feat: introduce protobuf batch format
Update prototbuf format to define how batches of protobuf format events are represented. Signed-off-by: Day, Jeremy(jday) <[email protected]>
1 parent 8ef36d3 commit 276b125

File tree

2 files changed

+43
-7
lines changed

2 files changed

+43
-7
lines changed

protobuf-format.md

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ This document is a working draft.
1919
2. [Attributes](#2-attributes)
2020
3. [Data](#3-data)
2121
4. [Transport](#4-transport)
22-
5. [Examples](#5-examples)
22+
5. [Batch Format](5-batch-format)
23+
6. [Examples](#6-examples)
2324

2425
## 1. Introduction
2526

@@ -128,8 +129,6 @@ oneof data {
128129
* When the type of the data is binary the value MUST be stored in the `binary_data` property.
129130
* `datacontenttype` SHOULD be populated with the appropriate media-type.
130131

131-
132-
133132
## 4. Transport
134133

135134
Transports that support content identification MUST use the following designation:
@@ -138,12 +137,40 @@ Transports that support content identification MUST use the following designatio
138137
application/cloudevents+protobuf
139138
```
140139

141-
## 5. Examples
140+
## 5. Batch Format
141+
142+
Batch format allows for a set of CloudEvents to be represented, no relationship
143+
between those events should be inferred.
144+
145+
Although the _protobuf batch format_ builds on the _protobuf format_ it is considered
146+
seperate, that is to say that support of _protobuf format_ does not indicate support
147+
of the batch representation. The batch format MUST only be used where supported.
148+
149+
### 5.1 Envelope
150+
151+
The enveloping container is a _CloudEventBatch_ protobuf message containing a
152+
repeating set of _CloudEvent_ message(s):
153+
154+
```proto
155+
message CloudEventBatch {
156+
repeated CloudEvent events = 1;
157+
}
158+
```
159+
160+
### 5.2 Batch Media Type
161+
162+
A compliant protobuf batch representation is identifed using the following media-type
163+
164+
```text
165+
application/cloudevents-batch+protobuf
166+
```
167+
168+
## 6. Examples
142169

143170
The following code-snippets show how proto representations might be constucted
144171
assuming the availability of some convenience methods.
145172

146-
### 5.1 Plain Text event data
173+
### 6.1 Plain Text event data
147174

148175
```java
149176
public static CloudEvent plainTextExample() {
@@ -169,7 +196,7 @@ public static CloudEvent plainTextExample() {
169196

170197
```
171198

172-
### 5.2 Proto message as event data
199+
### 6.2 Proto message as event data
173200

174201
Where the event data payload is itself a protobuf message (with its own schema)
175202
a protocol buffer idiomatic method can be used to carry the data.

spec.proto

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,13 @@ message CloudEvent {
5656
google.protobuf.Timestamp ce_timestamp = 7;
5757
}
5858
}
59-
}
59+
}
60+
61+
/**
62+
* CloudEvent Protobuf Batch Format
63+
*
64+
*/
65+
66+
message CloudEventBatch {
67+
repeated CloudEvent events = 1;
68+
}

0 commit comments

Comments
 (0)