The versioned example Spring Boot Data GemFire app at PCC-Sample-App-PizzaStore uses the VMware Tanzu GemFire for VMs service instance as a system of record. Directions for running the app are in the GitHub repository's file. The app is versioned, and branches of the repository represent GemFire for VMs versions. For GemFire for VMs v1.14.5, use the branch named release/1.14.5.

The app uses Spring Boot Data GemFire. The documentation for this opinionated extension of Spring Data GemFire is at Spring Boot for Apache Geode & Pivotal GemFire Reference Guide.

The app saves pizza orders within the VMware GemFire servers of a GemFire for VMs service instance. A REST interface provides a way for the app to take orders for pizza toppings and sauces.

The app demonstrates how to set up and run the app based on The App's Location.

Top Down Explanation

In this opinionated version of Spring Boot Data GemFire, at the topmost level of the app, the @SpringBootApplication annotation causes the app to have a ClientCache instance. Within the example app's CloudcachePizzaStoreApplication class, place the annotation at the class definition level:

public class CloudcachePizzaStoreApplication

This app is the client within a standard client/server architecture. The GemFire for VMs service instance contains the servers. The client cache is a driver for interactions with the servers.

The Spring repository construct is the preferred choice to use for the data storage, which will be an VMware GemFire region. To implement it, annotate this example's PizzaRepository implementation with @Repository:

public interface PizzaRepository extends CrudRepository<Pizza, String>

An VMware GemFire region underlies the Spring repository, storing the ordered pizzas. Annotate the Pizza class model with @Region:

public class Pizza {

Within the Pizza class, identify the key of the VMware GemFire region entries with the @Id annotation. It is the name field in this example:

@Getter @Id @NonNull
private final String name;

The @SpringBootApplication annotation results in a chain of opinionated defaults, all of which are appropriate for this app. It identifies the app as a client. The client receives an VMware GemFire client cache. Any regions will default to type PROXY. A proxy type of region forwards all region operations to the GemFire servers; no data is stored within the app's client cache.

See Configuring Regions for Spring details. See Region Design for GemFire for VMs details on regions.

The App Controller

The AppController class implements the REST interface, by annotating the class with @RestController:

public class AppController

As pizzas are ordered, a operation causes an VMware GemFire put operation that updates the region on the VMware GemFire server.

check-circle-line exclamation-circle-line close-line
Scroll to top icon