==  Interoperability between Embedded and Remote Server Endpoints
Infinispan offers the possibility to store and retrieve data in a <<_the_cache_interface, local embedded way>>, and also <<_server_modules, remotely thanks to the multiple endpoints offered>>, but until now if you choose one way to access the data, you were stuck with it. For example, you could not store data using the embedded interface and retrieve it via REST. 

Starting with Infinispan 5.3, it is now possible to configure Infinispan caches to work in a special, compatibility mode for those users interested in accessing Infinispan in multiple ways. Achieving such compatibility requires extra work from Infinispan in order to make sure that contents are converted back and forth between the different formats of each endpoint and this is the reason why compatibility mode is disabled by default.

=== Enable Compatibility Mode
For compatibility mode to work as expected, all endpoints need to be configured with the same cache manager, and need to talk to the same cache. If you're using the brand new link:$$http://www.jboss.org/infinispan/downloads$$[Infinispan Server distribution] , this is all done for you. If you're in the mood to experiment with this in a standalone unit test, link:$$https://github.com/infinispan/infinispan/blob/master/integrationtests/compatibility-mode-it/src/test/java/org/infinispan/it/compatibility/CompatibilityCacheFactory.java$$[this class] shows you how you can start multiple endpoints from a single class. 

So, to get started using Infinispan's compatibility mode, it needs to be enabled, either via XML:

.infinispan.xml
[source,xml]
----

<local-cache>
   <compatibility/>
</local-cache>

----

Or programmatically:

[source,java]
----

ConfigurationBuilder builder = ...
builder.compatibility().enable();

----

The key thing to remember about Infinispan's compatibility mode is that where possible, it tries to store data unmarshalling or deserializing it. It does so because the most common use case is for it to store Java objects and having Java objects stored in deserialized form means that they're very easy to use from an embedded cache. With this in mind, it makes some assumptions. For example, if something is stored via Hot Rod, it's most likely coming from the reference Hot Rod client, which is written in Java, and which uses a marshaller that keeps binary payloads very compact. So, when the Hot Rod operation reaches the compatibility layer, it will try to unmarshall it, by default using the same default marshaller used by the Java Hot Rod client, hence providing good out-of-the-box support for the majority of cases.

==== Optional: Configuring Compatibility Marshaller
It could happen though the client might be using a Hot Rod client written for another language other than Java, say link:$$https://github.com/infinispan/ruby-client$$[Ruby] or link:$$https://github.com/infinispan/python-client$$[Python] . In this case, some kind of custom marshaller needs to be configured that either translates that serialized payload into a Java object to be stored in the cache, or keeps it in serialized form. Both options are valid, but of course it will have an impact on what kind of objects are retrieved from Infinispan if using the embedded cache. The marshaller is expected to implement link:http://docs.jboss.org/infinispan/{infinispanversion}/apidocs/org/infinispan/commons/marshall/Marshaller.html[this interface] . Configuring the compatibility marshaller is optional and can be done via XML:

.infinispan.xml
[source,xml]
----

<local-cache>
   <compatibility marshaller="com.acme.CustomMarshaller"/>
</local-cache>

----

Or programmatically:

[source,java]
----

ConfigurationBuilder builder = ...
builder.compatibility().enable().marshaller(new com.acme.CustomMarshaller());

----

One concrete example of this marshaller logic can be found in the link:$$https://github.com/infinispan/infinispan/blob/master/integrationtests/compatibility-mode-it/src/test/java/org/infinispan/it/compatibility/EmbeddedRestMemcachedHotRodTest.java#L161$$[SpyMemcachedCompatibleMarshaller] . link:$$https://code.google.com/p/spymemcached/$$[Spy Memcached] uses their own transcoders in order to marshall objects, so the compatibility marshaller created is in charge of marshalling/unmarshalling data stored via Spy Memcached client. If you want to retrieve data stored via Spy Memcached via say Hot Rod, you can <<_java_hot_rod_client, configure the Java Hot Rod client to use this same marshaller>>, and this is precisely what the test where the Spy Memcached marshaller is located is demonstrating. 

=== Code examples
The best code examples available showing compatibility in action can be found in the link:$$https://github.com/infinispan/infinispan/tree/master/integrationtests/compatibility-mode-it/src/test/java/org/infinispan/it/compatibility$$[Infinispan Compatibility Mode testsuite], but more will be developed in the near future. 

