SlideShare a Scribd company logo
1 of 55
Download to read offline
KNOTX.io
When Vert.x & RxJava meet
highly-efficient and scalable integration approach
for modern platforms
Maciej Laskowski
Tomasz Michalak
KNOTX.io
300 pageviews / second
Page available in less than 3 seconds
KNOTX.io
KNOTX.io
KNOTX.io
Ready?
> 300 views / s
< 0.05 s
KNOTX.io
Challenge
- The client is one of the biggest
perfume and cosmetics
retailer in Europe.
- Its sales concentrate on an
online platform.
- The client needs to connect
several incompatible systems.
KNOTX.io
Challenge
KNOTX.io
Traditional approach
KNOTX.io
Client-side approach
KNOTX.io
Nope!
KNOTX.io
Modern approach
● Scalable
● Transparent
● Reusable
● Each component
easy to replace
KNOTX.ioKNOTX.io
TEAMWORK
KNOTX.io
Modern approach
KNOTX.io
HACKATHON
OPEN SOURCE
KNOTX.io
Integration layer == Knot.x
KNOTX.io
Knot.x features: Data ingestion
<script
data-knotx-knots="services,handlebars"
data-knotx-service="welcome"
type="text/knotx-snippet">
<h1>{{message}}</h1>
<div>
<div>Message type - {{body.type}}</div>
<div>Statistics: {{statistics}}</div>
</div>
</script>
CMS
KNOTX.io
Knot.x features: Data ingestion
{
"message": "Hello from Knot.x!",
"body": {
"type": "greeting",
"priority": "1"
},
"statistics": 20
}
<script
data-knotx-knots="services,handlebars"
data-knotx-service="welcome"
type="text/knotx-snippet">
<h1>{{message}}</h1>
<div>
<div>Message type - {{body.type}}</div>
<div>Statistics: {{statistics}}</div>
</div>
</script>
CMS
Service
KNOTX.io
Knot.x features: Data ingestion
<h1>Hello from Knot.x!</h1>
<div>
<div>Message type - greeting</div>
<div>Statistics: 20</div>
</div>
{
"message": "Hello from Knot.x!",
"body": {
"type": "greeting",
"priority": "1"
},
"statistics": 20
}
<script
data-knotx-knots="services,handlebars"
data-knotx-service="welcome"
type="text/knotx-snippet">
<h1>{{message}}</h1>
<div>
<div>Message type - {{body.type}}</div>
<div>Statistics: {{statistics}}</div>
</div>
</script>
CMS
Service
Final page
KNOTX.io
Knot.x features: forms
Knot.x supports simple and multi-step
forms. Easily handles submission
errors, form validations and redirects.
Knot.x allows you to define a graph of
interconnected steps, responding to
user input or site visitor choices.
KNOTX.io
Knot.x features: prototyping
Knot.x gives you the ability to use
simple Mocks. This allows you to
expose your sample data directly to
pages even if the real service is not
available yet, and switch to the real
service without any further
development work.
KNOTX.io
Knot.x features: extensions
Knot.x is a fully modular platform with
very flexible extension points that we
call Knots and Adapters that
efficiently communicates with Knot.x
Core using event bus. Thanks to the
polyglot nature of Vert.x you can
implement extensions in languages
other than Java.
KNOTX.io
is
an event-driven, non-blocking, polyglot
application framework
that runs on the Java Virtual Machine
KNOTX.io
Actor-like modules in Vert.x
VerticleHandlers
HTTP?
KNOTX.io
Vert.x Event Bus
Machine
KNOTX.io
Vert.x Event Bus
heavy
load
KNOTX.io
Vert.x Event Bus
KNOTX.io
Vert.x Event Bus
Machine 2Machine 1
KNOTX.io
Knot.x Architecture
- CMS (Repository) responds
with HTML markup.
- REST services respond with
JSON.
Knot.x Core
Modules
KNOTX.io
Knot.x Architecture
KNOTX.io
Performance
What’s ?
- message
- notification,
- HTTP request
- command/instruction
- file
- result
- error
KNOTX.io
Handlers
void operation(param1, param2,
Handler< > handler) {
// …
handler.handle( );
// …
}
void handle( ) {
// do something with
}
Event Loop
The Golden Rule: don’t block the Event Loop
KNOTX.io
Multi-thread
KNOTX.io
Personalized Search
KNOTX.io
Personalized Search (Vert.x Callbacks)
public class RequestHandler implements Handler<HttpServerRequest> {
@Override
public void handle(HttpServerRequest request) {
vertx.eventBus().send("user-tracking", userId, reply1 -> {
String userTrackingData = (String) reply1.result().body();
});
}
}
KNOTX.io
Personalized Search (Vert.x Callbacks)
public class RequestHandler implements Handler<HttpServerRequest> {
@Override
public void handle(HttpServerRequest request) {
vertx.eventBus().send("user-tracking", userId, reply1 -> {
String userTrackingData = (String) reply1.result().body();
vertx.eventBus().send("search-engine", query, reply2 -> {
String searchEngineData = (String) reply2.result().body();
});
});
}
}
KNOTX.io
Personalized Search (Vert.x Callbacks)
public class RequestHandler implements Handler<HttpServerRequest> {
@Override
public void handle(HttpServerRequest request) {
vertx.eventBus().send("user-tracking", userId, reply1 -> {
String userTrackingData = (String) reply1.result().body();
vertx.eventBus().send("search-engine", query, reply2 -> {
String searchEngineData = (String) reply2.result().body();
String combinedData = userTrackingData + "-" + searchEngineData;
vertx.eventBus().send("personalize", combinedData, reply3 -> {
request.response().end("Personalized results are: " + reply3.result().body());
});
});
});
}
}
KNOTX.io
Personalized Search (Vert.x Callbacks)
KNOTX.io
Personalized Search (Vert.x Callbacks)
KNOTX.io
Personalized Search (Vert.x Callbacks)
KNOTX.io
Callback Hell
public class RequestHandler implements Handler<HttpServerRequest> {
@Override
public void handle(HttpServerRequest request) {
vertx.eventBus().send("user-tracking", userId, reply1 -> {
String userTrackingData = (String) reply1.result().body();
vertx.eventBus().send("search-engine", query, reply2 -> {
String searchEngineData = (String) reply2.result().body();
String combinedData = userTrackingData + "-" + searchEngineData;
vertx.eventBus().send("personalize", combinedData, reply3 -> {
request.response().end("Personalized results are: " + reply3.result().body());
});
});
});
}
}
KNOTX.io
KNOTX.io
RxJava - Observable
source: http://reactivex.io/intro.html
KNOTX.io
RxJava
Observable.subscribe(
onNext( ),
onError( ),
onCompleted()
);
X
Data stream #1:
Data stream #2: X
|
|
Each form the stream goes here.
Whenever any error happens, it triggers
onError and finishes processing.
X
When all were processed (no more
events: ), this is triggered|
KNOTX.io
RxJava
Observable.subscribe(
onNext( ),
onError( ),
onCompleted()
);
Data stream #1: |
x3
x1
KNOTX.io
RxJava
Observable.subscribe(
onNext( ),
onError( ),
onCompleted()
);
X
Data stream #2:
X |
x2
x1
KNOTX.io
Personalized Search (RxJava)
public class RequestHandler implements Handler<HttpServerRequest> {
@Override
public void handle(HttpServerRequest request) {
Observable<Message<String>> reply1 = vertx.eventBus()
.sendObservable("user-tracking", userId);
Observable<Message<String>> reply2 = vertx.eventBus()
.sendObservable("search-engine", query);
}
}
KNOTX.io
Personalized Search (RxJava)
public class RequestHandler implements Handler<HttpServerRequest> {
@Override
public void handle(HttpServerRequest request) {
Observable<Message<String>> reply1 = vertx.eventBus()
.sendObservable("user-tracking", userId);
Observable<Message<String>> reply2 = vertx.eventBus()
.sendObservable("search-engine", query);
Observable
.zip(reply1, reply2, (Message resp1, Message resp2) -> resp1.body() + "-" + resp2.body())
.subscribe(combinedData -> vertx.eventBus().sendObservable("personalize", combinedData)
.subscribe(reply3 ->
request.response().end("Personalized results are: " + reply3.body()))
);
}
}
KNOTX.io
Personalized Search (RxJava)
KNOTX.io
RxJava - abstraction over low-level threading
public class RequestHandler implements Handler<HttpServerRequest> {
@Override
public void handle(HttpServerRequest request) {
Observable<Message<String>> reply1 = vertx.eventBus()
.sendObservable("user-tracking", userId);
Observable<Message<String>> reply2 = vertx.eventBus()
.sendObservable("search-engine", query);
Observable
.zip(reply1, reply2, (Message resp1, Message resp2) -> resp1.body() + "-" + resp2.body())
.subscribe(combinedData -> vertx.eventBus().sendObservable("personalize", combinedData)
.subscribe(reply3 ->
request.response().end("Personalized results are: " + reply3.body()))
);
}
}
Nothing happens
here. Just
declarations.
KNOTX.io
RxJava - abstraction over low-level threading
public class RequestHandler implements Handler<HttpServerRequest> {
@Override
public void handle(HttpServerRequest request) {
Observable<Message<String>> reply1 = vertx.eventBus()
.sendObservable("user-tracking", userId);
Observable<Message<String>> reply2 = vertx.eventBus()
.sendObservable("search-engine", query);
Observable
.zip(reply1, reply2, (Message resp1, Message resp2) -> resp1.body() + "-" + resp2.body())
.subscribe(combinedData -> vertx.eventBus().sendObservable("personalize", combinedData)
.subscribe(reply3 ->
request.response().end("Personalized results are: " + reply3.body()))
);
}
}
Nothing happens
here. Just
declarations.
Also, no actions
here until we
subscribe.
KNOTX.io
RxJava - abstraction over low-level threading
public class RequestHandler implements Handler<HttpServerRequest> {
@Override
public void handle(HttpServerRequest request) {
Observable<Message<String>> reply1 = vertx.eventBus()
.sendObservable("user-tracking", userId);
Observable<Message<String>> reply2 = vertx.eventBus()
.sendObservable("search-engine", query);
Observable
.zip(reply1, reply2, (Message resp1, Message resp2) -> resp1.body() + "-" + resp2.body())
.subscribe(combinedData -> vertx.eventBus().sendObservable("personalize", combinedData)
.subscribe(reply3 ->
request.response().end("Personalized results are: " + reply3.body()))
);
}
}
Nothing happens
here. Just
declarations.
Also, no actions
here until we
subscribe.
This subscribe triggers
simultaneous calls to search-engine
and user-tracking.
This subscribe triggers calling
personalized service.
KNOTX.io
RxJava - Marble Diagrams
KNOTX.io
RxJava - Marble Diagrams
KNOTX.io
Live demo
https://goo.gl/lqG76x
KNOTX.io
Thank you
● Tutorials: www.knotx.io
● Sources & Wiki: https://github.com/Cognifide/knotx
● Twitter: @knotx_project
● Gitter / Google Groups
Maciej Laskowski
@skejven
https://github.com/Skejven
Tomasz Michalak
@tomichalak
https://github.com/tomaszmichalak

