SlideShare a Scribd company logo
1 of 31
Download to read offline
Powering Your Application with XAP
(Using payment processing as an example)
“Don’t call me cache”
Dotan Horovits
Director, Customer Services
Senior solutions architect
About me
Dotan Horovits
Director, Customer Services
Senior system and solutions architect
technology evangelist with interest in many things
• distributed high-performance systems
• big data solutions
• cloud technologies
• And of course: agile software methodologies
• And much more…
dotan@gigaspaces.com
horovits.wordpress.com
@horovits
Short Intro to Caching Evolution
Cache
In process caching
of Key->Value data
structure
Distribute Cache
Partitioned cache
nodes
IMDG
Partitioned system
of record
In Memory
Application Platform
Collocated IMDG and
Processing
Cache
Cache is good for repetitive data reads
But it is limited in capacity
It also doesn’t handle write-heavy scenarios
Short Intro to Caching Evolution
Cache
In process caching
of Key->Value data
structure
Distribute Cache
Partitioned cache
nodes
IMDG
Partitioned system
of record
In Memory
Application Platform
Collocated IMDG and
Processing
Distribute Cache
Allows you to distribute your cache over numerous machines so you get
Increased Capacity
But it doesn’t support write heavy scenarios
It’s also Limited to query by Id
What about the rest of your app? - Business logic & messaging??
Short Intro to Caching Evolution
Cache
In process caching
of Key->Value data
structure
Distribute Cache
Partitioned cache
nodes
IMDG
Partitioned system
of record
In Memory
Application Platform
Collocated IMDG and
Processing
IMDG solves these problems!
You get increased capacity
IMDG is also a System of Record with:
Query APIs
Optimized data access
Data integrity
It solves your write scalability problem
.
Short Intro to Caching Evolution
Cache
In process caching
of Key->Value data
structure
Distribute Cache
Partitioned cache
nodes
IMDG
Partitioned system
of record
In Memory
Application Platform
Collocated IMDG and
Processing
In Memory Application Platform
XAP for end to end scaling
Its an IMDG that hosts your Business
logic & has messaging services!
It Provides Parallel processing of data
You get linear scalability
You get high availability
How does XAP work?
Here’s What a Payment Authorization Process Looks Like
Payment
Authorization
Request
Basic Validation User Profile Check
Merchant
Profile Check
Payment
Authorization
Approved
Write the Payment Object to XAP
Cash Register
Application Payment
User payment Cluster
@SpaceId()
public Long getId() {
return id;
}
@SpaceRouting
public Long getUserId() {
return userId;
}
}
@SpaceIndex
public Long getCardId() {
return cardId;
}
}
The primary key of this object in the grid
The grid will use this attribute to route
the object to a particular partition
Payment object
A secondary index for query optimization
Write the Payment Object to XAP
Cash Register
Application
User payment Cluster
Payment
@SpaceId
public Long getId() {
return id;
}
@SpaceRouting
public Long getUserId() {
return userId;
}
@SpaceIndex
public Long getCardId() {
return cardId;
}
The primary key of this object in the grid
The grid will use this attribute to route
the object to a particular partition
Payment object
A Secondary index for query optimization
Write the Payment Object to XAP
Cash Register
Application
User payment Cluster
Payment
Index
@SpaceId
public Long getId() {
return id;
}
@SpaceRouting
public Long getUserId() {
return userId;
}
@SpaceIndex
public Long getCardId() {
return cardId;
}
The primary key of this object in the grid
The grid will use this attribute to route
the object to a particular partition
Payment object
A Secondary index for query optimization
Let's Talk About Data Model for a Second
User Id (Routing)| User Name|…
Card Id| Card Data | UserID (Routing)…
Transaction ID | CardId | User ID (Routing)…
1  *
1  *
Data Model
Let's Get Back to the Process
Payment Validation
@EventTemplate
public SQLQuery<Payment> getNewPayment()
{
SQLQuery<Payment> query = new SQLQuery<Payment>(Payment.class," paymentStatus = ? ");
query.setParameter(1, Payment.PaymentStatus.New);
return query;
}
Queue
Payment
Validator
Payment Validation
@SpaceDataEvent
public Payment validatePayment(Payment payment)
{
…
}
private boolean basicPaymentValidation(Payment payment, User user, Card card)
{
…
}
Queue
Payment
Class PaymentAuthorization{
Status status;
Boolean userCheck;
Boolean vendorCheck;
}
Validator
Payment Authorization
Basic Validation
if (basicPaymentValidation(payment,user,card)) {
gigaSpace.write(userPaymentMsg);
gigaSpace.write(vendorPaymentMsg);
gigaSpace.write(paymentAuthorization);
payment.setPaymentStatus(Payment.PaymentStatus.Processing);
} else {
payment.setPaymentStatus(Payment.PaymentStatus.SuspectedFraud);
}
Class PaymentAuthorization {
Status status;
Boolean userCheck;
Boolean vendorCheck;
}
User
Validation
Vendor
Validation
Payment
Authorization
Queue
Queue
Queue Validator
User Validation
Class PaymentAuthorization{
Enum Status
Boolean userCheck
Boolean vendorCheck
}
Read
Message
Process
Queue
UserCreditCardPayment
Querying
@SpaceDataEvent
public void validateUser(UserPaymentMsg event) {
…
space.readMultiple(new Card(userId))
space.readMultiple(new Payment(userId))
if (valid()) {
IdQuery<PaymentAutjorzation> idQuery = new
IdQuery<PaymentAuthorization>(PaymentAuthoirzation.class, paymentId);
space.change(idQuery, new ChangeSet().set(“userCheck", true));
} else { ... }
}
User Validation
Read
Message
Process
Queue
UserCreditCardPayment
Class PaymentAuthorization {
Status status;
Boolean userCheck;
Boolean vendorCheck;
}
Querying
@SpaceDataEvent
public void validateUser(UserPaymentMsg event) {
…
space.readMultiple(new Card(userId))
space.readMultiple(new Payment(userId))
if (valid()) {
IdQuery<PaymentAutjorzation> idQuery = new
IdQuery<PaymentAuthorization>(PaymentAuthoirzation.class, paymentId);
space.change(idQuery, new ChangeSet().set(“userCheck", true));
} else { ... }
}
User Validation
Read
Message
Process
Queue
UserCreditCardPayment
@SpaceDataEvent
public void validateUser(UserPaymentMsg event) {
…
space.readMultiple(new Card(userId))
space.readMultiple(new Payment(userId))
if (valid()) {
IdQuery<PaymentAutjorzation> idQuery = new
IdQuery<PaymentAuthorization>(PaymentAuthorization.class, paymentId);
space.change(idQuery, new ChangeSet().set(“userCheck", true));
} else { ... }
}
Class PaymentAuthorization {
Status status;
Boolean userCheck;
Boolean vendorCheck;
}
Querying
Vendor Validation
@SpaceDataEvent
public void validateVendor(VendorPaymentMsg vendorPaymentMsg) {
AsyncFuture<Boolean> future = vendorGigaSpace.execute(
new VendorValidationTask(vendorPaymentMsg),
vendorPaymentMsg.getMerchant());
IdQuery<PaymentAuthorization> idQuery = new
IdQuery<PaymentAuthorization>(PaymentAuthorization.class,
vendorPaymentMsg.getPaymentId());
if (future.get()) gigaSpace.change(idQuery, new ChangeSet().
set("vendorCheck", true));
else gigaSpace.change(idQuery, new ChangeSet().
set("vendorCheck”, false));
}
Read
Message
Process
Queue
Task
class PaymentAuthoirzation {
Status status;
Boolean userCheck;
Boolean vendorCheck;
}
Vendor Validation
@SpaceDataEvent
public void processVendorPaymentValidation() {
AsyncFuture<Boolean> result= space.execute(
new DistributedTask(new VendorValidationTask(Payment)))
if (result.get()) {
IdQuery<PaymentAutjorzation> idQuery = new
IdQuery<PaymentAuthorization>(PaymentAuthorization.class,
paymentId);
space.change(idQuery, new ChangeSet().set(“vendorCheck”, true));
} else { ... }
}
Payment Cluster
Task
Vendor Cluster
Class PaymentAuthorization {
Status status;
Boolean userCheck;
Boolean vendorCheck;
}
Vendor Validation
public void validateVendor(VendorPaymentMsg vendorPaymentMsg,
GigaSpace gigaSpace) {
AsyncFuture<Boolean> future = vendorGigaSpace.execute(new
VendorValidationTask(vendorPaymentMsg),
vendorPaymentMsg.getMerchant());
IdQuery<PaymentAuthorization> idQuery = new
IdQuery<PaymentAuthorization>(PaymentAuthorization.class,
vendorPaymentMsg.getPaymentId());
if (future.get()) gigaSpace.change(idQuery, new
ChangeSet().set("vendorCheck", true));
else gigaSpace.change(idQuery, new ChangeSet().set("vendorCheck", false));
}
Payment Cluster Vendor Cluster
Task
Class PaymentAuthorization {
Status status;
Boolean userCheck;
Boolean vendorCheck;
}
Vendor Validation
Payment Cluster Vendor Cluster
Task
public void validateVendor(VendorPaymentMsg vendorPaymentMsg,
GigaSpace gigaSpace) {
AsyncFuture<Boolean> future = vendorGigaSpace.execute(new
VendorValidationTask(vendorPaymentMsg),
vendorPaymentMsg.getMerchant());
IdQuery<PaymentAuthorization> idQuery = new
IdQuery<PaymentAuthorization>(PaymentAuthorization.class,
vendorPaymentMsg.getPaymentId());
if (future.get()) gigaSpace.change(idQuery, new
ChangeSet().set("vendorCheck", true));
else gigaSpace.change(idQuery, new ChangeSet().set("vendorCheck", false));
}
Class PaymentAuthorization {
Status status;
Boolean userCheck;
Boolean vendorCheck;
}
Vendor Validation Check
@Override
public Boolean execute() throws Exception {
return validatePayment(vendorPaymentMsg);
}
Task
DealsMerchant
Class PaymentAuthorization {
Status status;
Boolean userCheck;
Boolean vendorCheck;
}
Querying
Vendor Validation Check
Task
DealsMerchant
@Override
public Boolean execute() throws Exception {
return validatePayment(vendorPaymentMsg);
}
Class PaymentAuthorization {
Status status;
Boolean userCheck;
Boolean vendorCheck;
}
Querying
Vendor Validation
Payment Cluster Vendor Cluster
Callback Task
public void validateVendor(VendorPaymentMsg vendorPaymentMsg,
GigaSpace gigaSpace) {
AsyncFuture<Boolean> future = vendorGigaSpace.execute(new
VendorValidationTask(vendorPaymentMsg),
vendorPaymentMsg.getMerchant());
IdQuery<PaymentAuthorization> idQuery = new
IdQuery<PaymentAuthorization>(PaymentAuthorization.class,
vendorPaymentMsg.getPaymentId());
if (future.get()) gigaSpace.change(idQuery, new
ChangeSet().set("vendorCheck", true));
else gigaSpace.change(idQuery, new ChangeSet().set("vendorCheck", false));
}
Class PaymentAuthorization {
Status status;
Boolean userCheck;
Boolean vendorCheck;
}
Yey! Payment Has Been Authorized
@EventTemplate
public PaymentAuthorization getNewPayment() {
return new PaymentAuthorization(null, true, true, PaymentAuthorizationStatus.New);
}
Queue
Payment
Authorization
Yey! Payment Has Been Authorized
@SpaceDataEvent
public void completePaymentValidation(PaymentAuthorization paymentAuthorization) {
Payment payment = gigaSpace.readById(Payment.class,paymentAuthorization.getPaymentId());
payment.setPaymentStatus(Payment.PaymentStatus.Closed);
gigaSpace.write(payment);
paymentAuthorization.setPaymentAuthorizationStatus(
PaymentAuthorization.PaymentAuthorizationStatus.Done);
}
Queue
Payment
Authorization
What’s next?
• Multi-site deployment?
• Persistence to DB for auditing?
• Using Scala? .NET? scripts?
• Schema evolution?
• Running our clusters on the cloud?
• Etc.
Q&A
Source code (Java) publically available on GitHub:
https://github.com/Gigaspaces/fraud-detection-example
Thank you!
Dotan Horovits
dotan@gigaspaces.com
horovits.wordpress.com
@horovits

More Related Content

Viewers also liked

ASAS 2015 Darren Harris
ASAS 2015 Darren HarrisASAS 2015 Darren Harris
ASAS 2015 Darren HarrisAvisi B.V.
 
ASAS 2013 - There's no architecture, only business
ASAS 2013 - There's no architecture, only businessASAS 2013 - There's no architecture, only business
ASAS 2013 - There's no architecture, only businessAvisi B.V.
 
ASAS 2013 - Architecture for dynamic mobile forms at MoreApps
ASAS 2013 - Architecture for dynamic mobile forms at MoreApps ASAS 2013 - Architecture for dynamic mobile forms at MoreApps
ASAS 2013 - Architecture for dynamic mobile forms at MoreApps Avisi B.V.
 
What's new in Android M
What's new in Android MWhat's new in Android M
What's new in Android MKirill Rozov
 
ASAS 2013- Building a culture of lean innovation
ASAS 2013- Building a culture of lean innovationASAS 2013- Building a culture of lean innovation
ASAS 2013- Building a culture of lean innovationAvisi B.V.
 
ASAS 2013 - Agility and the essence of software architecture
ASAS 2013 - Agility and the essence of software architectureASAS 2013 - Agility and the essence of software architecture
ASAS 2013 - Agility and the essence of software architectureAvisi B.V.
 
Android Data Binding
Android Data BindingAndroid Data Binding
Android Data BindingKirill Rozov
 
Advance Java-Network Programming
Advance Java-Network ProgrammingAdvance Java-Network Programming
Advance Java-Network Programmingashok hirpara
 
ASAS 2013 - Space-based architecture: Linear scalability? High throughput? Lo...
ASAS 2013 - Space-based architecture: Linear scalability? High throughput? Lo...ASAS 2013 - Space-based architecture: Linear scalability? High throughput? Lo...
ASAS 2013 - Space-based architecture: Linear scalability? High throughput? Lo...Avisi B.V.
 
Gradle Introduction
Gradle IntroductionGradle Introduction
Gradle IntroductionKirill Rozov
 
Kotlin для Android
Kotlin для AndroidKotlin для Android
Kotlin для AndroidKirill Rozov
 
ASAS 2014 - Sander Hoogendoorn
ASAS 2014 - Sander HoogendoornASAS 2014 - Sander Hoogendoorn
ASAS 2014 - Sander HoogendoornAvisi B.V.
 

Viewers also liked (19)

ASAS 2015 Darren Harris
ASAS 2015 Darren HarrisASAS 2015 Darren Harris
ASAS 2015 Darren Harris
 
ASAS 2013 - There's no architecture, only business
ASAS 2013 - There's no architecture, only businessASAS 2013 - There's no architecture, only business
ASAS 2013 - There's no architecture, only business
 
ASAS 2013 - Architecture for dynamic mobile forms at MoreApps
ASAS 2013 - Architecture for dynamic mobile forms at MoreApps ASAS 2013 - Architecture for dynamic mobile forms at MoreApps
ASAS 2013 - Architecture for dynamic mobile forms at MoreApps
 
20100918 android cache
20100918 android cache20100918 android cache
20100918 android cache
 
What's new in Android M
What's new in Android MWhat's new in Android M
What's new in Android M
 
ASAS 2013- Building a culture of lean innovation
ASAS 2013- Building a culture of lean innovationASAS 2013- Building a culture of lean innovation
ASAS 2013- Building a culture of lean innovation
 
ASAS 2013 - Agility and the essence of software architecture
ASAS 2013 - Agility and the essence of software architectureASAS 2013 - Agility and the essence of software architecture
ASAS 2013 - Agility and the essence of software architecture
 
Android Data Binding
Android Data BindingAndroid Data Binding
Android Data Binding
 
Advance Java-Network Programming
Advance Java-Network ProgrammingAdvance Java-Network Programming
Advance Java-Network Programming
 
ASAS 2013 - Space-based architecture: Linear scalability? High throughput? Lo...
ASAS 2013 - Space-based architecture: Linear scalability? High throughput? Lo...ASAS 2013 - Space-based architecture: Linear scalability? High throughput? Lo...
ASAS 2013 - Space-based architecture: Linear scalability? High throughput? Lo...
 
REST
RESTREST
REST
 
Gradle Introduction
Gradle IntroductionGradle Introduction
Gradle Introduction
 
Kotlin для Android
Kotlin для AndroidKotlin для Android
Kotlin для Android
 
Wrapper class
Wrapper classWrapper class
Wrapper class
 
Effective Java
Effective JavaEffective Java
Effective Java
 
ASAS 2014 - Sander Hoogendoorn
ASAS 2014 - Sander HoogendoornASAS 2014 - Sander Hoogendoorn
ASAS 2014 - Sander Hoogendoorn
 
JPA Best Practices
JPA Best PracticesJPA Best Practices
JPA Best Practices
 
Dagger 2
Dagger 2Dagger 2
Dagger 2
 
JSON and REST
JSON and RESTJSON and REST
JSON and REST
 

Similar to Dont call me cache java version

[WSO2Con Asia 2018] Patterns for Building Streaming Apps
[WSO2Con Asia 2018] Patterns for Building Streaming Apps[WSO2Con Asia 2018] Patterns for Building Streaming Apps
[WSO2Con Asia 2018] Patterns for Building Streaming AppsWSO2
 
Domain-Driven Design with SeedStack
Domain-Driven Design with SeedStackDomain-Driven Design with SeedStack
Domain-Driven Design with SeedStackSeedStack
 
Dependency injection - the right way
Dependency injection - the right wayDependency injection - the right way
Dependency injection - the right wayThibaud Desodt
 
MongoDB.local Sydney: Evolving your Data Access with MongoDB Stitch
MongoDB.local Sydney: Evolving your Data Access with MongoDB StitchMongoDB.local Sydney: Evolving your Data Access with MongoDB Stitch
MongoDB.local Sydney: Evolving your Data Access with MongoDB StitchMongoDB
 
Java/Scala Lab: Борис Трофимов - Обжигающая Big Data.
Java/Scala Lab: Борис Трофимов - Обжигающая Big Data.Java/Scala Lab: Борис Трофимов - Обжигающая Big Data.
Java/Scala Lab: Борис Трофимов - Обжигающая Big Data.GeeksLab Odessa
 
[WSO2Con EU 2017] Streaming Analytics Patterns for Your Digital Enterprise
[WSO2Con EU 2017] Streaming Analytics Patterns for Your Digital Enterprise[WSO2Con EU 2017] Streaming Analytics Patterns for Your Digital Enterprise
[WSO2Con EU 2017] Streaming Analytics Patterns for Your Digital EnterpriseWSO2
 
LJC Conference 2014 Cassandra for Java Developers
LJC Conference 2014 Cassandra for Java DevelopersLJC Conference 2014 Cassandra for Java Developers
LJC Conference 2014 Cassandra for Java DevelopersChristopher Batey
 
HTML5 Gaming Payment Platforms
HTML5 Gaming Payment PlatformsHTML5 Gaming Payment Platforms
HTML5 Gaming Payment PlatformsJonathan LeBlanc
 
Dublin Ireland Spark Meetup October 15, 2015
Dublin Ireland Spark Meetup October 15, 2015Dublin Ireland Spark Meetup October 15, 2015
Dublin Ireland Spark Meetup October 15, 2015eddiebaggott
 
Jasigsakai12 columbia-customizes-cas
Jasigsakai12 columbia-customizes-casJasigsakai12 columbia-customizes-cas
Jasigsakai12 columbia-customizes-casellentuck
 
MongoDB.local Atlanta: Introduction to Serverless MongoDB
MongoDB.local Atlanta: Introduction to Serverless MongoDBMongoDB.local Atlanta: Introduction to Serverless MongoDB
MongoDB.local Atlanta: Introduction to Serverless MongoDBMongoDB
 
Evolving your Data Access with MongoDB Stitch
Evolving your Data Access with MongoDB StitchEvolving your Data Access with MongoDB Stitch
Evolving your Data Access with MongoDB StitchMongoDB
 
GraphQL Summit 2019 - Configuration Driven Data as a Service Gateway with Gra...
GraphQL Summit 2019 - Configuration Driven Data as a Service Gateway with Gra...GraphQL Summit 2019 - Configuration Driven Data as a Service Gateway with Gra...
GraphQL Summit 2019 - Configuration Driven Data as a Service Gateway with Gra...Noriaki Tatsumi
 
2012 SVCodeCamp: In App Payments with HTML5
2012 SVCodeCamp: In App Payments with HTML52012 SVCodeCamp: In App Payments with HTML5
2012 SVCodeCamp: In App Payments with HTML5Jonathan LeBlanc
 
Introduction to Domain driven design (LaravelBA #5)
Introduction to Domain driven design (LaravelBA #5)Introduction to Domain driven design (LaravelBA #5)
Introduction to Domain driven design (LaravelBA #5)guiwoda
 
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...Dan Wahlin
 
Relevance trilogy may dream be with you! (dec17)
Relevance trilogy  may dream be with you! (dec17)Relevance trilogy  may dream be with you! (dec17)
Relevance trilogy may dream be with you! (dec17)Woonsan Ko
 

Similar to Dont call me cache java version (20)

[WSO2Con Asia 2018] Patterns for Building Streaming Apps
[WSO2Con Asia 2018] Patterns for Building Streaming Apps[WSO2Con Asia 2018] Patterns for Building Streaming Apps
[WSO2Con Asia 2018] Patterns for Building Streaming Apps
 
CDI @javaonehyderabad
CDI @javaonehyderabadCDI @javaonehyderabad
CDI @javaonehyderabad
 
Domain-Driven Design with SeedStack
Domain-Driven Design with SeedStackDomain-Driven Design with SeedStack
Domain-Driven Design with SeedStack
 
Dependency injection - the right way
Dependency injection - the right wayDependency injection - the right way
Dependency injection - the right way
 
Siddhi - cloud-native stream processor
Siddhi - cloud-native stream processorSiddhi - cloud-native stream processor
Siddhi - cloud-native stream processor
 
MongoDB.local Sydney: Evolving your Data Access with MongoDB Stitch
MongoDB.local Sydney: Evolving your Data Access with MongoDB StitchMongoDB.local Sydney: Evolving your Data Access with MongoDB Stitch
MongoDB.local Sydney: Evolving your Data Access with MongoDB Stitch
 
Java/Scala Lab: Борис Трофимов - Обжигающая Big Data.
Java/Scala Lab: Борис Трофимов - Обжигающая Big Data.Java/Scala Lab: Борис Трофимов - Обжигающая Big Data.
Java/Scala Lab: Борис Трофимов - Обжигающая Big Data.
 
[WSO2Con EU 2017] Streaming Analytics Patterns for Your Digital Enterprise
[WSO2Con EU 2017] Streaming Analytics Patterns for Your Digital Enterprise[WSO2Con EU 2017] Streaming Analytics Patterns for Your Digital Enterprise
[WSO2Con EU 2017] Streaming Analytics Patterns for Your Digital Enterprise
 
Domain Driven Design 101
Domain Driven Design 101Domain Driven Design 101
Domain Driven Design 101
 
LJC Conference 2014 Cassandra for Java Developers
LJC Conference 2014 Cassandra for Java DevelopersLJC Conference 2014 Cassandra for Java Developers
LJC Conference 2014 Cassandra for Java Developers
 
HTML5 Gaming Payment Platforms
HTML5 Gaming Payment PlatformsHTML5 Gaming Payment Platforms
HTML5 Gaming Payment Platforms
 
Dublin Ireland Spark Meetup October 15, 2015
Dublin Ireland Spark Meetup October 15, 2015Dublin Ireland Spark Meetup October 15, 2015
Dublin Ireland Spark Meetup October 15, 2015
 
Jasigsakai12 columbia-customizes-cas
Jasigsakai12 columbia-customizes-casJasigsakai12 columbia-customizes-cas
Jasigsakai12 columbia-customizes-cas
 
MongoDB.local Atlanta: Introduction to Serverless MongoDB
MongoDB.local Atlanta: Introduction to Serverless MongoDBMongoDB.local Atlanta: Introduction to Serverless MongoDB
MongoDB.local Atlanta: Introduction to Serverless MongoDB
 
Evolving your Data Access with MongoDB Stitch
Evolving your Data Access with MongoDB StitchEvolving your Data Access with MongoDB Stitch
Evolving your Data Access with MongoDB Stitch
 
GraphQL Summit 2019 - Configuration Driven Data as a Service Gateway with Gra...
GraphQL Summit 2019 - Configuration Driven Data as a Service Gateway with Gra...GraphQL Summit 2019 - Configuration Driven Data as a Service Gateway with Gra...
GraphQL Summit 2019 - Configuration Driven Data as a Service Gateway with Gra...
 
2012 SVCodeCamp: In App Payments with HTML5
2012 SVCodeCamp: In App Payments with HTML52012 SVCodeCamp: In App Payments with HTML5
2012 SVCodeCamp: In App Payments with HTML5
 
Introduction to Domain driven design (LaravelBA #5)
Introduction to Domain driven design (LaravelBA #5)Introduction to Domain driven design (LaravelBA #5)
Introduction to Domain driven design (LaravelBA #5)
 
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
 
Relevance trilogy may dream be with you! (dec17)
Relevance trilogy  may dream be with you! (dec17)Relevance trilogy  may dream be with you! (dec17)
Relevance trilogy may dream be with you! (dec17)
 

More from Avisi B.V.

Scaling Your Team and Technology: The Agile Way - Erik Duindam
Scaling Your Team and Technology: The Agile Way - Erik DuindamScaling Your Team and Technology: The Agile Way - Erik Duindam
Scaling Your Team and Technology: The Agile Way - Erik DuindamAvisi B.V.
 
Bigger product is better - Viktor Grgric
Bigger product is better  - Viktor GrgricBigger product is better  - Viktor Grgric
Bigger product is better - Viktor GrgricAvisi B.V.
 
Product development insights - Robin van Breukelen
Product development insights - Robin van BreukelenProduct development insights - Robin van Breukelen
Product development insights - Robin van BreukelenAvisi B.V.
 
Software design patterns and lessons learned from nature - Jaromil
Software design patterns and lessons learned from nature - JaromilSoftware design patterns and lessons learned from nature - Jaromil
Software design patterns and lessons learned from nature - JaromilAvisi B.V.
 
Content must be creative - Jon Westenberg
Content must be creative - Jon WestenbergContent must be creative - Jon Westenberg
Content must be creative - Jon WestenbergAvisi B.V.
 
Does your design smell - Tushar Sharma
Does your design smell  - Tushar SharmaDoes your design smell  - Tushar Sharma
Does your design smell - Tushar SharmaAvisi B.V.
 
How to become a Product Samurai - Chris Lukassen
How to become a Product Samurai - Chris LukassenHow to become a Product Samurai - Chris Lukassen
How to become a Product Samurai - Chris LukassenAvisi B.V.
 
ASAS 2015 Gert Florijn & Eelco Rommes
ASAS 2015 Gert Florijn & Eelco RommesASAS 2015 Gert Florijn & Eelco Rommes
ASAS 2015 Gert Florijn & Eelco RommesAvisi B.V.
 
ASAS 2015 - Benito de Miranda
ASAS 2015 - Benito de MirandaASAS 2015 - Benito de Miranda
ASAS 2015 - Benito de MirandaAvisi B.V.
 
ASAS 2015 Stanimira Jelezova
ASAS 2015 Stanimira JelezovaASAS 2015 Stanimira Jelezova
ASAS 2015 Stanimira JelezovaAvisi B.V.
 
ASAS 2015 Regina Chien
ASAS 2015 Regina ChienASAS 2015 Regina Chien
ASAS 2015 Regina ChienAvisi B.V.
 
ASAS 2015 Henk Kolk
ASAS 2015 Henk KolkASAS 2015 Henk Kolk
ASAS 2015 Henk KolkAvisi B.V.
 
ASAS 2015 Chris Lukassen
ASAS 2015 Chris LukassenASAS 2015 Chris Lukassen
ASAS 2015 Chris LukassenAvisi B.V.
 
ASAS 2015 Chris Lukassen
ASAS 2015 Chris LukassenASAS 2015 Chris Lukassen
ASAS 2015 Chris LukassenAvisi B.V.
 
Keynote ASAS 2015 Ted Neward
Keynote ASAS 2015 Ted NewardKeynote ASAS 2015 Ted Neward
Keynote ASAS 2015 Ted NewardAvisi B.V.
 
ASAS 2015 Robin van Breukelen
ASAS 2015 Robin van BreukelenASAS 2015 Robin van Breukelen
ASAS 2015 Robin van BreukelenAvisi B.V.
 
ASAS 2015 - Kasia Mrowca
ASAS 2015 - Kasia MrowcaASAS 2015 - Kasia Mrowca
ASAS 2015 - Kasia MrowcaAvisi B.V.
 
ASAS 2015 - Norberto Leite
ASAS 2015 - Norberto LeiteASAS 2015 - Norberto Leite
ASAS 2015 - Norberto LeiteAvisi B.V.
 
ASAS 2015 - Maarten van den Heuvel
ASAS 2015 - Maarten van den HeuvelASAS 2015 - Maarten van den Heuvel
ASAS 2015 - Maarten van den HeuvelAvisi B.V.
 
Keynote ASAS 2015 - Viktor Grgic
Keynote ASAS 2015 - Viktor Grgic  Keynote ASAS 2015 - Viktor Grgic
Keynote ASAS 2015 - Viktor Grgic Avisi B.V.
 

More from Avisi B.V. (20)

Scaling Your Team and Technology: The Agile Way - Erik Duindam
Scaling Your Team and Technology: The Agile Way - Erik DuindamScaling Your Team and Technology: The Agile Way - Erik Duindam
Scaling Your Team and Technology: The Agile Way - Erik Duindam
 
Bigger product is better - Viktor Grgric
Bigger product is better  - Viktor GrgricBigger product is better  - Viktor Grgric
Bigger product is better - Viktor Grgric
 
Product development insights - Robin van Breukelen
Product development insights - Robin van BreukelenProduct development insights - Robin van Breukelen
Product development insights - Robin van Breukelen
 
Software design patterns and lessons learned from nature - Jaromil
Software design patterns and lessons learned from nature - JaromilSoftware design patterns and lessons learned from nature - Jaromil
Software design patterns and lessons learned from nature - Jaromil
 
Content must be creative - Jon Westenberg
Content must be creative - Jon WestenbergContent must be creative - Jon Westenberg
Content must be creative - Jon Westenberg
 
Does your design smell - Tushar Sharma
Does your design smell  - Tushar SharmaDoes your design smell  - Tushar Sharma
Does your design smell - Tushar Sharma
 
How to become a Product Samurai - Chris Lukassen
How to become a Product Samurai - Chris LukassenHow to become a Product Samurai - Chris Lukassen
How to become a Product Samurai - Chris Lukassen
 
ASAS 2015 Gert Florijn & Eelco Rommes
ASAS 2015 Gert Florijn & Eelco RommesASAS 2015 Gert Florijn & Eelco Rommes
ASAS 2015 Gert Florijn & Eelco Rommes
 
ASAS 2015 - Benito de Miranda
ASAS 2015 - Benito de MirandaASAS 2015 - Benito de Miranda
ASAS 2015 - Benito de Miranda
 
ASAS 2015 Stanimira Jelezova
ASAS 2015 Stanimira JelezovaASAS 2015 Stanimira Jelezova
ASAS 2015 Stanimira Jelezova
 
ASAS 2015 Regina Chien
ASAS 2015 Regina ChienASAS 2015 Regina Chien
ASAS 2015 Regina Chien
 
ASAS 2015 Henk Kolk
ASAS 2015 Henk KolkASAS 2015 Henk Kolk
ASAS 2015 Henk Kolk
 
ASAS 2015 Chris Lukassen
ASAS 2015 Chris LukassenASAS 2015 Chris Lukassen
ASAS 2015 Chris Lukassen
 
ASAS 2015 Chris Lukassen
ASAS 2015 Chris LukassenASAS 2015 Chris Lukassen
ASAS 2015 Chris Lukassen
 
Keynote ASAS 2015 Ted Neward
Keynote ASAS 2015 Ted NewardKeynote ASAS 2015 Ted Neward
Keynote ASAS 2015 Ted Neward
 
ASAS 2015 Robin van Breukelen
ASAS 2015 Robin van BreukelenASAS 2015 Robin van Breukelen
ASAS 2015 Robin van Breukelen
 
ASAS 2015 - Kasia Mrowca
ASAS 2015 - Kasia MrowcaASAS 2015 - Kasia Mrowca
ASAS 2015 - Kasia Mrowca
 
ASAS 2015 - Norberto Leite
ASAS 2015 - Norberto LeiteASAS 2015 - Norberto Leite
ASAS 2015 - Norberto Leite
 
ASAS 2015 - Maarten van den Heuvel
ASAS 2015 - Maarten van den HeuvelASAS 2015 - Maarten van den Heuvel
ASAS 2015 - Maarten van den Heuvel
 
Keynote ASAS 2015 - Viktor Grgic
Keynote ASAS 2015 - Viktor Grgic  Keynote ASAS 2015 - Viktor Grgic
Keynote ASAS 2015 - Viktor Grgic
 

Recently uploaded

The Economic History of the U.S. Lecture 19.pdf
The Economic History of the U.S. Lecture 19.pdfThe Economic History of the U.S. Lecture 19.pdf
The Economic History of the U.S. Lecture 19.pdfGale Pooley
 
VIP Call Girls LB Nagar ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With Room...
VIP Call Girls LB Nagar ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With Room...VIP Call Girls LB Nagar ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With Room...
VIP Call Girls LB Nagar ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With Room...Suhani Kapoor
 
Solution Manual for Financial Accounting, 11th Edition by Robert Libby, Patri...
Solution Manual for Financial Accounting, 11th Edition by Robert Libby, Patri...Solution Manual for Financial Accounting, 11th Edition by Robert Libby, Patri...
Solution Manual for Financial Accounting, 11th Edition by Robert Libby, Patri...ssifa0344
 
Malad Call Girl in Services 9892124323 | ₹,4500 With Room Free Delivery
Malad Call Girl in Services  9892124323 | ₹,4500 With Room Free DeliveryMalad Call Girl in Services  9892124323 | ₹,4500 With Room Free Delivery
Malad Call Girl in Services 9892124323 | ₹,4500 With Room Free DeliveryPooja Nehwal
 
The Economic History of the U.S. Lecture 18.pdf
The Economic History of the U.S. Lecture 18.pdfThe Economic History of the U.S. Lecture 18.pdf
The Economic History of the U.S. Lecture 18.pdfGale Pooley
 
Instant Issue Debit Cards - School Designs
Instant Issue Debit Cards - School DesignsInstant Issue Debit Cards - School Designs
Instant Issue Debit Cards - School Designsegoetzinger
 
20240417-Calibre-April-2024-Investor-Presentation.pdf
20240417-Calibre-April-2024-Investor-Presentation.pdf20240417-Calibre-April-2024-Investor-Presentation.pdf
20240417-Calibre-April-2024-Investor-Presentation.pdfAdnet Communications
 
The Economic History of the U.S. Lecture 20.pdf
The Economic History of the U.S. Lecture 20.pdfThe Economic History of the U.S. Lecture 20.pdf
The Economic History of the U.S. Lecture 20.pdfGale Pooley
 
05_Annelore Lenoir_Docbyte_MeetupDora&Cybersecurity.pptx
05_Annelore Lenoir_Docbyte_MeetupDora&Cybersecurity.pptx05_Annelore Lenoir_Docbyte_MeetupDora&Cybersecurity.pptx
05_Annelore Lenoir_Docbyte_MeetupDora&Cybersecurity.pptxFinTech Belgium
 
03_Emmanuel Ndiaye_Degroof Petercam.pptx
03_Emmanuel Ndiaye_Degroof Petercam.pptx03_Emmanuel Ndiaye_Degroof Petercam.pptx
03_Emmanuel Ndiaye_Degroof Petercam.pptxFinTech Belgium
 
Dharavi Russian callg Girls, { 09892124323 } || Call Girl In Mumbai ...
Dharavi Russian callg Girls, { 09892124323 } || Call Girl In Mumbai ...Dharavi Russian callg Girls, { 09892124323 } || Call Girl In Mumbai ...
Dharavi Russian callg Girls, { 09892124323 } || Call Girl In Mumbai ...Pooja Nehwal
 
Independent Lucknow Call Girls 8923113531WhatsApp Lucknow Call Girls make you...
Independent Lucknow Call Girls 8923113531WhatsApp Lucknow Call Girls make you...Independent Lucknow Call Girls 8923113531WhatsApp Lucknow Call Girls make you...
Independent Lucknow Call Girls 8923113531WhatsApp Lucknow Call Girls make you...makika9823
 
VIP Call Girls Service Dilsukhnagar Hyderabad Call +91-8250192130
VIP Call Girls Service Dilsukhnagar Hyderabad Call +91-8250192130VIP Call Girls Service Dilsukhnagar Hyderabad Call +91-8250192130
VIP Call Girls Service Dilsukhnagar Hyderabad Call +91-8250192130Suhani Kapoor
 
Dividend Policy and Dividend Decision Theories.pptx
Dividend Policy and Dividend Decision Theories.pptxDividend Policy and Dividend Decision Theories.pptx
Dividend Policy and Dividend Decision Theories.pptxanshikagoel52
 
Booking open Available Pune Call Girls Shivane 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Shivane  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Shivane  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Shivane 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
VVIP Pune Call Girls Katraj (7001035870) Pune Escorts Nearby with Complete Sa...
VVIP Pune Call Girls Katraj (7001035870) Pune Escorts Nearby with Complete Sa...VVIP Pune Call Girls Katraj (7001035870) Pune Escorts Nearby with Complete Sa...
VVIP Pune Call Girls Katraj (7001035870) Pune Escorts Nearby with Complete Sa...Call Girls in Nagpur High Profile
 
Lundin Gold April 2024 Corporate Presentation v4.pdf
Lundin Gold April 2024 Corporate Presentation v4.pdfLundin Gold April 2024 Corporate Presentation v4.pdf
Lundin Gold April 2024 Corporate Presentation v4.pdfAdnet Communications
 
Quarter 4- Module 3 Principles of Marketing
Quarter 4- Module 3 Principles of MarketingQuarter 4- Module 3 Principles of Marketing
Quarter 4- Module 3 Principles of MarketingMaristelaRamos12
 
VIP Kolkata Call Girl Jodhpur Park 👉 8250192130 Available With Room
VIP Kolkata Call Girl Jodhpur Park 👉 8250192130  Available With RoomVIP Kolkata Call Girl Jodhpur Park 👉 8250192130  Available With Room
VIP Kolkata Call Girl Jodhpur Park 👉 8250192130 Available With Roomdivyansh0kumar0
 

Recently uploaded (20)

The Economic History of the U.S. Lecture 19.pdf
The Economic History of the U.S. Lecture 19.pdfThe Economic History of the U.S. Lecture 19.pdf
The Economic History of the U.S. Lecture 19.pdf
 
VIP Call Girls LB Nagar ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With Room...
VIP Call Girls LB Nagar ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With Room...VIP Call Girls LB Nagar ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With Room...
VIP Call Girls LB Nagar ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With Room...
 
Solution Manual for Financial Accounting, 11th Edition by Robert Libby, Patri...
Solution Manual for Financial Accounting, 11th Edition by Robert Libby, Patri...Solution Manual for Financial Accounting, 11th Edition by Robert Libby, Patri...
Solution Manual for Financial Accounting, 11th Edition by Robert Libby, Patri...
 
Malad Call Girl in Services 9892124323 | ₹,4500 With Room Free Delivery
Malad Call Girl in Services  9892124323 | ₹,4500 With Room Free DeliveryMalad Call Girl in Services  9892124323 | ₹,4500 With Room Free Delivery
Malad Call Girl in Services 9892124323 | ₹,4500 With Room Free Delivery
 
The Economic History of the U.S. Lecture 18.pdf
The Economic History of the U.S. Lecture 18.pdfThe Economic History of the U.S. Lecture 18.pdf
The Economic History of the U.S. Lecture 18.pdf
 
Instant Issue Debit Cards - School Designs
Instant Issue Debit Cards - School DesignsInstant Issue Debit Cards - School Designs
Instant Issue Debit Cards - School Designs
 
20240417-Calibre-April-2024-Investor-Presentation.pdf
20240417-Calibre-April-2024-Investor-Presentation.pdf20240417-Calibre-April-2024-Investor-Presentation.pdf
20240417-Calibre-April-2024-Investor-Presentation.pdf
 
The Economic History of the U.S. Lecture 20.pdf
The Economic History of the U.S. Lecture 20.pdfThe Economic History of the U.S. Lecture 20.pdf
The Economic History of the U.S. Lecture 20.pdf
 
05_Annelore Lenoir_Docbyte_MeetupDora&Cybersecurity.pptx
05_Annelore Lenoir_Docbyte_MeetupDora&Cybersecurity.pptx05_Annelore Lenoir_Docbyte_MeetupDora&Cybersecurity.pptx
05_Annelore Lenoir_Docbyte_MeetupDora&Cybersecurity.pptx
 
03_Emmanuel Ndiaye_Degroof Petercam.pptx
03_Emmanuel Ndiaye_Degroof Petercam.pptx03_Emmanuel Ndiaye_Degroof Petercam.pptx
03_Emmanuel Ndiaye_Degroof Petercam.pptx
 
Dharavi Russian callg Girls, { 09892124323 } || Call Girl In Mumbai ...
Dharavi Russian callg Girls, { 09892124323 } || Call Girl In Mumbai ...Dharavi Russian callg Girls, { 09892124323 } || Call Girl In Mumbai ...
Dharavi Russian callg Girls, { 09892124323 } || Call Girl In Mumbai ...
 
Independent Lucknow Call Girls 8923113531WhatsApp Lucknow Call Girls make you...
Independent Lucknow Call Girls 8923113531WhatsApp Lucknow Call Girls make you...Independent Lucknow Call Girls 8923113531WhatsApp Lucknow Call Girls make you...
Independent Lucknow Call Girls 8923113531WhatsApp Lucknow Call Girls make you...
 
VIP Call Girls Service Dilsukhnagar Hyderabad Call +91-8250192130
VIP Call Girls Service Dilsukhnagar Hyderabad Call +91-8250192130VIP Call Girls Service Dilsukhnagar Hyderabad Call +91-8250192130
VIP Call Girls Service Dilsukhnagar Hyderabad Call +91-8250192130
 
Dividend Policy and Dividend Decision Theories.pptx
Dividend Policy and Dividend Decision Theories.pptxDividend Policy and Dividend Decision Theories.pptx
Dividend Policy and Dividend Decision Theories.pptx
 
Booking open Available Pune Call Girls Shivane 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Shivane  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Shivane  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Shivane 6297143586 Call Hot Indian Gi...
 
VVIP Pune Call Girls Katraj (7001035870) Pune Escorts Nearby with Complete Sa...
VVIP Pune Call Girls Katraj (7001035870) Pune Escorts Nearby with Complete Sa...VVIP Pune Call Girls Katraj (7001035870) Pune Escorts Nearby with Complete Sa...
VVIP Pune Call Girls Katraj (7001035870) Pune Escorts Nearby with Complete Sa...
 
Lundin Gold April 2024 Corporate Presentation v4.pdf
Lundin Gold April 2024 Corporate Presentation v4.pdfLundin Gold April 2024 Corporate Presentation v4.pdf
Lundin Gold April 2024 Corporate Presentation v4.pdf
 
Quarter 4- Module 3 Principles of Marketing
Quarter 4- Module 3 Principles of MarketingQuarter 4- Module 3 Principles of Marketing
Quarter 4- Module 3 Principles of Marketing
 
VIP Kolkata Call Girl Jodhpur Park 👉 8250192130 Available With Room
VIP Kolkata Call Girl Jodhpur Park 👉 8250192130  Available With RoomVIP Kolkata Call Girl Jodhpur Park 👉 8250192130  Available With Room
VIP Kolkata Call Girl Jodhpur Park 👉 8250192130 Available With Room
 
Veritas Interim Report 1 January–31 March 2024
Veritas Interim Report 1 January–31 March 2024Veritas Interim Report 1 January–31 March 2024
Veritas Interim Report 1 January–31 March 2024
 

Dont call me cache java version

  • 1. Powering Your Application with XAP (Using payment processing as an example) “Don’t call me cache” Dotan Horovits Director, Customer Services Senior solutions architect
  • 2. About me Dotan Horovits Director, Customer Services Senior system and solutions architect technology evangelist with interest in many things • distributed high-performance systems • big data solutions • cloud technologies • And of course: agile software methodologies • And much more… dotan@gigaspaces.com horovits.wordpress.com @horovits
  • 3. Short Intro to Caching Evolution Cache In process caching of Key->Value data structure Distribute Cache Partitioned cache nodes IMDG Partitioned system of record In Memory Application Platform Collocated IMDG and Processing Cache Cache is good for repetitive data reads But it is limited in capacity It also doesn’t handle write-heavy scenarios
  • 4. Short Intro to Caching Evolution Cache In process caching of Key->Value data structure Distribute Cache Partitioned cache nodes IMDG Partitioned system of record In Memory Application Platform Collocated IMDG and Processing Distribute Cache Allows you to distribute your cache over numerous machines so you get Increased Capacity But it doesn’t support write heavy scenarios It’s also Limited to query by Id What about the rest of your app? - Business logic & messaging??
  • 5. Short Intro to Caching Evolution Cache In process caching of Key->Value data structure Distribute Cache Partitioned cache nodes IMDG Partitioned system of record In Memory Application Platform Collocated IMDG and Processing IMDG solves these problems! You get increased capacity IMDG is also a System of Record with: Query APIs Optimized data access Data integrity It solves your write scalability problem .
  • 6. Short Intro to Caching Evolution Cache In process caching of Key->Value data structure Distribute Cache Partitioned cache nodes IMDG Partitioned system of record In Memory Application Platform Collocated IMDG and Processing In Memory Application Platform XAP for end to end scaling Its an IMDG that hosts your Business logic & has messaging services! It Provides Parallel processing of data You get linear scalability You get high availability How does XAP work?
  • 7. Here’s What a Payment Authorization Process Looks Like Payment Authorization Request Basic Validation User Profile Check Merchant Profile Check Payment Authorization Approved
  • 8. Write the Payment Object to XAP Cash Register Application Payment User payment Cluster @SpaceId() public Long getId() { return id; } @SpaceRouting public Long getUserId() { return userId; } } @SpaceIndex public Long getCardId() { return cardId; } } The primary key of this object in the grid The grid will use this attribute to route the object to a particular partition Payment object A secondary index for query optimization
  • 9. Write the Payment Object to XAP Cash Register Application User payment Cluster Payment @SpaceId public Long getId() { return id; } @SpaceRouting public Long getUserId() { return userId; } @SpaceIndex public Long getCardId() { return cardId; } The primary key of this object in the grid The grid will use this attribute to route the object to a particular partition Payment object A Secondary index for query optimization
  • 10. Write the Payment Object to XAP Cash Register Application User payment Cluster Payment Index @SpaceId public Long getId() { return id; } @SpaceRouting public Long getUserId() { return userId; } @SpaceIndex public Long getCardId() { return cardId; } The primary key of this object in the grid The grid will use this attribute to route the object to a particular partition Payment object A Secondary index for query optimization
  • 11. Let's Talk About Data Model for a Second
  • 12. User Id (Routing)| User Name|… Card Id| Card Data | UserID (Routing)… Transaction ID | CardId | User ID (Routing)… 1  * 1  * Data Model
  • 13. Let's Get Back to the Process
  • 14. Payment Validation @EventTemplate public SQLQuery<Payment> getNewPayment() { SQLQuery<Payment> query = new SQLQuery<Payment>(Payment.class," paymentStatus = ? "); query.setParameter(1, Payment.PaymentStatus.New); return query; } Queue Payment Validator
  • 15. Payment Validation @SpaceDataEvent public Payment validatePayment(Payment payment) { … } private boolean basicPaymentValidation(Payment payment, User user, Card card) { … } Queue Payment Class PaymentAuthorization{ Status status; Boolean userCheck; Boolean vendorCheck; } Validator Payment Authorization
  • 16. Basic Validation if (basicPaymentValidation(payment,user,card)) { gigaSpace.write(userPaymentMsg); gigaSpace.write(vendorPaymentMsg); gigaSpace.write(paymentAuthorization); payment.setPaymentStatus(Payment.PaymentStatus.Processing); } else { payment.setPaymentStatus(Payment.PaymentStatus.SuspectedFraud); } Class PaymentAuthorization { Status status; Boolean userCheck; Boolean vendorCheck; } User Validation Vendor Validation Payment Authorization Queue Queue Queue Validator
  • 17. User Validation Class PaymentAuthorization{ Enum Status Boolean userCheck Boolean vendorCheck } Read Message Process Queue UserCreditCardPayment Querying @SpaceDataEvent public void validateUser(UserPaymentMsg event) { … space.readMultiple(new Card(userId)) space.readMultiple(new Payment(userId)) if (valid()) { IdQuery<PaymentAutjorzation> idQuery = new IdQuery<PaymentAuthorization>(PaymentAuthoirzation.class, paymentId); space.change(idQuery, new ChangeSet().set(“userCheck", true)); } else { ... } }
  • 18. User Validation Read Message Process Queue UserCreditCardPayment Class PaymentAuthorization { Status status; Boolean userCheck; Boolean vendorCheck; } Querying @SpaceDataEvent public void validateUser(UserPaymentMsg event) { … space.readMultiple(new Card(userId)) space.readMultiple(new Payment(userId)) if (valid()) { IdQuery<PaymentAutjorzation> idQuery = new IdQuery<PaymentAuthorization>(PaymentAuthoirzation.class, paymentId); space.change(idQuery, new ChangeSet().set(“userCheck", true)); } else { ... } }
  • 19. User Validation Read Message Process Queue UserCreditCardPayment @SpaceDataEvent public void validateUser(UserPaymentMsg event) { … space.readMultiple(new Card(userId)) space.readMultiple(new Payment(userId)) if (valid()) { IdQuery<PaymentAutjorzation> idQuery = new IdQuery<PaymentAuthorization>(PaymentAuthorization.class, paymentId); space.change(idQuery, new ChangeSet().set(“userCheck", true)); } else { ... } } Class PaymentAuthorization { Status status; Boolean userCheck; Boolean vendorCheck; } Querying
  • 20. Vendor Validation @SpaceDataEvent public void validateVendor(VendorPaymentMsg vendorPaymentMsg) { AsyncFuture<Boolean> future = vendorGigaSpace.execute( new VendorValidationTask(vendorPaymentMsg), vendorPaymentMsg.getMerchant()); IdQuery<PaymentAuthorization> idQuery = new IdQuery<PaymentAuthorization>(PaymentAuthorization.class, vendorPaymentMsg.getPaymentId()); if (future.get()) gigaSpace.change(idQuery, new ChangeSet(). set("vendorCheck", true)); else gigaSpace.change(idQuery, new ChangeSet(). set("vendorCheck”, false)); } Read Message Process Queue Task class PaymentAuthoirzation { Status status; Boolean userCheck; Boolean vendorCheck; }
  • 21. Vendor Validation @SpaceDataEvent public void processVendorPaymentValidation() { AsyncFuture<Boolean> result= space.execute( new DistributedTask(new VendorValidationTask(Payment))) if (result.get()) { IdQuery<PaymentAutjorzation> idQuery = new IdQuery<PaymentAuthorization>(PaymentAuthorization.class, paymentId); space.change(idQuery, new ChangeSet().set(“vendorCheck”, true)); } else { ... } } Payment Cluster Task Vendor Cluster Class PaymentAuthorization { Status status; Boolean userCheck; Boolean vendorCheck; }
  • 22. Vendor Validation public void validateVendor(VendorPaymentMsg vendorPaymentMsg, GigaSpace gigaSpace) { AsyncFuture<Boolean> future = vendorGigaSpace.execute(new VendorValidationTask(vendorPaymentMsg), vendorPaymentMsg.getMerchant()); IdQuery<PaymentAuthorization> idQuery = new IdQuery<PaymentAuthorization>(PaymentAuthorization.class, vendorPaymentMsg.getPaymentId()); if (future.get()) gigaSpace.change(idQuery, new ChangeSet().set("vendorCheck", true)); else gigaSpace.change(idQuery, new ChangeSet().set("vendorCheck", false)); } Payment Cluster Vendor Cluster Task Class PaymentAuthorization { Status status; Boolean userCheck; Boolean vendorCheck; }
  • 23. Vendor Validation Payment Cluster Vendor Cluster Task public void validateVendor(VendorPaymentMsg vendorPaymentMsg, GigaSpace gigaSpace) { AsyncFuture<Boolean> future = vendorGigaSpace.execute(new VendorValidationTask(vendorPaymentMsg), vendorPaymentMsg.getMerchant()); IdQuery<PaymentAuthorization> idQuery = new IdQuery<PaymentAuthorization>(PaymentAuthorization.class, vendorPaymentMsg.getPaymentId()); if (future.get()) gigaSpace.change(idQuery, new ChangeSet().set("vendorCheck", true)); else gigaSpace.change(idQuery, new ChangeSet().set("vendorCheck", false)); } Class PaymentAuthorization { Status status; Boolean userCheck; Boolean vendorCheck; }
  • 24. Vendor Validation Check @Override public Boolean execute() throws Exception { return validatePayment(vendorPaymentMsg); } Task DealsMerchant Class PaymentAuthorization { Status status; Boolean userCheck; Boolean vendorCheck; } Querying
  • 25. Vendor Validation Check Task DealsMerchant @Override public Boolean execute() throws Exception { return validatePayment(vendorPaymentMsg); } Class PaymentAuthorization { Status status; Boolean userCheck; Boolean vendorCheck; } Querying
  • 26. Vendor Validation Payment Cluster Vendor Cluster Callback Task public void validateVendor(VendorPaymentMsg vendorPaymentMsg, GigaSpace gigaSpace) { AsyncFuture<Boolean> future = vendorGigaSpace.execute(new VendorValidationTask(vendorPaymentMsg), vendorPaymentMsg.getMerchant()); IdQuery<PaymentAuthorization> idQuery = new IdQuery<PaymentAuthorization>(PaymentAuthorization.class, vendorPaymentMsg.getPaymentId()); if (future.get()) gigaSpace.change(idQuery, new ChangeSet().set("vendorCheck", true)); else gigaSpace.change(idQuery, new ChangeSet().set("vendorCheck", false)); } Class PaymentAuthorization { Status status; Boolean userCheck; Boolean vendorCheck; }
  • 27. Yey! Payment Has Been Authorized @EventTemplate public PaymentAuthorization getNewPayment() { return new PaymentAuthorization(null, true, true, PaymentAuthorizationStatus.New); } Queue Payment Authorization
  • 28. Yey! Payment Has Been Authorized @SpaceDataEvent public void completePaymentValidation(PaymentAuthorization paymentAuthorization) { Payment payment = gigaSpace.readById(Payment.class,paymentAuthorization.getPaymentId()); payment.setPaymentStatus(Payment.PaymentStatus.Closed); gigaSpace.write(payment); paymentAuthorization.setPaymentAuthorizationStatus( PaymentAuthorization.PaymentAuthorizationStatus.Done); } Queue Payment Authorization
  • 29. What’s next? • Multi-site deployment? • Persistence to DB for auditing? • Using Scala? .NET? scripts? • Schema evolution? • Running our clusters on the cloud? • Etc.
  • 30. Q&A Source code (Java) publically available on GitHub: https://github.com/Gigaspaces/fraud-detection-example