SlideShare uma empresa Scribd logo
1 de 29
Powering Your Application with XAP
(Using payment processing as an example)
“Don’t call me cache”
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
Single
threaded
handler
Template
“queues” events
for the handler
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
Q&A
THANK YOU!
Get the code from Github

Mais conteúdo relacionado

Destaque

SSDs, IMDGs and All the Rest - Jax London
SSDs, IMDGs and All the Rest - Jax LondonSSDs, IMDGs and All the Rest - Jax London
SSDs, IMDGs and All the Rest - Jax LondonUri Cohen
 
Hadoop and Cassandra at Rackspace
Hadoop and Cassandra at RackspaceHadoop and Cassandra at Rackspace
Hadoop and Cassandra at RackspaceStu Hood
 
Cassandra @Formspring
Cassandra @FormspringCassandra @Formspring
Cassandra @Formspringmartincozzi
 
SAPUI5 & OpenUI5 for SAP InnoJam
SAPUI5 & OpenUI5 for SAP InnoJamSAPUI5 & OpenUI5 for SAP InnoJam
SAPUI5 & OpenUI5 for SAP InnoJamDenise Nepraunig
 
What Every Developer Should Know About Database Scalability
What Every Developer Should Know About Database ScalabilityWhat Every Developer Should Know About Database Scalability
What Every Developer Should Know About Database Scalabilityjbellis
 
From 100s to 100s of Millions
From 100s to 100s of MillionsFrom 100s to 100s of Millions
From 100s to 100s of MillionsErik Onnen
 
From APM to Full Stack with Blue Medora [FutureStack16]
From APM to Full Stack with Blue Medora [FutureStack16]From APM to Full Stack with Blue Medora [FutureStack16]
From APM to Full Stack with Blue Medora [FutureStack16]New Relic
 
GigaSpaces - Getting Ready For The Cloud
GigaSpaces - Getting Ready For The CloudGigaSpaces - Getting Ready For The Cloud
GigaSpaces - Getting Ready For The Cloudgigaspaces
 
Cassandra by example - the path of read and write requests
Cassandra by example - the path of read and write requestsCassandra by example - the path of read and write requests
Cassandra by example - the path of read and write requestsgrro
 
Digital Data Tips Tuesday #1 - Tag Management: Simo Ahava - NetBooster
Digital Data Tips Tuesday #1 - Tag Management: Simo Ahava - NetBoosterDigital Data Tips Tuesday #1 - Tag Management: Simo Ahava - NetBooster
Digital Data Tips Tuesday #1 - Tag Management: Simo Ahava - NetBoosterWebanalisten .nl
 
Manchester city
Manchester cityManchester city
Manchester cityofrancis
 
Google's Avinash Kaushik on Web Analytics
Google's Avinash Kaushik on Web AnalyticsGoogle's Avinash Kaushik on Web Analytics
Google's Avinash Kaushik on Web AnalyticsLennart Svanberg
 
Migrating Netflix from Datacenter Oracle to Global Cassandra
Migrating Netflix from Datacenter Oracle to Global CassandraMigrating Netflix from Datacenter Oracle to Global Cassandra
Migrating Netflix from Datacenter Oracle to Global CassandraAdrian Cockcroft
 
Advanced data modeling with apache cassandra
Advanced data modeling with apache cassandraAdvanced data modeling with apache cassandra
Advanced data modeling with apache cassandraPatrick McFadin
 
BI, Reporting and Analytics on Apache Cassandra
BI, Reporting and Analytics on Apache CassandraBI, Reporting and Analytics on Apache Cassandra
BI, Reporting and Analytics on Apache CassandraVictor Coustenoble
 

Destaque (20)

SSDs, IMDGs and All the Rest - Jax London
SSDs, IMDGs and All the Rest - Jax LondonSSDs, IMDGs and All the Rest - Jax London
SSDs, IMDGs and All the Rest - Jax London
 
Namenindex Memori Boeck - Cornelis Pieter Sorgdrager
Namenindex Memori Boeck - Cornelis Pieter SorgdragerNamenindex Memori Boeck - Cornelis Pieter Sorgdrager
Namenindex Memori Boeck - Cornelis Pieter Sorgdrager
 
