SlideShare a Scribd company logo
1 of 40
The Past Year in
Spring for Apache Geode
September 2–3, 2020
springone.io
John Blum
Lead…
for (P project : Spring for Apache Geode) {
manage(project);
}
@john_blum
…
Spring for Apache GeodeAll things…
What things?
Spring Boot
Spring Data Spring Session
Spring Test
Spring Boot
Spring Data Spring Session
Spring Test
Spring Boot Spring Data Spring Session Spring Test
TDP
(Test-Driven Presentation)
Spring Test for Apache Geode <STDG/>
 Fine-grained control over GemFire/Geode Mock Object Lifecycle [doc]
 Mocking Unsupported Cache Operations [doc]
 New @EnableGemFireResourceCollector [doc]
GemFire/Geode Mock Object Lifecycle
@EnableGemFireMockObjects(destroyOnEvents = { … })
class TestGeodeConfiguration {
…
}
Any event class in package org.springframework.test.context.event
 E.g. AfterTestMethodEvent
 Defaults to AfterTestClassEvent
EXAMPLE
Mocking Unsupported Cache Operations & @EnableGemFireResourceCollector
How To Use Spring Test with Apache Geode
 Generate Spring Boot [SBDG] project at start.spring.io
 Include spring-geode-starter-test module
<dependencies>
<dependency>
<groupId>org.springframework.geode</groupId>
<artifactId>spring-geode-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Spring Boot Spring Data Spring Session Spring Test
Spring Data for Apache Geode <SDG/>
 DATAGEODE-238 – spring-data-gemfire module
 DATAGEODE-272 – TransactionListener event publishing
 DATAGEODE-152 [Doc]
 WIP: DATAGEODE-263 – Paging
 WIP: DATAGEODE-262 – Projections
 WIP: DATAGEODE-258 – Function Executions on Region from Repository
