2© 2014 Pivotal Software, Inc. All rights reserved. 2© 2014 Pivotal Software, Inc. All rights reserved.
Getting Started with
Apache Geode
Spring Boot ^ Spring Data Geode
John Blum
3© 2014 Pivotal Software, Inc. All rights reserved.
Presenter
John Blum
Spring Data Team
Spring Data Geode Lead
Apache Geode Committer
Pivotal Software, Inc.
@john_blum jxblum
4© 2014 Pivotal Software, Inc. All rights reserved.
How do you build an application
that uses Apache Geode?
5© 2014 Pivotal Software, Inc. All rights reserved.
How do you configure and bootstrap
Apache Geode for your application to use?
6© 2014 Pivotal Software, Inc. All rights reserved.
1. Install Apache Geode
2. Use Gfsh to start a Locator
3. Start Pulse
4. Start a Server
5. Create a replicated, persistent Region
6. Manipulate data in a Region and
demonstrate persistence.
7. Examine the effects of replication.
8. Restart the cache servers in parallel.
9. Shutdown the system including your
Locators.
Gfsh>
7© 2014 Pivotal Software, Inc. All rights reserved.
API
8© 2014 Pivotal Software, Inc. All rights reserved.
Gfsh
+
API
9© 2014 Pivotal Software, Inc. All rights reserved.
cache.xml
10© 2014 Pivotal Software, Inc. All rights reserved.
Cluster Configuration
gfsh>start locator ..
gfsh>start server ..
gfsh>create region ..
gfsh>create index ..
gfsh>deploy ..
gfsh>create gateway-sender ..
gfsh>create gateway-receiver ..
gfsh>alter region ..
gfsh>create disk-store ..
gfsh>destroy index ..
gfsh>create async-event-queue ..
gfsh>alter runtime ..
gfsh>configure pdx ..
gfsh>destroy function..
11© 2014 Pivotal Software, Inc. All rights reserved.
App
cache.xml • Geode API
Gfsh
Cluster Config
Bosh
CF-CLI
Pivotal
GemFire
12© 2014 Pivotal Software, Inc. All rights reserved.
Spring XML
13© 2014 Pivotal Software, Inc. All rights reserved.
Spring @Java Config
14© 2014 Pivotal Software, Inc. All rights reserved.
Argh!
 Gfsh
 API
 <cache.xml/>
 Cluster Configuration
 Spring XML
 Spring Java-based Annotation Config @
15© 2014 Pivotal Software, Inc. All rights reserved.
Spring Data GemFire / Geode
1
Apply the Spring Framework’s powerful, non-invasive programming model &
concepts to simplify the configuration and development of highly-scalable,
distributed Spring applications based on Pivotal GemFire or Apache Geode.
Promise
16© 2014 Pivotal Software, Inc. All rights reserved.
Spring Data GemFire / Geode
1
Simplify the OOTB, getting started experience by reducing the friction to get up
& running as quickly and easily as possible.
Promise of 2016…
17© 2014 Pivotal Software, Inc. All rights reserved.
Apps are the currency…
18© 2014 Pivotal Software, Inc. All rights reserved.
19© 2014 Pivotal Software, Inc. All rights reserved.
Maven Artifacts
Spring Data GemFire / Geode
Spring Data GemFire
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-gemfire</artifactId>
<version>1.8.2.RELEASE</version>
</dependency>
Spring Data Geode
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-geode</artifactId>
<version>1.0.0.APACHE-GEODE-INCUBATING-M2</version>
</dependency>
Pivotal
GemFire
http://search.maven.org/#artifactdetails%7Corg.springframework.data%7Cspring-data-
gemfire%7C1.8.2.RELEASE%7Cjar
http://search.maven.org/#artifactdetails%7Corg.springframework.data%7Cspring-data-
geode%7C1.0.0.APACHE-GEODE-INCUBATING-M2%7Cjar
20© 2014 Pivotal Software, Inc. All rights reserved.
Examples
21© 2014 Pivotal Software, Inc. All rights reserved.
Existing Annotations
 @EnableGemFireFunctions
 @EnableGemFireFunctionExecutions
 @EnableGemFireRepositories
