Vous êtes sur la page 1sur 22

autodiscoverable

microservices with Andy Moncsek

vertx3
About me
Andy Moncsek

Senior Consultant Application development

Trivadis AG Switzerland

Email: Andy.Moncsek@Trivadis.com

Twitter: @AndyAHCP
Agenda
about microservices
F
E
Vert.x 3 introduction A
G

C
microservices on top of Vert.x 3 H
B
C
I
F
E
A
G

about microservices C
H
B
C
I
characteristics of microservices [1 Martin
Fowler]

component oriented, replaceable, independent

focus on business capabilities

UNIX style: do one thing well & work together

A
F
E
A
smart endpoint & dump pipes (no ESB ;-) ) A
G
A
C
A
A
H
B
A
distributed / decentralized data C
A
AI
microservice design patterns

Architecture patterns

Router/Aggregator/Chained/shared-data

Deployment patterns

instance per host, VM, Container A


F
E
A
A
G
A
C
A
A
H
B
A
C
A
AI
microservice design patterns

Interaction/communication pattern

Request-Reply vs. Pub-Sub / Events vs.


Queries/Commands

Service discovery
A
F
serverside/clientside-discovery / self-/3d-party- E
A
registration A
G
A
C
A
A
H
B
A
C
A
AI
F
E
A
G

Vert.x 3 C
H
B
C
I
Vert.X 3
(tool-kit for building reactive
applications)
nodeJS for Java developers :-D (sorry Tim)

event driven / non blocking

polyglot (written in Java 8)

general purpose (web, backend)

http://vert-x3.github.io, current version: v3.0-milestone6


Vert.X 3 (terms)
Vert.X

Verticle

Event Bus

A
F
E
A
Eventloop vs. Worker A
G
A
C
A
A
H
B
A
C
A
AI
Vert.X 3 (terms)
Scaling, Cluster / HA

VerticleFactory

packaging

A
F
E
A
TCP, UDP, HTTP, WebSocket, SocketJS, FileSystem,.. A
G
A
C
A
A
H
B
A
C
A
AI
F
E
A
G

DEMO C
H
B
C
I

Vert.x 3
F
E
A
G
microservices on top
C
of Vert.x 3 H
B
C
I
https://github.com/amoAHCP/vert.x-microservice
Vert.X microservice framework
current status: working prototype!

idea: all-in-one microservice framework based on Vert.X

components:

service Verticle

service router / API gateway

service registry / heartbeat A


F
E
A
service discovery A
G
A
C
A
A
H
B
A
C
A
AI
Vert.X microservice framework - service
Verticle
@ApplicationPath("/articleService")

@Path("/comments/:id")
@OperationType(Type.REST_GET)
findComments(@PathParam("id") final String id, Message m)

@Path("/fetchByArticleIdWS")
@OperationType(Type.WEBSOCKET)
Verticle fetchByArticleIdWS(String id, WSMessageReply r)

desc. @Path("/fetchByArticleId")
@OperationType(Type.EVENTBUS)
fetchByArticleId(String id, EBMessageReply r)
Vert.X microservice framework - router / gateway
client
@Path("/articleService/comments/:id")

client
@Path(/../fetchByArticleIdWS")

@Path(/..byArticleId) service
client
service
router Event Bus
service
/gateway Event Bus

host:port Event Bus


service

service

Vert.X cluster
Vert.X microservice framework - registry /
heartbeat

heart- service
service
service
service

beat ping

router service

/gateway
host:port service
service
service
service
register

registry register

Vert.X cluster
Vert.X microservice framework - discovery

router servi servi


ce
ce
/gatew servi
ce
discovery.service(name, op-> ay servi
servi
ce
op.operation(path, p->
host:po ce

p.eventBusSend(message",r->{
rtregis
// reply
try
});

fail
)

fail
); Vert.X cluster
F
E
A
G

DEMO C
H
B
C
I

Vert.x microservice
framework
F
E

any A
G

C
questions? H
B
C
I
F
E
A
G

Thank you C
H
B
C
I
[1] http://www.infoq.com/news/2014/11/gotober-fowler-
microservices

[2] http://www.adam-
bien.com/roller/abien/entry/the_perfect_javaee_microser
vice

[3] https://www.voxxed.com/blog/2015/04/coupling-
versus-autonomy-in-microservices/

[4] https://www.voxxed.com/blog/2015/04/microservice-
design-patterns/

Vous aimerez peut-être aussi