Access Keys:
Skip to content (Access Key - 0)

GemFire Versions

About GemFire Enterprise 6.5

Getting Started




Developer Notes

Tools & Libraries

Toggle Sidebar

Replicated Caching Example

Replicated caching gives you a complete copy of your data in each JVM in the distributed system that hosts the replicated region. Any change made by any distributed system member is automatically forwarded into the replicated region. You can use this to keep a complete copy in one place for such things as high availability and synchronization with an outside data store. In a client/server installation, backup servers that replicate primary server data can take over when the primary fails, with no data loss. Read more about replicated regions.

Running the Example

This example shows a producer/consumer system. The producer acts as a data feed, putting data into the region using a replicated proxy. A replicated proxy does not store anything in its own JVM but sends it to any replicated regions it finds in its distributed system.

The consumer region is configured as replicated so anything the producer adds or updates is automatically copied to the consumer. The consumer region has a listener that reports all updates to standard out, so you can see when the copies arrive. A GemFire cache listener handles changes to the data region.

To run this example, you must have terminal sessions configured for the QuickStart examples, as described in Setting Up the Environment.
  1. In one terminal session, start the consumer:
    $ java quickstart.PushConsumer
  2. After that session starts, in another session, start the producer:
    $ java quickstart.PushProducer

Example Listings

Program and cache configuration file listings for the producer and consumer, including the listener,, declared in the PushConsumer.xml file.

Related Javadocs

CacheFactory, Cache, Region, REPLICATE and REPLICATE_PROXY in RegionShortcut

Child Pages

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
Adaptavist Theme Builder (3.4.0-M2-conf210) Powered by Atlassian Confluence 2.10.3, the Enterprise Wiki.