Download - An Introduction to the Vert.x framework

Transcript
Page 1: An Introduction to the Vert.x framework

OSCONAn Introduction to the

Vert.x framework

Wednesday, July 24, 13

Page 2: An Introduction to the Vert.x framework

Hi Folks! I’m Nate @zznate http://github.com/zznate

Wednesday, July 24, 13

Page 3: An Introduction to the Vert.x framework

So what is Vert.x?

Wednesday, July 24, 13

Page 4: An Introduction to the Vert.x framework

“...lightweight high-performance application platform for the JVM...”

Wednesday, July 24, 13

Page 5: An Introduction to the Vert.x framework

“...for the JVM”

Wednesday, July 24, 13

Page 6: An Introduction to the Vert.x framework

The JVM- mature concurrency model- very stable- heterogeneous

Wednesday, July 24, 13

Page 7: An Introduction to the Vert.x framework

But most importantly...Polyglot support!

Wednesday, July 24, 13

Page 8: An Introduction to the Vert.x framework

You can do a lot in 40 minutes...

Wednesday, July 24, 13

Page 9: An Introduction to the Vert.x framework

http://vertx.io(scroll down)

To follow along, see: https://github.com/vert-x/vertx-examples 

Wednesday, July 24, 13

Page 10: An Introduction to the Vert.x framework

“Web apps”

Wednesday, July 24, 13

Page 11: An Introduction to the Vert.x framework

Wednesday, July 24, 13

Page 12: An Introduction to the Vert.x framework

Wednesday, July 24, 13

Page 15: An Introduction to the Vert.x framework

"We need to make configuration as easy as possible so expensive tools are not needed." 

Wednesday, July 24, 13

Page 16: An Introduction to the Vert.x framework

Said no enterpirse software company ever.

Wednesday, July 24, 13

Page 17: An Introduction to the Vert.x framework

JDBC Module Config:{ address : "com.bloidonia.jdbcpersistor" driver : "org.hsqldb.jdbcDriver", url : "jdbc:hsqldb:mem:test", username : "someuser", password : "somepass",}

https://github.com/timyates/mod-jdbc-persistor

Wednesday, July 24, 13

Page 18: An Introduction to the Vert.x framework

“New [Java | jvm-language] Framework!!”

Wednesday, July 24, 13

Page 20: An Introduction to the Vert.x framework

But Vert.x was different.

Wednesday, July 24, 13

Page 21: An Introduction to the Vert.x framework

...for the JVM

Wednesday, July 24, 13

Page 22: An Introduction to the Vert.x framework

Mature concurrency model- vert.x is based on the Reactor pattern

http://en.wikipedia.org/wiki/Reactor_pattern

Wednesday, July 24, 13

Page 23: An Introduction to the Vert.x framework

Platform Stability- HTTP, HTTPS, TCP, SSL- clients and servers- All netty 4.0 based

http://netty.io/

Wednesday, July 24, 13

Page 24: An Introduction to the Vert.x framework

Homogenous- file system API- data-driven event bus

Wednesday, July 24, 13

Page 25: An Introduction to the Vert.x framework

Polyglot- Container modules- currently supports: JavaScript, Ruby, Python, Groovy, Scala,

Wednesday, July 24, 13

Page 26: An Introduction to the Vert.x framework

Scalability Modularity Developer-focused

Wednesday, July 24, 13

Page 27: An Introduction to the Vert.x framework

Scalability

Wednesday, July 24, 13

Page 28: An Introduction to the Vert.x framework

Event Bus- simple, distributed peer-to-peer - pub/sub or point-to-point- local or distributed**- ‘data only’ with limited number of types

Wednesday, July 24, 13

Page 29: An Introduction to the Vert.x framework

Event Bus... but it’s a good idea to use JSON!

(completely language agnostic - we are building services and decoupling!)

Wednesday, July 24, 13

Page 30: An Introduction to the Vert.x framework

“local or distributed”

BONUS: EventBus can extend directly to the browser

http://vertx.io/core_manual_java.html#sockjs-eventbus-bridge