Manual Transaction Event Publishing
@Service
class MyTransactionalService {
@Autowired
ApplicationEventPublisher publisher;
@Transactional
public void someTransactionalMethod() {
try {
// do transaction
publisher.publish(new CommitEvent());
} catch (DataAccessException e) {
publisher.publish(new RollbackEvent(e));
throw e;
}
}
@Component
class MyTransactionEventListeners {
@TransactionalEventListener(phase =
TransactionPhase.AFTER_COMMIT)
public void onCommit(CommitEvent event) {
// handle commit
}
@TransactionalEventListener(phase =
TransactionPhase.AFTER_ROLLBACK)
public void onRollback(RollbackEvent event) {
// handle rollback
}
}
https://spring.io/blog/2015/02/11/better-application-events-in-spring-framework-4-2
@Configuration
@EnableGemfireCacheTransactions
class GeodeConfiguration { }
Auto Transaction Event Publishing
@Service
class MyTransactionalService {
@Transactional
public void someTransactionalMethod() {
// do transaction
}
}
@Component
class MyTransactionEventListeners {
@TransactionalEventListener(phase =
TransactionPhase.AFTER_COMMIT)
public void onCommit(
TransactionApplicationEvent event) {
// handle commit
}
@TransactionalEventListener(phase =
TransactionPhase.AFTER_ROLLBACK)
public void onRollback(
TransactionApplicationEvent event) {
// handle rollback
}
}
https://docs.spring.io/spring-data/geode/docs/current/reference/html/#apis:auto-transaction-event-publishing
@Configuration
@EnableGemfireCacheTransactions(
enableAutoTransactionEventPublishing =
true)
class GeodeConfiguration { }
Projections, Paging & OnRegion Function Executions
interface UserRepository extends CrudRepository<User, String> {
// Projection (User -> UserView)
UserView findByNameLike(String wildcardName, Sort orderBy);
// Paging (Page number, Page size & Sort)
List<User> findByNameLike(String wildcardName, Pageable pageRequest);
Page<UserView> findByNameLike(String wildcardName, Pageable pageRequest);
@Function
boolean grant(Set<Long> userIds, Role role);
}
https://docs.spring.io/spring-data/data-commons/docs/current/reference/html/#repositories.paging-and-sorting
@Region(“Users”)
class User {
@Id
Long id;
String name;
Role role;
LocalDateTime lastAccessTime;
boolean active;
}
class UserView {
String name;
LocalDateTime lastAccessTime;
}
OnRegion Function Execution
interface UserRepository extends CrudRepository<User, Long> {
@Function
boolean grant(Set<Long> userIds, Role role);
}
@OnRegion(region = “Users”)
interface UserFunctions {
boolean grant(Set<Long> ids, Role role);
}
~=
How To Use Spring Data with Apache Geode
 Generate Spring Boot [SBDG] project at start.spring.io
 spring-geode-starter module (provided)
<dependencies>
<dependency>
<groupId>org.springframework.geode</groupId>
<artifactId>spring-geode-starter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Spring Boot Spring Data Spring Session Spring Test
Spring Session for Apache Geode <SSDG/>
 New Spring Profile to disable OQL Indexes created by SSDG
 “disable-spring-session-data-gemfire-indexes”
 Principle Name & Session Attributes Indexes
 HASH OQL Indexes changed to RANGE/FUNCTION OQL Indexes
 Marks identity field (id) of Session object when using PDX Serialization
How To Use Spring Session with Apache Geode
 Generate Spring Boot [SBDG] project at start.spring.io
 Include spring-geode-starter-session module
<dependencies>
<dependency>
<groupId>org.springframework.geode</groupId>
<artifactId>spring-geode-starter-session</artifactId>
</dependency>
</dependencies>
Spring Boot Spring Data Spring Session Spring Test
Spring Boot for Apache Geode <SBDG/>
 Asynchronous (Write-Behind) Inline Caching [doc]
 Cache Initialization, i.e. loading Data using JSON [doc]
 Support for gemfire.properties in Spring Boot
application.properties [doc]
Patterns of Caching
 Look-Aside Caching *
 Inline Caching
 Sync or Async
 Near Caching
 Multi-Site Caching
 Active-Active or Active-Passive
Patterns of Caching
 Look-Aside Caching *
 Inline Caching
 Sync or Async
 Near Caching
 Multi-Site Caching
 Active-Active or Active-Passive
Use Cases of Caching
 (HTTP) Session Caching
 Hibernate L2 Caching
 Etc.
Inline Caching
Inline Caching
CREATE/UPDATE
Cache Put
Write-Through [sync]
Write-Behind [async]
READ
Cache Get
Read-Through [sync]
.
.
.
.
.
.
.
.
.
.
.
.
Inline Caching
Write-Through [sync]
Write-Behind [async]
Read-Through [sync]
Inline Caching
CacheWriter
CacheLoader
Read-Through [sync]
Write-Through [sync]
Write-Behind [async]
Inline Caching
Write-Through [sync]
Write-Behind [async]
Read-Through [sync]
CacheLoaderAsyncEventListener
Inline Caching Applied
@Service
class UserService {
@Cacheable(“UsersByName”)
User findBy(String name) {
…
}
}
Synchronous (Read/Write-Through) Inline Caching
@Configuration
@EnableCachingDefinedRegions
class GeodeConfiguration {
@Bean
InlineCachingRegionConfigurer<User, Long> syncInlineCachingConfigurer(
UserRepository userRepository) {
return new InlineCachingRegionConfigurer(userRepository, “Users”);
}
}
Asynchronous (Write-Behind) Inline Caching
@Configuration
@EnableCachingDefinedRegions
class GeodeConfiguration {
@Bean
AsyncInlineCachingRegionConfigurer<User, Long> asyncInlineCachingConfigurer(
UserRepository userRepository) {
return AsyncInlineCachingRegionConfigurer.create(userRepository, “Users”)
.withQueueBatchConflationEnabled()
.withQueueBatchSize(50)
.withQueueBatchTimeInterval(Duration.ofSeconds(30))
}
} @Bean
RepositoryCacheLoaderRegionConfigurer<User, Long> syncInlineCachingConfigurer(
UserRepository userRepository) {
return new RepositoryCacheLoaderRegionConfigurer(userRepository, “Users”)
}
}
// Write-Behind
// Read-Through
gemfire.properties in application.properties
# Spring Boot application.properties
server.port=8181
spring.application.name=SpringGeodeApplication
gemfire.durable-client-id=123
gemfire.enable-time-statistics=${external-enable-stats:true}
spring.data.gemfire.cache.client.durable-client-id=987
https://docs.spring.io/spring-boot-data-geode-build/1.4.x/reference/html5/index.html#geode-configuration-
gemfire-properties
EXAMPLE
Cache Initialization
Spring Boot for Apache Geode <SBDG/>
 New Multi-Site Caching Example & Guide [doc / source]
 New Security Example & Guide [doc / source]
 Auto-configuration for TLS/SSL On-platform [doc]
 PCF/PCC  VMware Tanzu GemFire for VMs (BOSH)
 New Using Apache Geode with Docker chapter [doc]
 New Apache Geode API Extensions chapter [doc]
 New spring-geode-starter-logging module [doc]
 New spring-geode-bom module [Issue #93]
How To Use Spring Boot with Apache Geode
 Generate Spring Boot [SBDG] project at start.spring.io
 spring-geode-starter module (provided)
<dependencies>
<dependency>
<groupId>org.springframework.geode</groupId>
<artifactId>spring-geode-starter</artifactId>
</dependency>
</dependencies>
References
 Spring Data for Apache Geode (SDG) [ Project | Source | JIRA | PR ]
 Spring Test for Apache Geode (STDG) [ | Source | Issues | PR ]
 Spring Session for Apache Geode (SSDG) [ Project | Source | Issues | PR ]
 Spring Boot for Apache Geode (SBDG) [ | Source | Issues | PR ]
 StackOverflow
 Examples
Stay Connected.
A Deep Dive into Spring Application Events
By Oliver Drotbohm
Wed, Sept 2 @ 1:05 PM PDT
#springone@s1p
Safe Harbor Statement
ThefollowingisintendedtooutlinethegeneraldirectionofVMware'sofferings.Itisintendedforinformationpurposesonlyandmay notbeincorporated
intoanycontract. Anyinformationregardingpre-releaseofVMwareofferings,futureupdatesorotherplannedmodificationsis subjecttoongoing
evaluationbyVMwareandissubjecttochange.Thisinformationisprovidedwithoutwarrantyoranykind, expressorimplied, and isnotacommitmentto
deliveranymaterial,code,orfunctionality,and shouldnotberelieduponin makingpurchasingdecisionsregardingVMware's offerings.Thesepurchasing
decisionsshould onlybebasedon featurescurrentlyavailable. Thedevelopment,release,and timingofanyfeaturesorfunctionalitydescribedfor
VMware'sofferingsin thispresentationremainatthesolediscretionofPivotal. Pivotalhasnoobligationtoupdateforwardlookinginformationin this
presentation.
4
2

More Related Content

What's hot

Spring Boot & WebSocket
Spring Boot & WebSocketSpring Boot & WebSocket
Spring Boot & WebSocket
Ming-Ying Wu
 

What's hot (20)

JavaCro'14 - Building interactive web applications with Vaadin – Peter Lehto
JavaCro'14 - Building interactive web applications with Vaadin – Peter LehtoJavaCro'14 - Building interactive web applications with Vaadin – Peter Lehto
JavaCro'14 - Building interactive web applications with Vaadin – Peter Lehto
 
Dropwizard and Friends
Dropwizard and FriendsDropwizard and Friends
Dropwizard and Friends
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
 
Springboot Microservices
Springboot MicroservicesSpringboot Microservices
Springboot Microservices
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot Introduction
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Dropwizard Spring - the perfect Java REST server stack
Dropwizard Spring - the perfect Java REST server stackDropwizard Spring - the perfect Java REST server stack
Dropwizard Spring - the perfect Java REST server stack
 
Spring boot for buidling microservices
Spring boot for buidling microservicesSpring boot for buidling microservices
Spring boot for buidling microservices
 
Managing user's data with Spring Session
Managing user's data with Spring SessionManaging user's data with Spring Session
Managing user's data with Spring Session
 
Spring Boot & WebSocket
Spring Boot & WebSocketSpring Boot & WebSocket
Spring Boot & WebSocket
 
Spring Boot and Microservices
Spring Boot and MicroservicesSpring Boot and Microservices
Spring Boot and Microservices
 
Microservices/dropwizard
Microservices/dropwizardMicroservices/dropwizard
Microservices/dropwizard
 
Java REST API Framework Comparison - UberConf 2021
Java REST API Framework Comparison - UberConf 2021Java REST API Framework Comparison - UberConf 2021
Java REST API Framework Comparison - UberConf 2021
 
PUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBootPUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBoot
 
Design & Development of Web Applications using SpringMVC
Design & Development of Web Applications using SpringMVC Design & Development of Web Applications using SpringMVC
Design & Development of Web Applications using SpringMVC
 
Introduction to spring boot
Introduction to spring bootIntroduction to spring boot
Introduction to spring boot
 
Spring boot - an introduction
Spring boot - an introductionSpring boot - an introduction
Spring boot - an introduction
 
Spring4 whats up doc?
Spring4 whats up doc?Spring4 whats up doc?
Spring4 whats up doc?
 
How to customize Spring Boot?
How to customize Spring Boot?How to customize Spring Boot?
How to customize Spring Boot?
 
Microservices - java ee vs spring boot and spring cloud
Microservices - java ee vs spring boot and spring cloudMicroservices - java ee vs spring boot and spring cloud
Microservices - java ee vs spring boot and spring cloud
 

Similar to The Past Year in Spring for Apache Geode

Overview of Android Infrastructure
Overview of Android InfrastructureOverview of Android Infrastructure
Overview of Android Infrastructure
Alexey Buzdin
 
Overview of Android Infrastructure
Overview of Android InfrastructureOverview of Android Infrastructure
Overview of Android Infrastructure
C.T.Co
 
REST made simple with Java
REST made simple with JavaREST made simple with Java
REST made simple with Java
elliando dias
 

Similar to The Past Year in Spring for Apache Geode (20)

RESTEasy
RESTEasyRESTEasy
RESTEasy
 
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
 
May 2010 - RestEasy
May 2010 - RestEasyMay 2010 - RestEasy
May 2010 - RestEasy
 
Codemotion appengine
Codemotion appengineCodemotion appengine
Codemotion appengine
 
Spring boot
Spring boot Spring boot
Spring boot
 
Ejb3 Dan Hinojosa
Ejb3 Dan HinojosaEjb3 Dan Hinojosa
Ejb3 Dan Hinojosa
 
Overview of Android Infrastructure
Overview of Android InfrastructureOverview of Android Infrastructure
Overview of Android Infrastructure
 
Overview of Android Infrastructure
Overview of Android InfrastructureOverview of Android Infrastructure
Overview of Android Infrastructure
 
Annotation processing and code gen
Annotation processing and code genAnnotation processing and code gen
Annotation processing and code gen
 
DWR, Hibernate and Dojo.E - A Tutorial
DWR, Hibernate and Dojo.E - A TutorialDWR, Hibernate and Dojo.E - A Tutorial
DWR, Hibernate and Dojo.E - A Tutorial
 
Groovy - Grails as a modern scripting language for Web applications
Groovy - Grails as a modern scripting language for Web applicationsGroovy - Grails as a modern scripting language for Web applications
Groovy - Grails as a modern scripting language for Web applications
 
Android best practices
Android best practicesAndroid best practices
Android best practices
 
比XML更好用的Java Annotation
比XML更好用的Java Annotation比XML更好用的Java Annotation
比XML更好用的Java Annotation
 
Overview of RESTful web services
Overview of RESTful web servicesOverview of RESTful web services
Overview of RESTful web services
 
Dropwizard
DropwizardDropwizard
Dropwizard
 
GraphTour - Utilizing Powerful Extensions for Analytics & Operations
GraphTour - Utilizing Powerful Extensions for Analytics & OperationsGraphTour - Utilizing Powerful Extensions for Analytics & Operations
GraphTour - Utilizing Powerful Extensions for Analytics & Operations
 
Android and the Seven Dwarfs from Devox'15
Android and the Seven Dwarfs from Devox'15Android and the Seven Dwarfs from Devox'15
Android and the Seven Dwarfs from Devox'15
 
Neo4j GraphTour: Utilizing Powerful Extensions for Analytics and Operations
Neo4j GraphTour: Utilizing Powerful Extensions for Analytics and OperationsNeo4j GraphTour: Utilizing Powerful Extensions for Analytics and Operations
Neo4j GraphTour: Utilizing Powerful Extensions for Analytics and Operations
 
REST made simple with Java
REST made simple with JavaREST made simple with Java
REST made simple with Java
 
REST made simple with Java
REST made simple with JavaREST made simple with Java
REST made simple with Java
 

More from VMware Tanzu

More from VMware Tanzu (20)

What AI Means For Your Product Strategy And What To Do About It
What AI Means For Your Product Strategy And What To Do About ItWhat AI Means For Your Product Strategy And What To Do About It
What AI Means For Your Product Strategy And What To Do About It
 
Make the Right Thing the Obvious Thing at Cardinal Health 2023
Make the Right Thing the Obvious Thing at Cardinal Health 2023Make the Right Thing the Obvious Thing at Cardinal Health 2023
Make the Right Thing the Obvious Thing at Cardinal Health 2023
 
Enhancing DevEx and Simplifying Operations at Scale
Enhancing DevEx and Simplifying Operations at ScaleEnhancing DevEx and Simplifying Operations at Scale
Enhancing DevEx and Simplifying Operations at Scale
 
Spring Update | July 2023
Spring Update | July 2023Spring Update | July 2023
Spring Update | July 2023
 
Platforms, Platform Engineering, & Platform as a Product
Platforms, Platform Engineering, & Platform as a ProductPlatforms, Platform Engineering, & Platform as a Product
Platforms, Platform Engineering, & Platform as a Product
 
Building Cloud Ready Apps
Building Cloud Ready AppsBuilding Cloud Ready Apps
Building Cloud Ready Apps
 
Spring Boot 3 And Beyond
Spring Boot 3 And BeyondSpring Boot 3 And Beyond
Spring Boot 3 And Beyond
 
Spring Cloud Gateway - SpringOne Tour 2023 Charles Schwab.pdf
Spring Cloud Gateway - SpringOne Tour 2023 Charles Schwab.pdfSpring Cloud Gateway - SpringOne Tour 2023 Charles Schwab.pdf
Spring Cloud Gateway - SpringOne Tour 2023 Charles Schwab.pdf
 
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023Simplify and Scale Enterprise Apps in the Cloud | Boston 2023
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023
 
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023
 
tanzu_developer_connect.pptx
tanzu_developer_connect.pptxtanzu_developer_connect.pptx
tanzu_developer_connect.pptx
 
Tanzu Virtual Developer Connect Workshop - French
Tanzu Virtual Developer Connect Workshop - FrenchTanzu Virtual Developer Connect Workshop - French
Tanzu Virtual Developer Connect Workshop - French
 
Tanzu Developer Connect Workshop - English
Tanzu Developer Connect Workshop - EnglishTanzu Developer Connect Workshop - English
Tanzu Developer Connect Workshop - English
 
Virtual Developer Connect Workshop - English
Virtual Developer Connect Workshop - EnglishVirtual Developer Connect Workshop - English
Virtual Developer Connect Workshop - English
 
Tanzu Developer Connect - French
Tanzu Developer Connect - FrenchTanzu Developer Connect - French
Tanzu Developer Connect - French
 
Simplify and Scale Enterprise Apps in the Cloud | Dallas 2023
Simplify and Scale Enterprise Apps in the Cloud | Dallas 2023Simplify and Scale Enterprise Apps in the Cloud | Dallas 2023
Simplify and Scale Enterprise Apps in the Cloud | Dallas 2023
 
SpringOne Tour: Deliver 15-Factor Applications on Kubernetes with Spring Boot
SpringOne Tour: Deliver 15-Factor Applications on Kubernetes with Spring BootSpringOne Tour: Deliver 15-Factor Applications on Kubernetes with Spring Boot
SpringOne Tour: Deliver 15-Factor Applications on Kubernetes with Spring Boot
 
SpringOne Tour: The Influential Software Engineer
SpringOne Tour: The Influential Software EngineerSpringOne Tour: The Influential Software Engineer
SpringOne Tour: The Influential Software Engineer
 
SpringOne Tour: Domain-Driven Design: Theory vs Practice
SpringOne Tour: Domain-Driven Design: Theory vs PracticeSpringOne Tour: Domain-Driven Design: Theory vs Practice
SpringOne Tour: Domain-Driven Design: Theory vs Practice
 
SpringOne Tour: Spring Recipes: A Collection of Common-Sense Solutions
SpringOne Tour: Spring Recipes: A Collection of Common-Sense SolutionsSpringOne Tour: Spring Recipes: A Collection of Common-Sense Solutions
SpringOne Tour: Spring Recipes: A Collection of Common-Sense Solutions
 

Recently uploaded

%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 

Recently uploaded (20)

%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 

The Past Year in Spring for Apache Geode

  • 1. The Past Year in Spring for Apache Geode September 2–3, 2020 springone.io
  • 2. John Blum Lead… for (P project : Spring for Apache Geode) { manage(project); } @john_blum
  • 3. … Spring for Apache GeodeAll things… What things?
  • 4. Spring Boot Spring Data Spring Session Spring Test
  • 5. Spring Boot Spring Data Spring Session Spring Test
  • 6. Spring Boot Spring Data Spring Session Spring Test TDP (Test-Driven Presentation)
  • 7. Spring Test for Apache Geode <STDG/>  Fine-grained control over GemFire/Geode Mock Object Lifecycle [doc]  Mocking Unsupported Cache Operations [doc]  New @EnableGemFireResourceCollector [doc]
  • 8. GemFire/Geode Mock Object Lifecycle @EnableGemFireMockObjects(destroyOnEvents = { … }) class TestGeodeConfiguration { … } Any event class in package org.springframework.test.context.event  E.g. AfterTestMethodEvent  Defaults to AfterTestClassEvent
  • 9. EXAMPLE Mocking Unsupported Cache Operations & @EnableGemFireResourceCollector
  • 10. How To Use Spring Test with Apache Geode  Generate Spring Boot [SBDG] project at start.spring.io  Include spring-geode-starter-test module <dependencies> <dependency> <groupId>org.springframework.geode</groupId> <artifactId>spring-geode-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies>
  • 11. Spring Boot Spring Data Spring Session Spring Test
  • 12. Spring Data for Apache Geode <SDG/>  DATAGEODE-238 – spring-data-gemfire module  DATAGEODE-272 – TransactionListener event publishing  DATAGEODE-152 [Doc]  WIP: DATAGEODE-263 – Paging  WIP: DATAGEODE-262 – Projections  WIP: DATAGEODE-258 – Function Executions on Region from Repository
  • 13.
  • 14. Manual Transaction Event Publishing @Service class MyTransactionalService { @Autowired ApplicationEventPublisher publisher; @Transactional public void someTransactionalMethod() { try { // do transaction publisher.publish(new CommitEvent()); } catch (DataAccessException e) { publisher.publish(new RollbackEvent(e)); throw e; } } @Component class MyTransactionEventListeners { @TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT) public void onCommit(CommitEvent event) { // handle commit } @TransactionalEventListener(phase = TransactionPhase.AFTER_ROLLBACK) public void onRollback(RollbackEvent event) { // handle rollback } } https://spring.io/blog/2015/02/11/better-application-events-in-spring-framework-4-2 @Configuration @EnableGemfireCacheTransactions class GeodeConfiguration { }
  • 15. Auto Transaction Event Publishing @Service class MyTransactionalService { @Transactional public void someTransactionalMethod() { // do transaction } } @Component class MyTransactionEventListeners { @TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT) public void onCommit( TransactionApplicationEvent event) { // handle commit } @TransactionalEventListener(phase = TransactionPhase.AFTER_ROLLBACK) public void onRollback( TransactionApplicationEvent event) { // handle rollback } } https://docs.spring.io/spring-data/geode/docs/current/reference/html/#apis:auto-transaction-event-publishing @Configuration @EnableGemfireCacheTransactions( enableAutoTransactionEventPublishing = true) class GeodeConfiguration { }
  • 16. Projections, Paging & OnRegion Function Executions interface UserRepository extends CrudRepository<User, String> { // Projection (User -> UserView) UserView findByNameLike(String wildcardName, Sort orderBy); // Paging (Page number, Page size & Sort) List<User> findByNameLike(String wildcardName, Pageable pageRequest); Page<UserView> findByNameLike(String wildcardName, Pageable pageRequest); @Function boolean grant(Set<Long> userIds, Role role); } https://docs.spring.io/spring-data/data-commons/docs/current/reference/html/#repositories.paging-and-sorting @Region(“Users”) class User { @Id Long id; String name; Role role; LocalDateTime lastAccessTime; boolean active; } class UserView { String name; LocalDateTime lastAccessTime; }
  • 17. OnRegion Function Execution interface UserRepository extends CrudRepository<User, Long> { @Function boolean grant(Set<Long> userIds, Role role); } @OnRegion(region = “Users”) interface UserFunctions { boolean grant(Set<Long> ids, Role role); } ~=
  • 18. How To Use Spring Data with Apache Geode  Generate Spring Boot [SBDG] project at start.spring.io  spring-geode-starter module (provided) <dependencies> <dependency> <groupId>org.springframework.geode</groupId> <artifactId>spring-geode-starter</artifactId> <scope>test</scope> </dependency> </dependencies>
  • 19. Spring Boot Spring Data Spring Session Spring Test
  • 20. Spring Session for Apache Geode <SSDG/>  New Spring Profile to disable OQL Indexes created by SSDG  “disable-spring-session-data-gemfire-indexes”  Principle Name & Session Attributes Indexes  HASH OQL Indexes changed to RANGE/FUNCTION OQL Indexes  Marks identity field (id) of Session object when using PDX Serialization
  • 21. How To Use Spring Session with Apache Geode  Generate Spring Boot [SBDG] project at start.spring.io  Include spring-geode-starter-session module <dependencies> <dependency> <groupId>org.springframework.geode</groupId> <artifactId>spring-geode-starter-session</artifactId> </dependency> </dependencies>
  • 22. Spring Boot Spring Data Spring Session Spring Test
  • 23. Spring Boot for Apache Geode <SBDG/>  Asynchronous (Write-Behind) Inline Caching [doc]  Cache Initialization, i.e. loading Data using JSON [doc]  Support for gemfire.properties in Spring Boot application.properties [doc]
  • 24. Patterns of Caching  Look-Aside Caching *  Inline Caching  Sync or Async  Near Caching  Multi-Site Caching  Active-Active or Active-Passive
  • 25. Patterns of Caching  Look-Aside Caching *  Inline Caching  Sync or Async  Near Caching  Multi-Site Caching  Active-Active or Active-Passive Use Cases of Caching  (HTTP) Session Caching  Hibernate L2 Caching  Etc. Inline Caching
  • 26. Inline Caching CREATE/UPDATE Cache Put Write-Through [sync] Write-Behind [async] READ Cache Get Read-Through [sync] . . . . . . . . . . . .
  • 29. Inline Caching Write-Through [sync] Write-Behind [async] Read-Through [sync] CacheLoaderAsyncEventListener
  • 30. Inline Caching Applied @Service class UserService { @Cacheable(“UsersByName”) User findBy(String name) { … } }
  • 31. Synchronous (Read/Write-Through) Inline Caching @Configuration @EnableCachingDefinedRegions class GeodeConfiguration { @Bean InlineCachingRegionConfigurer<User, Long> syncInlineCachingConfigurer( UserRepository userRepository) { return new InlineCachingRegionConfigurer(userRepository, “Users”); } }
  • 32. Asynchronous (Write-Behind) Inline Caching @Configuration @EnableCachingDefinedRegions class GeodeConfiguration { @Bean AsyncInlineCachingRegionConfigurer<User, Long> asyncInlineCachingConfigurer( UserRepository userRepository) { return AsyncInlineCachingRegionConfigurer.create(userRepository, “Users”) .withQueueBatchConflationEnabled() .withQueueBatchSize(50) .withQueueBatchTimeInterval(Duration.ofSeconds(30)) } } @Bean RepositoryCacheLoaderRegionConfigurer<User, Long> syncInlineCachingConfigurer( UserRepository userRepository) { return new RepositoryCacheLoaderRegionConfigurer(userRepository, “Users”) } } // Write-Behind // Read-Through
  • 33. gemfire.properties in application.properties # Spring Boot application.properties server.port=8181 spring.application.name=SpringGeodeApplication gemfire.durable-client-id=123 gemfire.enable-time-statistics=${external-enable-stats:true} spring.data.gemfire.cache.client.durable-client-id=987 https://docs.spring.io/spring-boot-data-geode-build/1.4.x/reference/html5/index.html#geode-configuration- gemfire-properties
  • 35. Spring Boot for Apache Geode <SBDG/>  New Multi-Site Caching Example & Guide [doc / source]  New Security Example & Guide [doc / source]  Auto-configuration for TLS/SSL On-platform [doc]  PCF/PCC  VMware Tanzu GemFire for VMs (BOSH)  New Using Apache Geode with Docker chapter [doc]  New Apache Geode API Extensions chapter [doc]  New spring-geode-starter-logging module [doc]  New spring-geode-bom module [Issue #93]
  • 36. How To Use Spring Boot with Apache Geode  Generate Spring Boot [SBDG] project at start.spring.io  spring-geode-starter module (provided) <dependencies> <dependency> <groupId>org.springframework.geode</groupId> <artifactId>spring-geode-starter</artifactId> </dependency> </dependencies>
  • 37. References  Spring Data for Apache Geode (SDG) [ Project | Source | JIRA | PR ]  Spring Test for Apache Geode (STDG) [ | Source | Issues | PR ]  Spring Session for Apache Geode (SSDG) [ Project | Source | Issues | PR ]  Spring Boot for Apache Geode (SBDG) [ | Source | Issues | PR ]  StackOverflow  Examples
  • 38. Stay Connected. A Deep Dive into Spring Application Events By Oliver Drotbohm Wed, Sept 2 @ 1:05 PM PDT #springone@s1p
  • 39.
  • 40. Safe Harbor Statement ThefollowingisintendedtooutlinethegeneraldirectionofVMware'sofferings.Itisintendedforinformationpurposesonlyandmay notbeincorporated intoanycontract. Anyinformationregardingpre-releaseofVMwareofferings,futureupdatesorotherplannedmodificationsis subjecttoongoing evaluationbyVMwareandissubjecttochange.Thisinformationisprovidedwithoutwarrantyoranykind, expressorimplied, and isnotacommitmentto deliveranymaterial,code,orfunctionality,and shouldnotberelieduponin makingpurchasingdecisionsregardingVMware's offerings.Thesepurchasing decisionsshould onlybebasedon featurescurrentlyavailable. Thedevelopment,release,and timingofanyfeaturesorfunctionalitydescribedfor VMware'sofferingsin thispresentationremainatthesolediscretionofPivotal. Pivotalhasnoobligationtoupdateforwardlookinginformationin this presentation. 4 2

Editor's Notes

  1. I am a member of the Spring Data Team and My responsibilities lie at the intersection of all things Spring for Apache Geode here at VMware. We will be covering a lot of content during this session and moving really fast in a short amount of time (25 minutes). I assume you know the basic Spring and Apache Geode concepts.
  2. All Things… Spring for Apache Geode
  3. STDG
  4. Example of Mocking Unsupported Cache/Region Operations & @EnableGemFireResourceCollector
  5. SDG
  6. SELECT entry.key FROM /Users.entries entry WHERE name LIKE ‘%doe’ ORDER BY entry.value.lastAccessTime DESC Execute OQL Query in Function for PARTITION Region usersRegions.getAll(keys);
  7. Perform basic CRUD, simple (OQL) Queries and Function Executions all conveniently from the Repository OnRegion vs. [OnServer(s) | OnMember(s)]
  8. SSDG
  9. SBDG
  10. GemFire/Geode Properties must be prefixed with “gemfire.” Property precedence… last definition wins! Warns user for invalid & unset properties Use with Spring Profiles
  11. Cache Initialization – loading Data using JSON