More Related Content

What's hot

Advanced Hibernate V2
Advanced Hibernate V2Advanced Hibernate V2
Advanced Hibernate V2Haitham Raik
 
Cassandra Summit EU 2014 Lightning talk - Paging (no animation)
Cassandra Summit EU 2014 Lightning talk - Paging (no animation)Cassandra Summit EU 2014 Lightning talk - Paging (no animation)
Cassandra Summit EU 2014 Lightning talk - Paging (no animation)Christopher Batey
 
Introduction to Restkit
Introduction to RestkitIntroduction to Restkit
Introduction to Restkitpetertmarks
 
Fault tolerant microservices - LJC Skills Matter 4thNov2014
Fault tolerant microservices - LJC Skills Matter 4thNov2014Fault tolerant microservices - LJC Skills Matter 4thNov2014
Fault tolerant microservices - LJC Skills Matter 4thNov2014Christopher Batey
 
Cassandra Summit EU 2014 - Testing Cassandra Applications
Cassandra Summit EU 2014 - Testing Cassandra ApplicationsCassandra Summit EU 2014 - Testing Cassandra Applications
Cassandra Summit EU 2014 - Testing Cassandra ApplicationsChristopher Batey
 
MicroProfile: uma nova forma de desenvolver aplicações corporativas na era do...
MicroProfile: uma nova forma de desenvolver aplicações corporativas na era do...MicroProfile: uma nova forma de desenvolver aplicações corporativas na era do...
MicroProfile: uma nova forma de desenvolver aplicações corporativas na era do...Otávio Santana
 