Wednesday, July 24, 13

Page 31: An Introduction to the Vert.x framework

Modularity

Wednesday, July 24, 13

Page 32: An Introduction to the Vert.x framework

{ address : "com.bloidonia.jdbcpersistor" driver : "org.hsqldb.jdbcDriver", url : "jdbc:hsqldb:mem:test", username : "someuser", password : "somepass",}

Wednesday, July 24, 13

Page 33: An Introduction to the Vert.x framework

Module Benefits- encapsulation- distributability- dynamic- structured

Wednesday, July 24, 13

Page 34: An Introduction to the Vert.x framework

Encapsulation- classpath and dependency- classloader isolation(but multiple instances of the module will share classloaders)

Wednesday, July 24, 13

Page 35: An Introduction to the Vert.x framework

Distributabilitypushed to/loaded from:- file system (contained or shared)- maven central- bintray

http://vertx.io/mods_manual.html#how-vertx-locates-modules 

Wednesday, July 24, 13

Page 36: An Introduction to the Vert.x framework

Dynamic- automatically downloaded and installed- loaded/unloaded at runtime

Wednesday, July 24, 13

Page 37: An Introduction to the Vert.x framework

Structured- minimalistic descriptor syntax- sub-modules (can be thought of as "this module 'deploys' these modules" directive)

Wednesday, July 24, 13

Page 38: An Introduction to the Vert.x framework

Running a module and providing it’s configuration

Wednesday, July 24, 13

Page 39: An Introduction to the Vert.x framework

Modules and Concurency- Worker (blocking)- Event loop (non-blocking)

Wednesday, July 24, 13

Page 40: An Introduction to the Vert.x framework

Worker Modules- single or multi-threaded- useful for legacy APIs(ex. JDBC)

Wednesday, July 24, 13

Page 41: An Introduction to the Vert.x framework

Event Loop Modules- control number of instances- instance per core is ideal

Wednesday, July 24, 13

Page 42: An Introduction to the Vert.x framework

Modules (best for last...)

Wednesday, July 24, 13

Page 43: An Introduction to the Vert.x framework

Dog food-ing FTW:Language runtimes are all module based

Wednesday, July 24, 13

Page 44: An Introduction to the Vert.x framework

Developer friendly

Wednesday, July 24, 13

Page 45: An Introduction to the Vert.x framework

Polyglot (cont’d)

Wednesday, July 24, 13

Page 46: An Introduction to the Vert.x framework

JavaScript- Rhino - DynJS: invokeDynamic based implementation

http://dynjs.org/https://github.com/vert-x/mod-lang-dynjs

Wednesday, July 24, 13

Page 47: An Introduction to the Vert.x framework

Simple Programming Model- just don’t block the event loop!- reactor pattern- worker delegates

http://en.wikipedia.org/wiki/Reactor_patternhttp://vertx.io/core_manual_java.html#writing-verticles 

Wednesday, July 24, 13

Page 48: An Introduction to the Vert.x framework

Provides most common services- HTTP/HTTPS- TCP/SSL- SockJS- File system access (includes sendfile() wrappers)

Wednesday, July 24, 13

Page 49: An Introduction to the Vert.x framework

Build It: Maven- archetype integration- plug-in for launching/running

http://vertx.io/maven_dev.html 

Wednesday, July 24, 13

Page 50: An Introduction to the Vert.x framework

Build It: Gradle- template project to clone

http://vertx.io/gradle_dev.html 

Wednesday, July 24, 13

Page 51: An Introduction to the Vert.x framework

Test It!- JUnit integration utilities- Container and IDE integration(IntelliJ and Eclipse)

Wednesday, July 24, 13

Page 52: An Introduction to the Vert.x framework

Summary- General purpose application platform- Polyglot development- Asynchronous APIs

Wednesday, July 24, 13

Page 53: An Introduction to the Vert.x framework

Vert.x:Simple. Not Simplistic.

Wednesday, July 24, 13

Page 54: An Introduction to the Vert.x framework

Questions?

Wednesday, July 24, 13