Search

Chapter 43. Configuring Compatibility Mode

download PDF

Compatibility mode provides a mechanism for accessing data in the cache from multiple endpoints.

Compatibility mode configures JBoss Data Grid to use a marshaller that serializes and deserializes raw bytes into strings and primitives. For this reason, compatibility mode supports only strings and primitives and does not support objects.

Important

Compatibility mode is not an efficient method for achieving interoperability between remote endpoints. It is a legacy feature that is not recommended for new deployments.

Instead of using compatibility mode, you should configure the format in which the cache stores data by defined the media type. See Endpoint Interoperability.

43.1. Enabling Compatibility Mode

To enable compatibility mode, add enabled=true to the compatibility element as follows:

<cache-container name="local" default-cache="default" statistics="true">
    <local-cache name="default" statistics="true">
        <compatibility enabled="true"/>
    </local-cache>
</cache-container>

43.2. Marshallers in Compatibility Mode

JBoss Data Grid does not support custom marshallers. You can use the following marshallers in compatibility mode:

MarshallerDescription

GenericJBossMarshaller

Uses the JBoss marshaller to serialize and deserialize strings and primitives as byte arrays. This is the default marshaller in compatibility mode.

ProtoStreamCompatibilityMarshaller

Uses the ProtoStream library to serialize and deserialize strings and primitives as byte arrays.

UTF8StringMarshaller

Serializes and deserializes strings and primitives as UTF8 byte arrays.

43.3. Specifying the Marshaller

Specify marshallers with the marshaller attribute, as in the following example:

<cache-container name="local" default-cache="default" statistics="true">
    <local-cache name="default" statistics="true">
    	<compatibility enabled="true" marshaller="org.infinispan.commons.marshall.UTF8StringMarshaller"/>
    </local-cache>
</cache-container>

43.3.1. Memcached Marshaller

When using memcached in compatibility mode, you must explicitly set the default marshaller, GenericJBossMarshaller, in the configuration. For example:

<cache-container name="local" default-cache="default" statistics="true">
    <local-cache name="default" statistics="true">
        <compatibility enabled="true" marshaller="org.infinispan.commons.marshall.jboss.GenericJBossMarshaller"/>
    </local-cache>
</cache-container>
Important

Java clients must use a transcoder to perform read and write operations in compatibility mode. The transcoder enables memcached clients written in Java to convert between byte arrays and strings or primitives.

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.