Hadoop and Cassandra at Rackspace
Hadoop and Cassandra at RackspaceHadoop and Cassandra at Rackspace
Hadoop and Cassandra at Rackspace
 
Cassandra @Formspring
Cassandra @FormspringCassandra @Formspring
Cassandra @Formspring
 
Jeff jonas big data new physics
Jeff jonas big data new physicsJeff jonas big data new physics
Jeff jonas big data new physics
 
SAPUI5 & OpenUI5 for SAP InnoJam
SAPUI5 & OpenUI5 for SAP InnoJamSAPUI5 & OpenUI5 for SAP InnoJam
SAPUI5 & OpenUI5 for SAP InnoJam
 
What Every Developer Should Know About Database Scalability
What Every Developer Should Know About Database ScalabilityWhat Every Developer Should Know About Database Scalability
What Every Developer Should Know About Database Scalability
 
From 100s to 100s of Millions
From 100s to 100s of MillionsFrom 100s to 100s of Millions
From 100s to 100s of Millions
 
From APM to Full Stack with Blue Medora [FutureStack16]
From APM to Full Stack with Blue Medora [FutureStack16]From APM to Full Stack with Blue Medora [FutureStack16]
From APM to Full Stack with Blue Medora [FutureStack16]
 
Shamanism
ShamanismShamanism
Shamanism
 
GigaSpaces - Getting Ready For The Cloud
GigaSpaces - Getting Ready For The CloudGigaSpaces - Getting Ready For The Cloud
GigaSpaces - Getting Ready For The Cloud
 
Cassandra by example - the path of read and write requests
Cassandra by example - the path of read and write requestsCassandra by example - the path of read and write requests
Cassandra by example - the path of read and write requests
 
Machine Learning
Machine LearningMachine Learning
Machine Learning
 
Digital Data Tips Tuesday #1 - Tag Management: Simo Ahava - NetBooster
Digital Data Tips Tuesday #1 - Tag Management: Simo Ahava - NetBoosterDigital Data Tips Tuesday #1 - Tag Management: Simo Ahava - NetBooster
Digital Data Tips Tuesday #1 - Tag Management: Simo Ahava - NetBooster
 
Growth Hacking
Growth Hacking Growth Hacking
Growth Hacking
 
Manchester city
Manchester cityManchester city
Manchester city
 
Google's Avinash Kaushik on Web Analytics
Google's Avinash Kaushik on Web AnalyticsGoogle's Avinash Kaushik on Web Analytics
Google's Avinash Kaushik on Web Analytics
 
Migrating Netflix from Datacenter Oracle to Global Cassandra
Migrating Netflix from Datacenter Oracle to Global CassandraMigrating Netflix from Datacenter Oracle to Global Cassandra
Migrating Netflix from Datacenter Oracle to Global Cassandra
 
Advanced data modeling with apache cassandra
Advanced data modeling with apache cassandraAdvanced data modeling with apache cassandra
Advanced data modeling with apache cassandra
 
BI, Reporting and Analytics on Apache Cassandra
BI, Reporting and Analytics on Apache CassandraBI, Reporting and Analytics on Apache Cassandra
BI, Reporting and Analytics on Apache Cassandra
 

Semelhante a GigaSpaces XAP - Don't Call Me Cache!

Spring Data JPA in detail with spring boot
Spring Data JPA in detail with spring bootSpring Data JPA in detail with spring boot
Spring Data JPA in detail with spring bootrinky1234
 
Spring Data JPA USE FOR CREATING DATA JPA
Spring Data JPA USE FOR CREATING DATA  JPASpring Data JPA USE FOR CREATING DATA  JPA
Spring Data JPA USE FOR CREATING DATA JPAmichaelaaron25322
 
Jasigsakai12 columbia-customizes-cas
Jasigsakai12 columbia-customizes-casJasigsakai12 columbia-customizes-cas
Jasigsakai12 columbia-customizes-casellentuck
 
Domain-Driven Design with SeedStack
Domain-Driven Design with SeedStackDomain-Driven Design with SeedStack
Domain-Driven Design with SeedStackSeedStack
 
Integrate Sas With Google Maps
Integrate Sas With Google MapsIntegrate Sas With Google Maps
Integrate Sas With Google Mapsvineetkaul
 