Let's build a blockchain.... in 40 minutes!
Let's build a blockchain.... in 40 minutes!Let's build a blockchain.... in 40 minutes!
Let's build a blockchain.... in 40 minutes!Michel Schudel
 
Decentralized access control with anonymous authentication of data stored in ...
Decentralized access control with anonymous authentication of data stored in ...Decentralized access control with anonymous authentication of data stored in ...
Decentralized access control with anonymous authentication of data stored in ...Vasanth Mca
 
Creating a Java EE 7 Websocket Chat Application
Creating a Java EE 7 Websocket Chat ApplicationCreating a Java EE 7 Websocket Chat Application
Creating a Java EE 7 Websocket Chat ApplicationMicha Kops
 
#3 (Multi Threads With TCP)
#3 (Multi Threads With TCP)#3 (Multi Threads With TCP)
#3 (Multi Threads With TCP)Ghadeer AlHasan
 
Слава Бобик «NancyFx для самых маленьких»
Слава Бобик «NancyFx для самых маленьких»Слава Бобик «NancyFx для самых маленьких»
Слава Бобик «NancyFx для самых маленьких»SpbDotNet Community
 
Java Svet - Communication Between Android App Components
Java Svet - Communication Between Android App ComponentsJava Svet - Communication Between Android App Components
Java Svet - Communication Between Android App ComponentsAleksandar Ilić
 
