The wan example is an application that simulates two WAN sites, namely a US Site
and an EU Site. The example is located in the GemFire installation under
examples/dist/wan.
The WAN example contains the following four components:
In every shell used to run this example application, configure your environment according to the instructions provided in examples/EnvSetup.html.
Once your environment is set, change to the
examples/dist/wan directory to run the
application.
To run the WAN example, perform the following steps:
The US WAN Hub is a cache server gateway to the EU WAN. This gateway forwards any client updates to entries in the trades region to the EU WAN. Entry updates received from the EU WAN Hub will be distributed to its clients.
Change to the examples/dist/wan/us-hub directory and run the following command:
cacheserver start This command will log output like shown below: Starting CacheServer with pid: 18087 CacheServer pid: 18087 status: running
The EU WAN Hub is a cache server gateway to the US WAN. This gateway forwards any client updates to entries in the trades region to the US WAN. Entry updates received from the US WAN Hub will be distributed to its clients.
Change to the examples/dist/wan/eu-hub directory and
run the following command:
cacheserver start This command will log output like shown below: Starting CacheServer with pid: 18686 CacheServer pid: 18686 status: running
Change to the examples/dist/wan/eu-client directory and run the following command:.
The EU WAN Client listens for updates to entries in trades region.
java wan.WANClient eu
The WANClient class has a main method
that creates either a US or EU WAN client using the 'us' or 'eu' parameters.
Shown below is the WANClient usage.
$ java wan.WANClient ** Missing site name usage: java wan.WANClientsite The name of the WAN site (either 'us' or 'eu') Launches a WAN client
This command will log output like shown below:
Created GemFire cache: eu-client Retrieved region: com.gemstone.gemfire.internal.cache.LocalRegion[path='/trades';scope=LOCAL';data-type=NORMAL] Registered interest in [ALL_KEYS] for region trades
The US WAN Client launches mulitple threads, each putting entries into the trades region.
Change to the examples/dist/wan/us-client directory and run the following command:
java wan.WANClient us
This command will log output like shown below:
Created GemFire cache: us-client Retrieved region: com.gemstone.gemfire.internal.cache.LocalRegion[path='/trades';scope=LOCAL';data-policy=NORMAL] Thread-1: Putting key-704->704 Thread-3: Putting key-2663->2663 Thread-2: Putting key-2822->2822 Thread-4: Putting key-853->853 Thread-5: Putting key-3612->3612 Thread-6: Putting key-1668->1668 Thread-7: Putting key-1872->1872 Thread-8: Putting key-4540->4540 Thread-9: Putting key-442->442 Thread-10: Putting key-1494->1494 Thread-8: Putting key-2661->2661 . . .
In addition, output like shown below will be displayed in the EU client window:
WANListener received afterCreate event (1) for region trades: key-853->853 WANListener received afterUpdate event (2) for region trades: key-1494->1494 WANListener received afterCreate event (3) for region trades: key-4540->4540 WANListener received afterCreate event (4) for region trades: key-704->704 WANListener received afterUpdate event (5) for region trades: key-2822->2822 WANListener received afterCreate event (6) for region trades: key-442->442 WANListener received afterCreate event (7) for region trades: key-1872->1872 WANListener received afterCreate event (8) for region trades: key-2663->2663 WANListener received afterUpdate event (9) for region trades: key-1668->1668 WANListener received afterUpdate event (10) for region trades: key-3612->3612 WANListener received afterCreate event (11) for region trades: key-1926->1926 WANListener received afterUpdate event (12) for region trades: key-2661->2661 WANListener received afterCreate event (13) for region trades: key-2372->2372 . . .
Stop the us-client and eu-client client VMs using CTL-C. Stop the us-hub and eu-hub cache server VMs using the 'cacheserver stop' command from the shell window that launched them. An example is shown below.
cacheserver stop CacheServer stopped.