12.4. Configuring the Marshaller using the RemoteCacheManager


A Marshaller is specified using the marshaller configuration element in the RemoteCacheManager, the value of which must be the name of the class implementing the Marshaller interface. The default value for this property is org.infinispan.commons.marshall.jboss.GenericJBossMarshaller.
The following procedure describes how to define a Marshaller to use with RemoteCacheManager.

Procedure 12.1. Define a Marshaller

  1. Create a ConfigurationBuilder

    Create a ConfigurationBuilder and configure it with the required settings.
    ConfigurationBuilder builder = new ConfigurationBuilder();
    //... (other configuration)
  2. Add a Marshaller Class

    Add a Marshaller class specification within the Marshaller method.
    builder.marshaller(GenericJBossMarshaller.class);
    • Alternatively, specify a custom Marshaller instance.
      builder.marshaller(new GenericJBossMarshaller());
  3. Start the RemoteCacheManager

    Build the configuration containing the Marshaller, and start a new RemoteCacheManager with it.
    Configuration configuration = builder.build();
    RemoteCacheManager manager = new RemoteCacheManager(configuration);
At the client level, POJOs need to be either Serializable, Externalizable, or primitive types.

Note

The Hot Rod Java client does not support providing Externalizer instances to serialize POJOs. This is only available for JBoss Data Grid Library mode.
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.