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
SBE messages have no defined message delimiter. Version 2.0 of SBE makes it possible to walk the elements of a message to determine its limit, even when the message has been extended. Nevertheless, since internal framing depends on a correct starting point and not encountering malformed messages, it may be desirable to use an external framing protocol when used with transports that do not preserve message boundaries, such as when they are transmitted on a streaming
7
+
SBE messages have no defined message delimiter. SBE makes it possible to walk the elements of a message to determine its limit, even when the message has been extended. Nevertheless, since internal framing depends on a correct starting point and not encountering malformed messages, it may be desirable to use an external framing protocol when used with transports that do not preserve message boundaries, such as when they are transmitted on a streaming
8
8
session protocol or when persisting messages in storage.
9
9
10
10
### Simple Open Framing Header
@@ -78,7 +78,7 @@ The fields of the SBE message header are:
78
78
Block length is specified in a message schema, but it is also serialized
79
79
on the wire. By default, block length is set to the sum of the sizes of
80
80
body fields in the message. However, it may be increased to force
81
-
padding at the end of block. See section 3.3.3.3 below.
81
+
padding at the end of block. See [Padding](#padding-at-end-of-a-message-or-group).
82
82
83
83
### Message header schema
84
84
@@ -87,7 +87,7 @@ position as shown below. Each of these fields must be encoded as an
87
87
unsigned integer type. The encoding must carry the name "messageHeader".
88
88
89
89
The message header is encoded in the same byte order as the message
90
-
body, as specified in a message schema. See section 4.3.1.
90
+
body, as specified in a message schema. See section 4.
91
91
92
92
Recommended message header encoding
93
93
@@ -120,9 +120,9 @@ for blockLength.
120
120
121
121
The total space reserved for the root level of the message not counting
122
122
any repeating groups or variable-length fields. (Repeating groups have
123
-
their own block length; see section 3.4 below. Length of a
123
+
their own block length; see [Group block length](#group-block-length) below. Length of a
124
124
variable-length Data field is given by its corresponding Length field;
125
-
see section 2.7.3 above.) Block length only represents message body
125
+
see section 2.) Block length only represents message body
126
126
fields; it does not include the length of the message header itself,
127
127
which is a fixed size.
128
128
@@ -134,18 +134,18 @@ schema.
134
134
135
135
### Template ID
136
136
137
-
The identifier of a message type in a message schema. See section 4.5.2
138
-
below for schema attributes of a message.
137
+
The identifier of a message type in a message schema. See section 4
138
+
for schema attributes of a message.
139
139
140
140
### Schema ID
141
141
142
-
The identifier of a message schema. See section 4.3.1 below for schema
142
+
The identifier of a message schema. See section 4 for schema
143
143
attributes.
144
144
145
145
### Schema version
146
146
147
147
The version number of the message schema that was used to encode a
148
-
message. See section 4.3.1 below for schema attributes.
148
+
message. See section 4 for schema attributes.
149
149
150
150
### Number of repeating groups
151
151
@@ -227,6 +227,8 @@ would cause fields to overlap.
227
227
Extra octets specified for padding should never be interpreted as
228
228
business data. They should be filled with binary zeros.
229
229
230
+
The offset attribute is mutually exclusive with alignment; see below.
231
+
230
232
Example of fields with specified offsets
231
233
232
234
```xml
@@ -247,6 +249,29 @@ Example of fields with specified offsets
247
249
| OrderQty | 4 | 1 | 16 |
248
250
| Symbol | 8 | 0 | 20 |
249
251
252
+
#### Field byte alignment
253
+
As an alternative to specifying a field's offset from the start of a block, its byte alignment may be specified. If specified, the start of a field should reside at an offset from the start of the buffer that is the next multiple of the alignment attribute. If the offset without alignment would not be a multiple of the alignment attribute, then the buffer is padded with octets to that multiple. The padding should be set to binary zeroes.
254
+
255
+
The alignment attribute is mutually exclusive with offset.
256
+
257
+
If neither offset nor alignment attributes are set, then a field is positioned at the next available octet in a buffer without padding.
258
+
259
+
Computation of padding and effective offset is as follows, where effective-offset is the resulting position in the buffer:
In order to force messages or groups to align on byte boundaries or map
@@ -308,6 +333,12 @@ fields. (Length of a variable-length Data field is given by its corresponding
308
333
Length field.) Block length only represents message body fields; it does not
309
334
include the length of the group dimension itself, which is a fixed size.
310
335
336
+
### Byte alignment of a group entry
337
+
338
+
If byte alignment of a repeating group is specified, the start of the first field of each entry should reside at an offset from the start of the buffer that is the next multiple of the alignment attribute. If the offset without alignment would not be a multiple of the alignment attribute, then the buffer is padded with octets to that multiple. The padding should be set to binary zeroes.
339
+
340
+
If byte alignment is not specified for a group, then no padding is introduced to align entries.
341
+
311
342
### Padding at end of a group entry
312
343
313
344
By default, the space reserved for an entry is the sum of a group’s
@@ -322,7 +353,7 @@ each entry and should be set to zeroes by encoders. The blockLength
322
353
value does not include the group dimensions itself.
323
354
324
355
Note that padding will only result in deterministic alignment if the
325
-
repeating group contains no variable-length fields.
356
+
repeating group contains no variable-length fields. Therefore, the alignment attribute is a more direct solution to that need.
326
357
327
358
### Entry counter
328
359
@@ -507,7 +538,7 @@ finally, variable-length data fields.
@@ -379,6 +381,10 @@ The `name` and `id` attributes are required. The first is a display name for
379
381
a message, while the latter is a unique numeric identifier, commonly
380
382
called template ID.
381
383
384
+
### Byte alignment
385
+
386
+
By default, a message starts at the first available byte of buffer. However, if desired, it may be aligned to a boundary by specifying the `alignment` attribute to improve performance on certain platforms. If specified, the start of the message should reside in the buffer at the next multiple of the alignment attribute. For example, if `alignment=4` then the message should start at the next address that is a multiple of 4.
387
+
382
388
### Reserved space
383
389
384
390
By default, message size is the sum of its field lengths. However, a
@@ -415,6 +421,7 @@ that they are encoded on the wire.
415
421
| semanticType | Documents value of FIX MsgType for a message | token | optional | Listed in FIX specifications |
416
422
| sinceVersion | Documents the version of a schema in which a message was added | nonNegativeInteger | default = 0 ||
417
423
| deprecated | Documents the version of a schema in which a message was deprecated. It should no longer be sent but is documented for back-compatibility. | nonnegativeInteger | optional | Must be less than or equal to the version of the message schema. |
424
+
| alignment | Controls byte alignment of the start of a message in its buffer| positiveInteger | optional ||
418
425
419
426
Note that there need not be a one-to-one relationship between message
420
427
template (identified by `id` attribute) and `semanticType` attribute. You
@@ -442,7 +449,8 @@ These are the common attributes of all field types.
442
449
| id | Unique field identifier (FIX tag) | unsignedShort | required ||
| type | Encoding type name, one of simple type, composite type or enumeration. | string | required | Must match the name attribute of a simple `<type>`, `<composite>` encoding type, `<enum>` or `<set>`. |
445
-
| offset | Offset to the start of the field within a message or repeating group entry. By default, the offset is the sum of preceding field sizes, but it may be increased to effect byte alignment. | unsignedInt | optional | Must be greater than or equal to the sum of preceding field sizes. |
452
+
| offset | Offset to the start of the field within a message or repeating group entry. By default, the offset is the sum of preceding field sizes, but it may be increased to effect byte alignment. | unsignedInt | optional | Must be greater than or equal to the sum of preceding field sizes. Mutually exclusive with alignment |
453
+
| alignment | Controls byte alignment of the start of a field in its buffer| positiveInteger | optional | Mutually exclusive with offset |
446
454
| presence | Field presence | enumeration | Default = required | required = field value is required; not tested for null. optional = field value may be null. constant = constant value not sent on wire. |
447
455
| valueRef | Constant value of a field as a valid value of an enumeration | qualifiedName\_t | optional Valid only if presence= ”constant” | If provided, the qualified name must match the name attribute of a `<validValue>` within an `<enum>`|
448
456
| sinceVersion | The version of a message schema in which this field was added. | InonnegativeInteger | default=0 | Must not be greater than version attribute of `<messageSchema>` element. |
@@ -487,7 +495,7 @@ The number of members of each type is unbound.
487
495
| id | Unique group identifier | unsignedShort | required ||
| dimensionType | Dimensions of the repeating group | symbolicName\_t | default = groupSizeEncoding | If specified, must be greater than or equal to the sum of field lengths. |
490
-
498
+
| alignment | Controls byte alignment of the start of each group instance in its buffer| positiveInteger | optional ||
491
499
`<group>` element inherits attributes of blockType. See `<message>`
0 commit comments