This is one of the most basic examples. Two servers host a replicated region. The producer puts 50 entries into the replicated region. The consumer prints the number of entries in the region.
-
From the
geode-examples/replicated
directory, start the locator and two servers:$ scripts/startAll.sh
-
Run the producer:
$ gradle run -Pmain=Producer ... ... INFO: Done. Inserted 50 entries.
-
Run the consumer:
$ gradle run -Pmain=Consumer ... ... INFO: Done. 50 entries available on the server(s).
-
Kill one of the servers:
$ gfsh ... gfsh>connect gfsh>stop server --name=server1 gfsh>quit
-
Run the consumer a second time, and notice that all the entries are still available due to replication:
$ gradle run -Pmain=Consumer ... ... INFO: Done. 50 entries available on the server(s).
-
Shutdown the system:
$ scripts/stopAll.sh
This example is a simple demonstration on basic APIs of Geode, as well how to write tests using mocks for Geode applications.