pivotal-cf/PCC-Sample-App-PizzaStore

Name: PCC-Sample-App-PizzaStore

Owner: Pivotal Cloud Foundry

Description: Example sample application which uses Pivotal Cloud Cache(PCC) as a service on Pivotal Cloud Foundry

Created: 2017-12-29 15:18:17.0

Updated: 2018-05-23 18:16:51.0

Pushed: 2018-05-23 20:07:13.0

Homepage:

Size: 98

Language: Java

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Sample application for Pivotal Cloud Cache

Sample application for Pivotal Cloud Cache

How to run on Pivotal Cloud Foundry (PCF)

This is a Spring Boot application which can pushed to Pivotal Cloud Foundry(PCF) using cf push command that demonstrates some of Pivotal Cloud Cache?s(PCC) interesting features.

Steps.

  1. Create the Spring Boot jar file to deploy to PCF using ./gradlew build command
  2. Call cf push command to push the application on PCF. A PCF manifest.yml file already exists at the main directory
  3. Bind the application with a Pivotal Cloud Cache (PCC) service instance using command cf bind-service APP_NAME SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]. If service instance is not created create that using cf create-service p-cloudcache PLAN_NAME SERVICE_INSTANCE Once application is deployed, hit the REST endpoint <url>/healthcheck and you should see a 200 response code, if request was successful.
About the sample application

Pivotal Cloud Cache (PCC) is a high-performance, high-availability caching layer for Pivotal Cloud Foundry (PCF). This is a sample application which uses PCC as a provider of NoSQL store to a Spring Boot application. This application is a Pizza store application that can be used to create Pizzas with different sauces. All the Pizzas are stored in PCC clusters. It uses Spring Repository abstractions.

We have 2 types of Objects that go into PCC (regions in PCC/Pivotal GemFire language are analogous to a Map<>)

Both use the Repository pattern to write to PCC.

The application leverages Spring controllers that expose operations you can perform over REST.

REST API endpoints
  1. /healthcheck - Does save() and findById() on Pizza region to check if everything is setup properly. It creates 2 types of Pizzas, a Plain Pizza with red sauce and chicken Pizza with white sauce.
  2. /pestoOrder/{name} - Creates a Pizza with chicken and pesto sauce.
Continuous Query

Application has a Continuous Query registered on Pizza region whenever there is pesto sauce pizza created on region application will make a entry in the Name region.

PCC/Pivotal GemFire supports the notion of Continuous Query, which means a developer can specify any OQL pattern on regions and when that condition is satisfied an event would be returned with event object. For more details see here.

Known Issues

Example for build.gradle:

ompile("org.springframework.data:spring-data-gemfire:$springDataGemfireVersion"){
    exclude module: "io.pivotal.gemfire"
}
compile("io.pivotal.gemfire:geode-core:$gemfireVersion")
compile("io.pivotal.gemfire:geode-cq:$gemfireVersion")
compile("io.pivotal.gemfire:geode-wan:$gemfireVersion")
compile("io.pivotal.gemfire:geode-lucene:$gemfireVersion")

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.