GraphQL Bangkok Meetup 2.0
GraphQL Bangkok Meetup 2.0GraphQL Bangkok Meetup 2.0
GraphQL Bangkok Meetup 2.0Tobias Meixner
 
Giga Spaces Data Grid / Data Caching Overview
Giga Spaces Data Grid / Data Caching OverviewGiga Spaces Data Grid / Data Caching Overview
Giga Spaces Data Grid / Data Caching Overviewjimliddle
 
The Next Generation Application Server – How Event Based Processing yields s...
The Next Generation  Application Server – How Event Based Processing yields s...The Next Generation  Application Server – How Event Based Processing yields s...
The Next Generation Application Server – How Event Based Processing yields s...Guy Korland
 
The Art of The Event Streaming Application: Streams, Stream Processors and Sc...
The Art of The Event Streaming Application: Streams, Stream Processors and Sc...The Art of The Event Streaming Application: Streams, Stream Processors and Sc...
The Art of The Event Streaming Application: Streams, Stream Processors and Sc...confluent
 
Kakfa summit london 2019 - the art of the event-streaming app
Kakfa summit london 2019 - the art of the event-streaming appKakfa summit london 2019 - the art of the event-streaming app
Kakfa summit london 2019 - the art of the event-streaming appNeil Avery
 
Introducing the WSO2 Complex Event Processor
Introducing the WSO2 Complex Event ProcessorIntroducing the WSO2 Complex Event Processor
Introducing the WSO2 Complex Event ProcessorWSO2
 
Kafka as an Event Store (Guido Schmutz, Trivadis) Kafka Summit NYC 2019
Kafka as an Event Store (Guido Schmutz, Trivadis) Kafka Summit NYC 2019Kafka as an Event Store (Guido Schmutz, Trivadis) Kafka Summit NYC 2019
Kafka as an Event Store (Guido Schmutz, Trivadis) Kafka Summit NYC 2019confluent
 
Dependency injection - the right way
Dependency injection - the right wayDependency injection - the right way
Dependency injection - the right wayThibaud Desodt
 
A head start on cloud native event driven applications - bigdatadays
A head start on cloud native event driven applications - bigdatadaysA head start on cloud native event driven applications - bigdatadays
A head start on cloud native event driven applications - bigdatadaysSriskandarajah Suhothayan
 
An Introduction To CQRS
An Introduction To CQRSAn Introduction To CQRS
An Introduction To CQRSNeil Robbins
 
Event sourcing in the functional world (22 07-2021)
Event sourcing in the functional world (22 07-2021)Event sourcing in the functional world (22 07-2021)
Event sourcing in the functional world (22 07-2021)Vitaly Brusentsev
 

Semelhante a GigaSpaces XAP - Don't Call Me Cache! (20)

Spring Data JPA in detail with spring boot
Spring Data JPA in detail with spring bootSpring Data JPA in detail with spring boot
Spring Data JPA in detail with spring boot
 
Spring Data JPA USE FOR CREATING DATA JPA
Spring Data JPA USE FOR CREATING DATA  JPASpring Data JPA USE FOR CREATING DATA  JPA
Spring Data JPA USE FOR CREATING DATA JPA
 
Jasigsakai12 columbia-customizes-cas
Jasigsakai12 columbia-customizes-casJasigsakai12 columbia-customizes-cas
Jasigsakai12 columbia-customizes-cas
 
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
 
Integrate Sas With Google Maps
Integrate Sas With Google MapsIntegrate Sas With Google Maps
Integrate Sas With Google Maps
 
GraphQL Bangkok Meetup 2.0
GraphQL Bangkok Meetup 2.0GraphQL Bangkok Meetup 2.0
GraphQL Bangkok Meetup 2.0
 
Giga Spaces Data Grid / Data Caching Overview
Giga Spaces Data Grid / Data Caching OverviewGiga Spaces Data Grid / Data Caching Overview
Giga Spaces Data Grid / Data Caching Overview
 
The Next Generation Application Server – How Event Based Processing yields s...
The Next Generation  Application Server – How Event Based Processing yields s...The Next Generation  Application Server – How Event Based Processing yields s...
The Next Generation Application Server – How Event Based Processing yields s...
 
Siddhi - cloud-native stream processor
Siddhi - cloud-native stream processorSiddhi - cloud-native stream processor
Siddhi - cloud-native stream processor
 
