Encoding Documents as Protocol Buffers during Document Publishing
When Integration Server publishes an instance of a publishable document type for which the encoding type is set to protocol buffers, Integration Server encodes the document using the protocol buffer descriptor created for the publishable document type. The protocol buffer descriptor is a representation of the publishable document type in the protocol buffer format.
Integration Server only encodes fields with names and data that are represented in the protocol buffer descriptor in the protocol buffer. Fields whose name or data type cannot be protocol buffer encoded will be passed through in the UnknownFieldSet. Integration Server encodes the UnknownFieldSet field as a serialized IData byte array.
For more information about fields that cannot be represented in protocol buffers, see
Limitations for Representing Fields
in Protocol Buffer Descriptors.
However, at the time Integration Server publishes a document, there might be additional fields that cannot be encoded as protocol buffers. Integration Server adds these fields to UnknownFieldSet.
The following contents of a published document will not be encoded as protocol buffers:
Undeclared fields. Any fields that are in the published document but are not defined in the publishable document type will be added to the UnknownFieldSet. On the subscribing side,
Integration Server decodes these undeclared fields and adds them immediately before the
_env field.
Fields with a null value. Even if
Integration Server can represent the field in protocol buffers, null values cannot be included in protocol buffers. Fields with null values will be added to the UnknownFieldSet. On the subscribing side,
Integration Server decodes these fields as null at their original position as defined in the publishable document type.
Any list field in which one of the elements is a null value. The entire list is encoded as a single serialized IData and placed in the UnknowFieldSet. On the subscribing side,
Integration Server decodes the list field into its original position as defined in the publishable document type.
In addition, document encoding can fail if Integration Server encounters an unexpected data type. For example, if publishable document type defines a field named myString to be a String but at run time, the data type of myString is not an instance of String, Integration Server cannot encode myString because it is not the expected data type. In fact, document encoding fails entirely and publication fails with the following error:
Protocol buffer coder cannot handle data type dataTypeName for field fieldName in document type: publishableDocumentType. Error: errorMessage