130919 jim cordy - when is a clone not a clone
130919   jim cordy - when is a clone not a clone130919   jim cordy - when is a clone not a clone
130919 jim cordy - when is a clone not a clonePtidej Team
 
Elasticsearch und die Java-Welt
Elasticsearch und die Java-WeltElasticsearch und die Java-Welt
Elasticsearch und die Java-WeltFlorian Hopf
 
Weaving the ILP Fabric into Bigchain DB
Weaving the ILP Fabric into Bigchain DBWeaving the ILP Fabric into Bigchain DB
Weaving the ILP Fabric into Bigchain DBInterledger
 
Bare-knuckle web development
Bare-knuckle web developmentBare-knuckle web development
Bare-knuckle web developmentJohannes Brodwall
 
Cassandra is great but how do I test my application?
Cassandra is great but how do I test my application?Cassandra is great but how do I test my application?
Cassandra is great but how do I test my application?Christopher Batey
 
Work Stealing For Fun & Profit: Jim Nelson
Work Stealing For Fun & Profit: Jim NelsonWork Stealing For Fun & Profit: Jim Nelson
Work Stealing For Fun & Profit: Jim NelsonRedis Labs
 

What's hot (18)

Advanced Hibernate V2
Advanced Hibernate V2Advanced Hibernate V2
Advanced Hibernate V2
 
Cassandra Summit EU 2014 Lightning talk - Paging (no animation)
Cassandra Summit EU 2014 Lightning talk - Paging (no animation)Cassandra Summit EU 2014 Lightning talk - Paging (no animation)
Cassandra Summit EU 2014 Lightning talk - Paging (no animation)
 
Introduction to Restkit
Introduction to RestkitIntroduction to Restkit
Introduction to Restkit
 
Fault tolerant microservices - LJC Skills Matter 4thNov2014
Fault tolerant microservices - LJC Skills Matter 4thNov2014Fault tolerant microservices - LJC Skills Matter 4thNov2014
Fault tolerant microservices - LJC Skills Matter 4thNov2014
 
Cassandra Summit EU 2014 - Testing Cassandra Applications
Cassandra Summit EU 2014 - Testing Cassandra ApplicationsCassandra Summit EU 2014 - Testing Cassandra Applications
Cassandra Summit EU 2014 - Testing Cassandra Applications
 
MicroProfile: uma nova forma de desenvolver aplicações corporativas na era do...
MicroProfile: uma nova forma de desenvolver aplicações corporativas na era do...MicroProfile: uma nova forma de desenvolver aplicações corporativas na era do...
MicroProfile: uma nova forma de desenvolver aplicações corporativas na era do...
 
Let's build a blockchain.... in 40 minutes!
Let's build a blockchain.... in 40 minutes!Let's build a blockchain.... in 40 minutes!
Let's build a blockchain.... in 40 minutes!
 
Decentralized access control with anonymous authentication of data stored in ...
Decentralized access control with anonymous authentication of data stored in ...Decentralized access control with anonymous authentication of data stored in ...
Decentralized access control with anonymous authentication of data stored in ...
 
