Serializing Data with GemFire PDX Serialization

Serializing Data with GemFire PDX Serialization

PDX is a cross-language data format that can reduce the cost of distributing and
serializing your objects. PDX stores data in named fields that you can access individually
to avoid the cost of deserializing the entire data object. When you use GemFire PDX
serialization with the native client C++ API, you can register a PdxSerializer for the
entire cache, implement PDX serialization for each domain object or use automatic PDX
serialization by running the pdxautoserializer tool.

You can also set the object preference of the cache to the PdxInstance type, which allows
you to access fields of a PDX object without deserializing the entire object.

When using the native client C++ API, you can opt to use PDX autoserialization. The
GemFire native client provides a command line tool called
pdxautoserializer that will automatically generate C++ code that
will PDX serialize the class you want to serialize.

Serialize Using the GemFire PdxSerializable Class
Domain classes need to inherit the PdxSerializable abstract class to serialize and de-serialize the object. When you write objects using PDX serialization, they are distributed to the server tier in PDX serialized form.

Using Automatic PDX Serialization
You can allow your native client C++ applications to automatically PDX serialize and deserialize domain objects without having to add any extra code by using the pdxautoserializer command line tool provided with the native client.

Programming Your Application to Use PdxInstances
A PdxInstance is a lightweight wrapper around the raw bytes of the PDX serialized objects kept in the cache. It provides applications with run-time access to files of a PDX serialized object. GemFire provides the implementation of the PdxInstance class.