Replicated Cache
What is the minimum configuration to get replicated caching going?
The minimum configuration you need to get replicated caching going is:
<cacheManagerPeerProviderFactory 
   class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory" 
   properties="peerDiscovery=automatic, 
               multicastGroupAddress=230.0.0.1, 
               multicastGroupPort=4446"/> 
<cacheManagerPeerListenerFactory 
   class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"/>
and then at least one cache declaration with
<cacheEventListenerFactory 
   class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"/`>
in it. An example cache is:
<cache name="sampleDistributedCache1" 
      maxEntriesLocalHeap="10" 
      eternal="false" 
      timeToIdleSeconds="100" 
      timeToLiveSeconds="100"> 
   <cacheEventListenerFactory 
      class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"/> 
</cache>
Each peer server can have the same configuration.
How do I add a CacheReplicator to a cache that already exists?
The cache event listening works, but it does not get plumbed into the peering mechanism. The current API does not have a CacheManager event for cache configuration change. You can however make it work by calling the notifyCacheAdded event.
getCache().getCacheManager().getCacheManagerEventListenerRegistry().notifyCacheAdded("cacheName");