70562 (1)
70562 (1)70562 (1)
70562 (1)
 
The Art of The Event Streaming Application: Streams, Stream Processors and Sc...
The Art of The Event Streaming Application: Streams, Stream Processors and Sc...The Art of The Event Streaming Application: Streams, Stream Processors and Sc...
The Art of The Event Streaming Application: Streams, Stream Processors and Sc...
 
Kakfa summit london 2019 - the art of the event-streaming app
Kakfa summit london 2019 - the art of the event-streaming appKakfa summit london 2019 - the art of the event-streaming app
Kakfa summit london 2019 - the art of the event-streaming app
 
JPA 2.0
JPA 2.0JPA 2.0
JPA 2.0
 
Introducing the WSO2 Complex Event Processor
Introducing the WSO2 Complex Event ProcessorIntroducing the WSO2 Complex Event Processor
Introducing the WSO2 Complex Event Processor
 
Kafka as an Event Store (Guido Schmutz, Trivadis) Kafka Summit NYC 2019
Kafka as an Event Store (Guido Schmutz, Trivadis) Kafka Summit NYC 2019Kafka as an Event Store (Guido Schmutz, Trivadis) Kafka Summit NYC 2019
Kafka as an Event Store (Guido Schmutz, Trivadis) Kafka Summit NYC 2019
 
Dependency injection - the right way
Dependency injection - the right wayDependency injection - the right way
Dependency injection - the right way
 
A head start on cloud native event driven applications - bigdatadays
A head start on cloud native event driven applications - bigdatadaysA head start on cloud native event driven applications - bigdatadays
A head start on cloud native event driven applications - bigdatadays
 
An Introduction To CQRS
An Introduction To CQRSAn Introduction To CQRS
An Introduction To CQRS
 
Event sourcing in the functional world (22 07-2021)
Event sourcing in the functional world (22 07-2021)Event sourcing in the functional world (22 07-2021)
Event sourcing in the functional world (22 07-2021)
 

Mais de Uri Cohen

Orchestration tool roundup - OpenStack Israel summit - kubernetes vs. docker...
Orchestration tool roundup  - OpenStack Israel summit - kubernetes vs. docker...Orchestration tool roundup  - OpenStack Israel summit - kubernetes vs. docker...
Orchestration tool roundup - OpenStack Israel summit - kubernetes vs. docker...Uri Cohen
 
Cloudify workshop at CCCEU 2014
Cloudify workshop at CCCEU 2014 Cloudify workshop at CCCEU 2014
Cloudify workshop at CCCEU 2014 Uri Cohen
 
Alef event - going open source
Alef event - going open source Alef event - going open source
Alef event - going open source Uri Cohen
 
GigaSpaces XAP for Financial Services
GigaSpaces XAP for Financial Services GigaSpaces XAP for Financial Services
GigaSpaces XAP for Financial Services Uri Cohen
 
In Memory Data Grids, Demystified!
In Memory Data Grids, Demystified! In Memory Data Grids, Demystified!
In Memory Data Grids, Demystified! Uri Cohen
 
App Centric Devops - CloudStack 2014 Collaboration Conference #CCNA14
App Centric Devops - CloudStack 2014 Collaboration Conference #CCNA14App Centric Devops - CloudStack 2014 Collaboration Conference #CCNA14
App Centric Devops - CloudStack 2014 Collaboration Conference #CCNA14Uri Cohen
 
Its the app stupid - CloudStack 2014 Collaboration Conference #CCNA14
Its the app stupid - CloudStack 2014 Collaboration Conference #CCNA14 Its the app stupid - CloudStack 2014 Collaboration Conference #CCNA14
Its the app stupid - CloudStack 2014 Collaboration Conference #CCNA14 Uri Cohen
 
Deployment Automation on OpenStack with TOSCA and Cloudify
Deployment Automation on OpenStack with TOSCA and CloudifyDeployment Automation on OpenStack with TOSCA and Cloudify
Deployment Automation on OpenStack with TOSCA and CloudifyUri Cohen
 
Cloud stack collabiration conference - It's the app, stupid!
Cloud stack collabiration conference - It's the app, stupid!Cloud stack collabiration conference - It's the app, stupid!
Cloud stack collabiration conference - It's the app, stupid!Uri Cohen
 