Creating a Java EE 7 Websocket Chat Application
Creating a Java EE 7 Websocket Chat ApplicationCreating a Java EE 7 Websocket Chat Application
Creating a Java EE 7 Websocket Chat Application
 
#3 (Multi Threads With TCP)
#3 (Multi Threads With TCP)#3 (Multi Threads With TCP)
#3 (Multi Threads With TCP)
 
Слава Бобик «NancyFx для самых маленьких»
Слава Бобик «NancyFx для самых маленьких»Слава Бобик «NancyFx для самых маленьких»
Слава Бобик «NancyFx для самых маленьких»
 
Java Svet - Communication Between Android App Components
Java Svet - Communication Between Android App ComponentsJava Svet - Communication Between Android App Components
Java Svet - Communication Between Android App Components
 
130919 jim cordy - when is a clone not a clone
130919   jim cordy - when is a clone not a clone130919   jim cordy - when is a clone not a clone
130919 jim cordy - when is a clone not a clone
 
Elasticsearch und die Java-Welt
Elasticsearch und die Java-WeltElasticsearch und die Java-Welt
Elasticsearch und die Java-Welt
 
Weaving the ILP Fabric into Bigchain DB
Weaving the ILP Fabric into Bigchain DBWeaving the ILP Fabric into Bigchain DB
Weaving the ILP Fabric into Bigchain DB
 
Bare-knuckle web development
Bare-knuckle web developmentBare-knuckle web development
Bare-knuckle web development
 
Cassandra is great but how do I test my application?
Cassandra is great but how do I test my application?Cassandra is great but how do I test my application?
Cassandra is great but how do I test my application?
 
Work Stealing For Fun & Profit: Jim Nelson
Work Stealing For Fun & Profit: Jim NelsonWork Stealing For Fun & Profit: Jim Nelson
Work Stealing For Fun & Profit: Jim Nelson
 

Similar to Knot.x: when Vert.x and RxJava meet

Customising Your Own Web Framework In Go
Customising Your Own Web Framework In GoCustomising Your Own Web Framework In Go
Customising Your Own Web Framework In GoJonathan Gomez
 
Taming Core Data by Arek Holko, Macoscope
Taming Core Data by Arek Holko, MacoscopeTaming Core Data by Arek Holko, Macoscope
Taming Core Data by Arek Holko, MacoscopeMacoscope
 
Vert.x for Microservices Architecture
Vert.x for Microservices ArchitectureVert.x for Microservices Architecture
Vert.x for Microservices ArchitectureIdan Fridman
 
Meet the squirrel @ #CSHUG
Meet the squirrel @ #CSHUGMeet the squirrel @ #CSHUG
Meet the squirrel @ #CSHUGMárton Balassi
 
Hazelcast and MongoDB at Cloud CMS
Hazelcast and MongoDB at Cloud CMSHazelcast and MongoDB at Cloud CMS
Hazelcast and MongoDB at Cloud CMSuzquiano
 
Ajax tutorial
Ajax tutorialAjax tutorial
Ajax tutorialKat Roque
 
Fun Teaching MongoDB New Tricks
Fun Teaching MongoDB New TricksFun Teaching MongoDB New Tricks
Fun Teaching MongoDB New TricksMongoDB
 
May 2010 - RestEasy
May 2010 - RestEasyMay 2010 - RestEasy
May 2010 - RestEasyJBug Italy
 
Nginx: Accelerate Rails, HTTP Tricks
Nginx: Accelerate Rails, HTTP TricksNginx: Accelerate Rails, HTTP Tricks
Nginx: Accelerate Rails, HTTP TricksAdam Wiggins
 
Developing your first application using FIWARE
Developing your first application using FIWAREDeveloping your first application using FIWARE
Developing your first application using FIWAREFIWARE
 
Cutting Edge Data Processing with PHP & XQuery
Cutting Edge Data Processing with PHP & XQueryCutting Edge Data Processing with PHP & XQuery
Cutting Edge Data Processing with PHP & XQueryWilliam Candillon
 
Do you know what your drupal is doing? Observe it!
Do you know what your drupal is doing? Observe it!Do you know what your drupal is doing? Observe it!
Do you know what your drupal is doing? Observe it!Luca Lusso
 
