That example is probably for embedded caches. RemoteCache does not use any XML file, it's either a programmatic configuration or properties file.
Besides alternative marshallers (such as ProtoStreamMarshaller), you could also extend AbstractJBossmarshaller and provide a custom ClassExternalizerFactory. Then you would use your marshaller in programmatic configuration or set property infinispan.client.hotrod.marshaller to this class.
Thanks for your suggestions, it worked.
Do you know the reason why this could not be covered by the AdvancedExternalizer also for the hotrod configuration? It seems similar enough so one should be able to hook up the AdvancedExternalizers in pretty much the same way I now implement the Marshaller and the Externalizer factory and then hook them into the configuration with the .marshaller(...) config.
Also, I guess this covers a distribution as well? Once the entities are stored in Infinispan it can manage to distribute them according to its own protocol.
Probably because nobody asked for more convenient way before But there are few technical difficulties:
1) You have to make sure all clients register the same marshallers/externalizers. Besides the maintenance difficulties (you need to update all clients when you do a change in marshalled classes), this does not allow you to combine clients in C++, C#, the less accessing the same data via REST server etc.
2) Server still considers your data opaque, so you can't do querying (you would have to register the externalizer on server, too).
Generally, these problems are solved with Protobuf format, so we focus on that approach in cases when default does not work. Regrettably I don't have any numbers at hand to show you some comparison of JBoss Marshalling/Protobuf to give a perf guidance.