Changing organizational culture - a sweaty usecase
Changing organizational culture - a sweaty usecaseChanging organizational culture - a sweaty usecase
Changing organizational culture - a sweaty usecaseUri Cohen
 
Oscon 2013 - Lessons from building an open source community
Oscon 2013 - Lessons from building an open source community Oscon 2013 - Lessons from building an open source community
Oscon 2013 - Lessons from building an open source community Uri Cohen
 
Oscon 2013 -Your OSS Project Is now served
Oscon 2013 -Your OSS Project Is now servedOscon 2013 -Your OSS Project Is now served
Oscon 2013 -Your OSS Project Is now servedUri Cohen
 
OpenStack Israel Summit 2013 - It’s the App, Stupid!
OpenStack Israel Summit 2013 - It’s the App, Stupid! OpenStack Israel Summit 2013 - It’s the App, Stupid!
OpenStack Israel Summit 2013 - It’s the App, Stupid! Uri Cohen
 
One Does Not Simply Walk Into Devops
One Does Not Simply Walk Into Devops One Does Not Simply Walk Into Devops
One Does Not Simply Walk Into Devops Uri Cohen
 
MongoDB in the Clouds
MongoDB in the CloudsMongoDB in the Clouds
MongoDB in the CloudsUri Cohen
 
Carrier Paas - CloudStack Collaboration Event 2012
Carrier Paas - CloudStack Collaboration Event 2012Carrier Paas - CloudStack Collaboration Event 2012
Carrier Paas - CloudStack Collaboration Event 2012Uri Cohen
 
Your Apps on the Cloud - What it really takes
Your Apps on the Cloud - What it really takes Your Apps on the Cloud - What it really takes
Your Apps on the Cloud - What it really takes Uri Cohen
 
Cassandra summit - Big Data Apps on the cloud
Cassandra summit - Big Data Apps on the cloud Cassandra summit - Big Data Apps on the cloud
Cassandra summit - Big Data Apps on the cloud Uri Cohen
 
Trade and Event Processing at a Massive Scale - QCon NY 2012
Trade and Event Processing at a Massive Scale - QCon NY 2012Trade and Event Processing at a Massive Scale - QCon NY 2012
Trade and Event Processing at a Massive Scale - QCon NY 2012Uri Cohen
 
DevOps Meets PaaS - NY Meetup with Chef (OpsCode)
DevOps Meets PaaS - NY Meetup with Chef (OpsCode)DevOps Meets PaaS - NY Meetup with Chef (OpsCode)
DevOps Meets PaaS - NY Meetup with Chef (OpsCode)Uri Cohen
 

Mais de Uri Cohen (20)

Orchestration tool roundup - OpenStack Israel summit - kubernetes vs. docker...
Orchestration tool roundup  - OpenStack Israel summit - kubernetes vs. docker...Orchestration tool roundup  - OpenStack Israel summit - kubernetes vs. docker...
Orchestration tool roundup - OpenStack Israel summit - kubernetes vs. docker...
 
Cloudify workshop at CCCEU 2014
Cloudify workshop at CCCEU 2014 Cloudify workshop at CCCEU 2014
Cloudify workshop at CCCEU 2014
 
Alef event - going open source
Alef event - going open source Alef event - going open source
Alef event - going open source
 
GigaSpaces XAP for Financial Services
GigaSpaces XAP for Financial Services GigaSpaces XAP for Financial Services
GigaSpaces XAP for Financial Services
 
In Memory Data Grids, Demystified!
In Memory Data Grids, Demystified! In Memory Data Grids, Demystified!
In Memory Data Grids, Demystified!
 
App Centric Devops - CloudStack 2014 Collaboration Conference #CCNA14
App Centric Devops - CloudStack 2014 Collaboration Conference #CCNA14App Centric Devops - CloudStack 2014 Collaboration Conference #CCNA14
App Centric Devops - CloudStack 2014 Collaboration Conference #CCNA14
 
Its the app stupid - CloudStack 2014 Collaboration Conference #CCNA14
Its the app stupid - CloudStack 2014 Collaboration Conference #CCNA14 Its the app stupid - CloudStack 2014 Collaboration Conference #CCNA14
Its the app stupid - CloudStack 2014 Collaboration Conference #CCNA14
 
