High Level Steps for Using PDX Serialization
To use PDX serialization, you can configure and use Geode’s reflection-based autoserializer, or you can program the serialization of your objects by using the PDX interfaces and classes.
Optionally, program your application code to deserialize individual fields out of PDX representations of your serialized objects. You may also need to persist your PDX metadata to disk for recovery on startup.
Procedure
Use one of these serialization options for each object type that you want to serialize using PDX serialization:
To ensure that your servers do not need to load the application classes, set the
pdx
read-serialized
attribute to true. In gfsh, execute the following command before starting up your servers:gfsh>configure pdx --read-serialized=true
By using gfsh, this configuration can be propagated across the cluster through the Cluster Configuration Service. Alternately, you would need to configure
pdx read-serialized
in each server’scache.xml
file.If you are storing any Geode data on disk, then you must configure PDX serialization to use persistence. See Persisting PDX Metadata to Disk for more information.
(Optional) Wherever you run explicit application code to retrieve and manage your cached entries, you may want to manage your data objects without using full deserialization. To do this, see Programming Your Application to Use PdxInstances.
PDX and Multi-Site (WAN) Deployments
For multisite (WAN) installations only– if you will use PDX serialization in any of your WAN-enabled regions, for each cluster, you must choose a unique integer between 0 (zero) and 255 and set the distributed-system-id
in every member’s gemfire.properties
file. See Configuring a Multi-site (WAN) System.