gRPC on .NET Core - NDC Oslo 2020
gRPC on .NET Core - NDC Oslo 2020gRPC on .NET Core - NDC Oslo 2020
gRPC on .NET Core - NDC Oslo 2020James Newton-King
 
Solving anything in VCL
Solving anything in VCLSolving anything in VCL
Solving anything in VCLFastly
 

Similar to Knot.x: when Vert.x and RxJava meet (20)

Customising Your Own Web Framework In Go
Customising Your Own Web Framework In GoCustomising Your Own Web Framework In Go
Customising Your Own Web Framework In Go
 
RESTEasy
RESTEasyRESTEasy
RESTEasy
 
Taming Core Data by Arek Holko, Macoscope
Taming Core Data by Arek Holko, MacoscopeTaming Core Data by Arek Holko, Macoscope
Taming Core Data by Arek Holko, Macoscope
 
Vert.x for Microservices Architecture
Vert.x for Microservices ArchitectureVert.x for Microservices Architecture
Vert.x for Microservices Architecture
 
Meet the squirrel @ #CSHUG
Meet the squirrel @ #CSHUGMeet the squirrel @ #CSHUG
Meet the squirrel @ #CSHUG
 
Vertx SouJava
Vertx SouJavaVertx SouJava
Vertx SouJava
 
Vertx daitan
Vertx daitanVertx daitan
Vertx daitan
 
Hazelcast and MongoDB at Cloud CMS
Hazelcast and MongoDB at Cloud CMSHazelcast and MongoDB at Cloud CMS
Hazelcast and MongoDB at Cloud CMS
 
Ajax tutorial
Ajax tutorialAjax tutorial
Ajax tutorial
 
Fun Teaching MongoDB New Tricks
Fun Teaching MongoDB New TricksFun Teaching MongoDB New Tricks
Fun Teaching MongoDB New Tricks
 
Ajax Lecture Notes
Ajax Lecture NotesAjax Lecture Notes
Ajax Lecture Notes
 
May 2010 - RestEasy
May 2010 - RestEasyMay 2010 - RestEasy
May 2010 - RestEasy
 
Vert.x devoxx london 2013
Vert.x devoxx london 2013Vert.x devoxx london 2013
Vert.x devoxx london 2013
 
Nginx: Accelerate Rails, HTTP Tricks
Nginx: Accelerate Rails, HTTP TricksNginx: Accelerate Rails, HTTP Tricks
Nginx: Accelerate Rails, HTTP Tricks
 
Developing your first application using FIWARE
Developing your first application using FIWAREDeveloping your first application using FIWARE
Developing your first application using FIWARE
 
Cutting Edge Data Processing with PHP & XQuery
Cutting Edge Data Processing with PHP & XQueryCutting Edge Data Processing with PHP & XQuery
Cutting Edge Data Processing with PHP & XQuery
 
Socket.io
Socket.ioSocket.io
Socket.io
 
Do you know what your drupal is doing? Observe it!
Do you know what your drupal is doing? Observe it!Do you know what your drupal is doing? Observe it!
Do you know what your drupal is doing? Observe it!
 
gRPC on .NET Core - NDC Oslo 2020
gRPC on .NET Core - NDC Oslo 2020gRPC on .NET Core - NDC Oslo 2020
gRPC on .NET Core - NDC Oslo 2020
 
Solving anything in VCL
Solving anything in VCLSolving anything in VCL
Solving anything in VCL
 

Recently uploaded

WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
How to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfHow to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfdanishmna97
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....rightmanforbloodline
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityVictorSzoltysek
 
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...caitlingebhard1
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)Samir Dash
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightSafe Software
 

Recently uploaded (20)

WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
How to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfHow to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cf
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps Productivity
 
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 