Deployment Automation on OpenStack with TOSCA and Cloudify
Deployment Automation on OpenStack with TOSCA and CloudifyDeployment Automation on OpenStack with TOSCA and Cloudify
Deployment Automation on OpenStack with TOSCA and Cloudify
 
Cloud stack collabiration conference - It's the app, stupid!
Cloud stack collabiration conference - It's the app, stupid!Cloud stack collabiration conference - It's the app, stupid!
Cloud stack collabiration conference - It's the app, stupid!
 
Changing organizational culture - a sweaty usecase
Changing organizational culture - a sweaty usecaseChanging organizational culture - a sweaty usecase
Changing organizational culture - a sweaty usecase
 
Oscon 2013 - Lessons from building an open source community
Oscon 2013 - Lessons from building an open source community Oscon 2013 - Lessons from building an open source community
Oscon 2013 - Lessons from building an open source community
 
Oscon 2013 -Your OSS Project Is now served
Oscon 2013 -Your OSS Project Is now servedOscon 2013 -Your OSS Project Is now served
Oscon 2013 -Your OSS Project Is now served
 
OpenStack Israel Summit 2013 - It’s the App, Stupid!
OpenStack Israel Summit 2013 - It’s the App, Stupid! OpenStack Israel Summit 2013 - It’s the App, Stupid!
OpenStack Israel Summit 2013 - It’s the App, Stupid!
 
One Does Not Simply Walk Into Devops
One Does Not Simply Walk Into Devops One Does Not Simply Walk Into Devops
One Does Not Simply Walk Into Devops
 
MongoDB in the Clouds
MongoDB in the CloudsMongoDB in the Clouds
MongoDB in the Clouds
 
Carrier Paas - CloudStack Collaboration Event 2012
Carrier Paas - CloudStack Collaboration Event 2012Carrier Paas - CloudStack Collaboration Event 2012
Carrier Paas - CloudStack Collaboration Event 2012
 
Your Apps on the Cloud - What it really takes
Your Apps on the Cloud - What it really takes Your Apps on the Cloud - What it really takes
Your Apps on the Cloud - What it really takes
 
Cassandra summit - Big Data Apps on the cloud
Cassandra summit - Big Data Apps on the cloud Cassandra summit - Big Data Apps on the cloud
Cassandra summit - Big Data Apps on the cloud
 
Trade and Event Processing at a Massive Scale - QCon NY 2012
Trade and Event Processing at a Massive Scale - QCon NY 2012Trade and Event Processing at a Massive Scale - QCon NY 2012
Trade and Event Processing at a Massive Scale - QCon NY 2012
 
DevOps Meets PaaS - NY Meetup with Chef (OpsCode)
DevOps Meets PaaS - NY Meetup with Chef (OpsCode)DevOps Meets PaaS - NY Meetup with Chef (OpsCode)
DevOps Meets PaaS - NY Meetup with Chef (OpsCode)
 

Último

Visualising and forecasting stocks using Dash
Visualising and forecasting stocks using DashVisualising and forecasting stocks using Dash
Visualising and forecasting stocks using Dashnarutouzumaki53779
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Exploring ChatGPT Prompt Hacks To Maximally Optimise Your Queries
Exploring ChatGPT Prompt Hacks To Maximally Optimise Your QueriesExploring ChatGPT Prompt Hacks To Maximally Optimise Your Queries
Exploring ChatGPT Prompt Hacks To Maximally Optimise Your QueriesSanjay Willie
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 

Último (20)

Visualising and forecasting stocks using Dash
Visualising and forecasting stocks using DashVisualising and forecasting stocks using Dash
Visualising and forecasting stocks using Dash
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Exploring ChatGPT Prompt Hacks To Maximally Optimise Your Queries
Exploring ChatGPT Prompt Hacks To Maximally Optimise Your QueriesExploring ChatGPT Prompt Hacks To Maximally Optimise Your Queries
Exploring ChatGPT Prompt Hacks To Maximally Optimise Your Queries
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 