22© 2014 Pivotal Software, Inc. All rights reserved.
More enabling annotations…
 @EnableAuth
 @EnableExpiration
 @EnableHttpService
 @EnableLogging
 @EnableOffHeap (Geode)
 @EnableStatistics
 @WithGemFireProperties
 …
23© 2014 Pivotal Software, Inc. All rights reserved.
What’s Next…
 Annotation Support for GemFire / Geode Callbacks
 Annotation-based Test Framework
 Extensions for Pivotal CloudFoundry (PCF)
24© 2014 Pivotal Software, Inc. All rights reserved.
Annotations for Callbacks
@Component
public class ExampleApplicationCallbacks {
@CacheListener(region = “EventSource”)
public void afterCreate(EntryEvent<K, V> event) {
..
}
@CacheLoader(region = “DataSink”)
public void load(LoaderHelper<K, V> helper) {
..
}
@CacheWriter(region = “DataSource”)
public void beforeUpdate(EntryEvent<K, V> event) {
..
}
}
25© 2014 Pivotal Software, Inc. All rights reserved.
Annotation-based Test Framework
@RunWith(SpringRunner.class)
@SpringBootTest
@ClientServerIntegrationTest
public class ExampleClientServerTests {
}
@RunWith(SpringRunner.class)
@SpringBootTest
@PeerIntegrationTest
public class ExamplePeerMemberTests {
}
26© 2014 Pivotal Software, Inc. All rights reserved.
Other Things Brewing…
27© 2014 Pivotal Software, Inc. All rights reserved.
Spring Boot
2
PR #5445 – Spring Boot Starter Data Geode
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-geode</artifactId>
<version>???</version>
</dependency>`
28© 2014 Pivotal Software, Inc. All rights reserved.
Spring Boot
2
PR #6224 – Auto-configuration support for SDG Repositories
interface CustomerRepository extends Repository<Customer, Long> {
}
@Region(“Customers”)
class Customer {
}
compile “org.springframework.boot:spring-boot-starter-data-gemfire:1.5.0.M1”
No longer necessary…
@SpringBootApplication
@EnableGemfireRepositories
class ExampleSpringBootApplication {
}
29© 2014 Pivotal Software, Inc. All rights reserved.
Try It Out…
Spring Data GemFire
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-gemfire</artifactId>
<version>1.9.0.M1</version>
</dependency>
Spring Data Geode
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-geode</artifactId>
<version>
1.0.0.APACHE-GEODE-INCUBATING-M3-SNAPSHOT
</version>
</dependency>
Pivotal
GemFire
https://repo.spring.io/libs-snapshot/org/springframework/data/spring-data-
gemfire/1.9.0.M1/spring-data-gemfire-1.9.0.M1.jar
https://repo.spring.io/libs-snapshot/org/springframework/data/spring-data-geode/1.0.0.APACHE-
GEODE-INCUBATING-M3-SNAPSHOT/spring-data-geode-1.0.0.APACHE-GEODE-INCUBATING-
M3-SNAPSHOT.jar
30© 2014 Pivotal Software, Inc. All rights reserved.
References
Slides @ http://www.slideshare.net/john_blum/getting-started-with-apache-geode
Examples @ https://github.com/SpringOnePlatform2016/spring-data-gemfire-in-action
31© 2014 Pivotal Software, Inc. All rights reserved. 31© 2014 Pivotal Software, Inc. All rights reserved.
Questions
Answers
Getting Started with Apache Geode

Getting Started with Apache Geode

  • 2.
    2© 2014 PivotalSoftware, Inc. All rights reserved. 2© 2014 Pivotal Software, Inc. All rights reserved. Getting Started with Apache Geode Spring Boot ^ Spring Data Geode John Blum
  • 3.
    3© 2014 PivotalSoftware, Inc. All rights reserved. Presenter John Blum Spring Data Team Spring Data Geode Lead Apache Geode Committer Pivotal Software, Inc. @john_blum jxblum
  • 4.
    4© 2014 PivotalSoftware, Inc. All rights reserved. How do you build an application that uses Apache Geode?
  • 5.
    5© 2014 PivotalSoftware, Inc. All rights reserved. How do you configure and bootstrap Apache Geode for your application to use?
  • 6.
    6© 2014 PivotalSoftware, Inc. All rights reserved. 1. Install Apache Geode 2. Use Gfsh to start a Locator 3. Start Pulse 4. Start a Server 5. Create a replicated, persistent Region 6. Manipulate data in a Region and demonstrate persistence. 7. Examine the effects of replication. 8. Restart the cache servers in parallel. 9. Shutdown the system including your Locators. Gfsh>
  • 7.
    7© 2014 PivotalSoftware, Inc. All rights reserved. API
  • 8.
    8© 2014 PivotalSoftware, Inc. All rights reserved. Gfsh + API
  • 9.
    9© 2014 PivotalSoftware, Inc. All rights reserved. cache.xml
  • 10.
    10© 2014 PivotalSoftware, Inc. All rights reserved. Cluster Configuration gfsh>start locator .. gfsh>start server .. gfsh>create region .. gfsh>create index .. gfsh>deploy .. gfsh>create gateway-sender .. gfsh>create gateway-receiver .. gfsh>alter region .. gfsh>create disk-store .. gfsh>destroy index .. gfsh>create async-event-queue .. gfsh>alter runtime .. gfsh>configure pdx .. gfsh>destroy function..
  • 11.
    11© 2014 PivotalSoftware, Inc. All rights reserved. App cache.xml • Geode API Gfsh Cluster Config Bosh CF-CLI Pivotal GemFire
  • 12.
    12© 2014 PivotalSoftware, Inc. All rights reserved. Spring XML
  • 13.
    13© 2014 PivotalSoftware, Inc. All rights reserved. Spring @Java Config
  • 14.
    14© 2014 PivotalSoftware, Inc. All rights reserved. Argh!  Gfsh  API  <cache.xml/>  Cluster Configuration  Spring XML  Spring Java-based Annotation Config @
  • 15.
    15© 2014 PivotalSoftware, Inc. All rights reserved. Spring Data GemFire / Geode 1 Apply the Spring Framework’s powerful, non-invasive programming model & concepts to simplify the configuration and development of highly-scalable, distributed Spring applications based on Pivotal GemFire or Apache Geode. Promise
  • 16.
    16© 2014 PivotalSoftware, Inc. All rights reserved. Spring Data GemFire / Geode 1 Simplify the OOTB, getting started experience by reducing the friction to get up & running as quickly and easily as possible. Promise of 2016…
  • 17.
    17© 2014 PivotalSoftware, Inc. All rights reserved. Apps are the currency…
  • 18.
    18© 2014 PivotalSoftware, Inc. All rights reserved.
  • 19.
    19© 2014 PivotalSoftware, Inc. All rights reserved. Maven Artifacts Spring Data GemFire / Geode Spring Data GemFire <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-gemfire</artifactId> <version>1.8.2.RELEASE</version> </dependency> Spring Data Geode <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-geode</artifactId> <version>1.0.0.APACHE-GEODE-INCUBATING-M2</version> </dependency> Pivotal GemFire http://search.maven.org/#artifactdetails%7Corg.springframework.data%7Cspring-data- gemfire%7C1.8.2.RELEASE%7Cjar http://search.maven.org/#artifactdetails%7Corg.springframework.data%7Cspring-data- geode%7C1.0.0.APACHE-GEODE-INCUBATING-M2%7Cjar
  • 20.
    20© 2014 PivotalSoftware, Inc. All rights reserved. Examples
  • 21.
    21© 2014 PivotalSoftware, Inc. All rights reserved. Existing Annotations  @EnableGemFireFunctions  @EnableGemFireFunctionExecutions  @EnableGemFireRepositories
  • 22.
    22© 2014 PivotalSoftware, Inc. All rights reserved. More enabling annotations…  @EnableAuth  @EnableExpiration  @EnableHttpService  @EnableLogging  @EnableOffHeap (Geode)  @EnableStatistics  @WithGemFireProperties  …
  • 23.
    23© 2014 PivotalSoftware, Inc. All rights reserved. What’s Next…  Annotation Support for GemFire / Geode Callbacks  Annotation-based Test Framework  Extensions for Pivotal CloudFoundry (PCF)
  • 24.
    24© 2014 PivotalSoftware, Inc. All rights reserved. Annotations for Callbacks @Component public class ExampleApplicationCallbacks { @CacheListener(region = “EventSource”) public void afterCreate(EntryEvent<K, V> event) { .. } @CacheLoader(region = “DataSink”) public void load(LoaderHelper<K, V> helper) { .. } @CacheWriter(region = “DataSource”) public void beforeUpdate(EntryEvent<K, V> event) { .. } }
  • 25.
    25© 2014 PivotalSoftware, Inc. All rights reserved. Annotation-based Test Framework @RunWith(SpringRunner.class) @SpringBootTest @ClientServerIntegrationTest public class ExampleClientServerTests { } @RunWith(SpringRunner.class) @SpringBootTest @PeerIntegrationTest public class ExamplePeerMemberTests { }
  • 26.
    26© 2014 PivotalSoftware, Inc. All rights reserved. Other Things Brewing…
  • 27.
    27© 2014 PivotalSoftware, Inc. All rights reserved. Spring Boot 2 PR #5445 – Spring Boot Starter Data Geode <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-geode</artifactId> <version>???</version> </dependency>`
  • 28.
    28© 2014 PivotalSoftware, Inc. All rights reserved. Spring Boot 2 PR #6224 – Auto-configuration support for SDG Repositories interface CustomerRepository extends Repository<Customer, Long> { } @Region(“Customers”) class Customer { } compile “org.springframework.boot:spring-boot-starter-data-gemfire:1.5.0.M1” No longer necessary… @SpringBootApplication @EnableGemfireRepositories class ExampleSpringBootApplication { }
  • 29.
    29© 2014 PivotalSoftware, Inc. All rights reserved. Try It Out… Spring Data GemFire <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-gemfire</artifactId> <version>1.9.0.M1</version> </dependency> Spring Data Geode <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-geode</artifactId> <version> 1.0.0.APACHE-GEODE-INCUBATING-M3-SNAPSHOT </version> </dependency> Pivotal GemFire https://repo.spring.io/libs-snapshot/org/springframework/data/spring-data- gemfire/1.9.0.M1/spring-data-gemfire-1.9.0.M1.jar https://repo.spring.io/libs-snapshot/org/springframework/data/spring-data-geode/1.0.0.APACHE- GEODE-INCUBATING-M3-SNAPSHOT/spring-data-geode-1.0.0.APACHE-GEODE-INCUBATING- M3-SNAPSHOT.jar
  • 30.
    30© 2014 PivotalSoftware, Inc. All rights reserved. References Slides @ http://www.slideshare.net/john_blum/getting-started-with-apache-geode Examples @ https://github.com/SpringOnePlatform2016/spring-data-gemfire-in-action
  • 31.
    31© 2014 PivotalSoftware, Inc. All rights reserved. 31© 2014 Pivotal Software, Inc. All rights reserved. Questions Answers

Editor's Notes

  • #18 In a Cloud (Native Java) context with Microservices