Knot.x: when Vert.x and RxJava meet

  • 1. KNOTX.io When Vert.x & RxJava meet highly-efficient and scalable integration approach for modern platforms Maciej Laskowski Tomasz Michalak
  • 2. KNOTX.io 300 pageviews / second Page available in less than 3 seconds
  • 6. KNOTX.io Challenge - The client is one of the biggest perfume and cosmetics retailer in Europe. - Its sales concentrate on an online platform. - The client needs to connect several incompatible systems.
  • 11. KNOTX.io Modern approach ● Scalable ● Transparent ● Reusable ● Each component easy to replace
  • 16. KNOTX.io Knot.x features: Data ingestion <script data-knotx-knots="services,handlebars" data-knotx-service="welcome" type="text/knotx-snippet"> <h1>{{message}}</h1> <div> <div>Message type - {{body.type}}</div> <div>Statistics: {{statistics}}</div> </div> </script> CMS
  • 17. KNOTX.io Knot.x features: Data ingestion { "message": "Hello from Knot.x!", "body": { "type": "greeting", "priority": "1" }, "statistics": 20 } <script data-knotx-knots="services,handlebars" data-knotx-service="welcome" type="text/knotx-snippet"> <h1>{{message}}</h1> <div> <div>Message type - {{body.type}}</div> <div>Statistics: {{statistics}}</div> </div> </script> CMS Service
  • 18. KNOTX.io Knot.x features: Data ingestion <h1>Hello from Knot.x!</h1> <div> <div>Message type - greeting</div> <div>Statistics: 20</div> </div> { "message": "Hello from Knot.x!", "body": { "type": "greeting", "priority": "1" }, "statistics": 20 } <script data-knotx-knots="services,handlebars" data-knotx-service="welcome" type="text/knotx-snippet"> <h1>{{message}}</h1> <div> <div>Message type - {{body.type}}</div> <div>Statistics: {{statistics}}</div> </div> </script> CMS Service Final page
  • 19. KNOTX.io Knot.x features: forms Knot.x supports simple and multi-step forms. Easily handles submission errors, form validations and redirects. Knot.x allows you to define a graph of interconnected steps, responding to user input or site visitor choices.
  • 20. KNOTX.io Knot.x features: prototyping Knot.x gives you the ability to use simple Mocks. This allows you to expose your sample data directly to pages even if the real service is not available yet, and switch to the real service without any further development work.
  • 21. KNOTX.io Knot.x features: extensions Knot.x is a fully modular platform with very flexible extension points that we call Knots and Adapters that efficiently communicates with Knot.x Core using event bus. Thanks to the polyglot nature of Vert.x you can implement extensions in languages other than Java.
  • 22. KNOTX.io is an event-driven, non-blocking, polyglot application framework that runs on the Java Virtual Machine
  • 23. KNOTX.io Actor-like modules in Vert.x VerticleHandlers HTTP?
  • 28. KNOTX.io Knot.x Architecture - CMS (Repository) responds with HTML markup. - REST services respond with JSON. Knot.x Core Modules
  • 30. KNOTX.io Performance What’s ? - message - notification, - HTTP request - command/instruction - file - result - error
  • 31. KNOTX.io Handlers void operation(param1, param2, Handler< > handler) { // … handler.handle( ); // … } void handle( ) { // do something with } Event Loop The Golden Rule: don’t block the Event Loop
  • 34. KNOTX.io Personalized Search (Vert.x Callbacks) public class RequestHandler implements Handler<HttpServerRequest> { @Override public void handle(HttpServerRequest request) { vertx.eventBus().send("user-tracking", userId, reply1 -> { String userTrackingData = (String) reply1.result().body(); }); } }
  • 35. KNOTX.io Personalized Search (Vert.x Callbacks) public class RequestHandler implements Handler<HttpServerRequest> { @Override public void handle(HttpServerRequest request) { vertx.eventBus().send("user-tracking", userId, reply1 -> { String userTrackingData = (String) reply1.result().body(); vertx.eventBus().send("search-engine", query, reply2 -> { String searchEngineData = (String) reply2.result().body(); }); }); } }
  • 36. KNOTX.io Personalized Search (Vert.x Callbacks) public class RequestHandler implements Handler<HttpServerRequest> { @Override public void handle(HttpServerRequest request) { vertx.eventBus().send("user-tracking", userId, reply1 -> { String userTrackingData = (String) reply1.result().body(); vertx.eventBus().send("search-engine", query, reply2 -> { String searchEngineData = (String) reply2.result().body(); String combinedData = userTrackingData + "-" + searchEngineData; vertx.eventBus().send("personalize", combinedData, reply3 -> { request.response().end("Personalized results are: " + reply3.result().body()); }); }); }); } }
  • 40. KNOTX.io Callback Hell public class RequestHandler implements Handler<HttpServerRequest> { @Override public void handle(HttpServerRequest request) { vertx.eventBus().send("user-tracking", userId, reply1 -> { String userTrackingData = (String) reply1.result().body(); vertx.eventBus().send("search-engine", query, reply2 -> { String searchEngineData = (String) reply2.result().body(); String combinedData = userTrackingData + "-" + searchEngineData; vertx.eventBus().send("personalize", combinedData, reply3 -> { request.response().end("Personalized results are: " + reply3.result().body()); }); }); }); } }
  • 42. KNOTX.io RxJava - Observable source: http://reactivex.io/intro.html
  • 43. KNOTX.io RxJava Observable.subscribe( onNext( ), onError( ), onCompleted() ); X Data stream #1: Data stream #2: X | | Each form the stream goes here. Whenever any error happens, it triggers onError and finishes processing. X When all were processed (no more events: ), this is triggered|
  • 46. KNOTX.io Personalized Search (RxJava) public class RequestHandler implements Handler<HttpServerRequest> { @Override public void handle(HttpServerRequest request) { Observable<Message<String>> reply1 = vertx.eventBus() .sendObservable("user-tracking", userId); Observable<Message<String>> reply2 = vertx.eventBus() .sendObservable("search-engine", query); } }
  • 47. KNOTX.io Personalized Search (RxJava) public class RequestHandler implements Handler<HttpServerRequest> { @Override public void handle(HttpServerRequest request) { Observable<Message<String>> reply1 = vertx.eventBus() .sendObservable("user-tracking", userId); Observable<Message<String>> reply2 = vertx.eventBus() .sendObservable("search-engine", query); Observable .zip(reply1, reply2, (Message resp1, Message resp2) -> resp1.body() + "-" + resp2.body()) .subscribe(combinedData -> vertx.eventBus().sendObservable("personalize", combinedData) .subscribe(reply3 -> request.response().end("Personalized results are: " + reply3.body())) ); } }
  • 49. KNOTX.io RxJava - abstraction over low-level threading public class RequestHandler implements Handler<HttpServerRequest> { @Override public void handle(HttpServerRequest request) { Observable<Message<String>> reply1 = vertx.eventBus() .sendObservable("user-tracking", userId); Observable<Message<String>> reply2 = vertx.eventBus() .sendObservable("search-engine", query); Observable .zip(reply1, reply2, (Message resp1, Message resp2) -> resp1.body() + "-" + resp2.body()) .subscribe(combinedData -> vertx.eventBus().sendObservable("personalize", combinedData) .subscribe(reply3 -> request.response().end("Personalized results are: " + reply3.body())) ); } } Nothing happens here. Just declarations.
  • 50. KNOTX.io RxJava - abstraction over low-level threading public class RequestHandler implements Handler<HttpServerRequest> { @Override public void handle(HttpServerRequest request) { Observable<Message<String>> reply1 = vertx.eventBus() .sendObservable("user-tracking", userId); Observable<Message<String>> reply2 = vertx.eventBus() .sendObservable("search-engine", query); Observable .zip(reply1, reply2, (Message resp1, Message resp2) -> resp1.body() + "-" + resp2.body()) .subscribe(combinedData -> vertx.eventBus().sendObservable("personalize", combinedData) .subscribe(reply3 -> request.response().end("Personalized results are: " + reply3.body())) ); } } Nothing happens here. Just declarations. Also, no actions here until we subscribe.
  • 51. KNOTX.io RxJava - abstraction over low-level threading public class RequestHandler implements Handler<HttpServerRequest> { @Override public void handle(HttpServerRequest request) { Observable<Message<String>> reply1 = vertx.eventBus() .sendObservable("user-tracking", userId); Observable<Message<String>> reply2 = vertx.eventBus() .sendObservable("search-engine", query); Observable .zip(reply1, reply2, (Message resp1, Message resp2) -> resp1.body() + "-" + resp2.body()) .subscribe(combinedData -> vertx.eventBus().sendObservable("personalize", combinedData) .subscribe(reply3 -> request.response().end("Personalized results are: " + reply3.body())) ); } } Nothing happens here. Just declarations. Also, no actions here until we subscribe. This subscribe triggers simultaneous calls to search-engine and user-tracking. This subscribe triggers calling personalized service.
  • 55. KNOTX.io Thank you ● Tutorials: www.knotx.io ● Sources & Wiki: https://github.com/Cognifide/knotx ● Twitter: @knotx_project ● Gitter / Google Groups Maciej Laskowski @skejven https://github.com/Skejven Tomasz Michalak @tomichalak https://github.com/tomaszmichalak