GigaSpaces XAP - Don't Call Me Cache!

  • 1. Powering Your Application with XAP (Using payment processing as an example) “Don’t call me cache”
  • 2. 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
  • 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 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??
  • 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 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 .
  • 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 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?
  • 6. Here’s What a Payment Authorization Process Looks Like Payment Authorization Request Basic Validation User Profile Check Merchant Profile Check Payment Authorization Approved
  • 7. 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
  • 8. 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
  • 9. 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
  • 10. Let's Talk About Data Model for a Second
  • 11. User Id (Routing)| User Name|… Card Id| Card Data | UserID (Routing)… Transaction ID | CardId | User ID (Routing)… 1  * 1  * Data Model
  • 12. Let's Get Back to the Process
  • 13. 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 Single threaded handler Template “queues” events for the handler
  • 14. 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
  • 15. 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
  • 16. 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 { ... } }
  • 17. 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 { ... } }
  • 18. 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
  • 19. 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; }
  • 20. 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; }
  • 21. 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; }
  • 22. 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; }
  • 23. Vendor Validation Check @Override public Boolean execute() throws Exception { return validatePayment(vendorPaymentMsg); } Task DealsMerchant Class PaymentAuthorization { Status status; Boolean userCheck; Boolean vendorCheck; } Querying
  • 24. Vendor Validation Check Task DealsMerchant @Override public Boolean execute() throws Exception { return validatePayment(vendorPaymentMsg); } Class PaymentAuthorization { Status status; Boolean userCheck; Boolean vendorCheck; } Querying
  • 25. 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; }
  • 26. Yey! Payment Has Been Authorized @EventTemplate public PaymentAuthorization getNewPayment() { return new PaymentAuthorization(null, true, true, PaymentAuthorizationStatus.New); } Queue Payment Authorization
  • 27. 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
  • 28. Q&A
  • 29. THANK YOU! Get the code from Github

Notas do Editor

  1. Cache == in-memory key-value storeExample Ehcache
  2. Example MemcachedOnly key-value (only read-by-ID), not a full-fledged database, no query engine, no indexing, no transactions
  3. Added transactionalityIndexing (incl. nested indices)Querying engine (SQL, template-based/query-by-example)Projections, inline changesComplex objects (not supported by Coherence. Style MongoDB etc.)Document-based data model (semi-structured schema support)
  4. processing co-located with the data, map-reduce, scatter-gather, remote invocation/execution, embedded/remote event containers
  5. Basicvalidataion – Credit card is valid etc.Checks – fraud detection style checks
  6. Writing the event into the gridRouting to right partition – content-based routing by user IDReplicated synchronously to the partition’s hot backup
  7. Easily indexing properties using annotations/metadata
  8. co-location of the user with its cards and transactions – ensures affinity
  9. Entry written to the space is handled implicitly as joining a queue, and creating a consumer to process entries from the queueConsumer is a simple Java class with some annotations which needs to define: (1) event template - which events are of interest(2) event handler - How to handle the eventsWhich entries are of interest? Easily defined as a simple method with @EventTemplate annotation and using a SQL query
  10. Event handler easily created by annotating the methodIn the payment processing example – needs to validate that (a) credit card is OK and (b) create payment authorization state object for the subsequent validation phase
  11. Compare current payment against user profileAll user’s card and payment info is available found with the user on same partition (thanks to our routing policy)Simple change API for inline property updatesExample of simple template-based queries
  12. We’ll use remote distributed async task dispatch to perform this validationFirst the consumer fetches the VendorPaymentMsg, then it creates a task to make the validation
  13. On our system architecture we create a separate vendors cluster (space) to enable vendor profiling on single partitionThe task is dispatched from our user’s node on the the payment cluster to the right node on the vendor cluster based on our content-based routing policy (based on the merchant ID)
  14. In order to validate vendor all merchant’s deals are fetched and profiled, to assure this deal matches and no fraud
  15. Once calculation is completed the result is asynchronously returned from the task back to the caller node (callback to the payment cluster node)Async invocation uses enhanced version of the standard Java Async API (Future).Again we use Change API to update the PaymentAuthorization.vendorCheck status flag
  16. Fetch all PaymentAuthorization that completed initial validation (status=New) and that passed both userCheck and vendorCheck (the 2 ‘true’ values)And update the status to ‘Done’
  17. Fetch all PaymentAuthorization that completed initial validation (status=New) and that passed both userCheck and vendorCheck (the 2 ‘true’ values)And update the status to ‘Closed’