Universal Messaging 10.5 | Concepts | Commonly Used Features | Google Protocol Buffers
 
Google Protocol Buffers
Overview
Google Protocol Buffers are a way of efficiently serializing structured data. They are language and platform neutral and have been designed to be easily extensible. The structure of your data is defined once, and then specific serialization and deserialization code is produced specifically to handle your data format efficiently.
The serialization uses highly efficient encoding to make the serialized data as space efficient as possible, and the custom generated code for each data format allows for rapid serialization and deserialization.
Universal Messaging always uses server-side filtering of Google Protocol Buffers, and this, coupled with Google Protocol Buffer's space-efficient serialization can reduce the amount of data delivered to a client.
Note:
If server side filtering is not required, do not configure Google protocol buffer descriptors for the respective channel or queue.
The structure of the data is defined in a .proto file, messages are constructed from a number of different types of fields and these fields can be required, optional or repeated. Protocol Buffers can also include other Protocol Buffers.
The protobuf descriptor file required at runtime is constructed by compiling the .proto file using the standard protobuf compiler and the --descriptor_set_out option.
Using Google Protocol Buffers with Universal Messaging
Google supplies libraries for Protocol Buffers in Java, C++ and Python, and third party libraries provide support for many other languages including .NET, Perl, PHP etc. Universal Messaging's client APIs provide support for the construction of Google Protocol Buffer events through which the serialized messages can be passed.
These nProtobufEvents are integrated seamlessly in Universal Messaging, allowing for server-side filtering of Google Protocol Buffer events, which can be sent on resources just like normal Universal Messaging Events.
The server side filtering of messages for a given channel or queue is achieved by providing the server with the protobuf descriptor file for the channel/queue. The location of the protobuf descriptor file for any given channel/queue can be configured in the attribute list of the channel/queue using the Enterprise Manager, or programmatically using the Administration API.
The server can then extract the key/value pairs from the binary Protobuf message, and filter message delivery based on user requirements.
To create an nProtobuf event, simply build your protocol buffer as normal and pass it into the nProtobuf constructor along with the message type used.
The Enterprise Manager can be used to view, edit and republish protocol buffer events, even if the Enterprise Manager is not running on the same machine as the server.
Configuring Universal Messaging for use with Protocol Buffers
The realm configuration parameters for protocol buffers have their own section Protobuf Config in the Enterprise Manager Config panel.
If nested messages need to be filtered on, then GlobalValues -> ExtendedMessageSelectors, must be set to true. Again this is now enabled by default but will not be enabled in installs upgraded from older versions.
Protobuf with the Enterprise Manager
When creating a channel via the Enterprise Manager, there is a protobuf descriptor section on the create dialogue. Clicking "Set..." here brings up a file dialogue where a descriptor file (generated when the protobuf is compiled, as described above) can be selected. Multiple descriptor files can currently only be set programmatically, not via the Enterprise Manager.
Any channel with an associated descriptor can be snooped in the normal way. Enterprise Manager will use the descriptor to deserialize the message, and will show the contents of that message in the event details.