autodiscoverable microservices with vertx3

22
autodiscoverable microservices with vertx3 Andy Moncsek

Transcript of autodiscoverable microservices with vertx3

autodiscoverable microservices with

vertx3Andy Moncsek

About me

• Andy Moncsek

• Senior Consultant Application development

• Trivadis AG Switzerland

• Email: [email protected]

• Twitter: @AndyAHCP

Agenda

• about microservices

• Vert.x 3 introduction

• microservices on top of Vert.x 3

C

E

B

A

C

G

H

F

I

about microservices

C

E

B

A

C

G

H

F

I

characteristics of microservices [1

Martin Fowler]

• component oriented, replaceable, independent

• focus on business capabilities

• UNIX style: do one thing well & work together

• smart endpoint & dump pipes (no ESB ;-) )

• distributed / decentralized data

AAAE

AF

AGAC

AHABAC

AI

microservice design patterns

• Architecture patterns

• Router/Aggregator/Chained/shared-data

• Deployment patterns

• instance per host, VM, Container

AAAE

AF

AGAC

AHABAC

AI

microservice design patterns

• Interaction/communication pattern

• Request-Reply vs. Pub-Sub / Events vs. Queries/Commands

• Service discovery

• serverside/clientside-discovery / self-/3d-party-registration AA

AEAF

AGAC

AHABAC

AI

Vert.x 3

C

E

B

A

C

G

H

F

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

• Eventloop vs. Worker AAAE

AF

AGAC

AHABAC

AI

Vert.X 3 (terms)

• Scaling, Cluster / HA

• VerticleFactory

• packaging

• TCP, UDP, HTTP, WebSocket, SocketJS, FileSystem,….. AAAE

AF

AGAC

AHABAC

AI

Vert.x 3

DEMO

C

E

B

A

C

G

H

F

I

microservices on top of Vert.x 3

C

E

B

A

C

G

H

F

Ihttps://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

• service discovery AAAE

AF

AGAC

AHABAC

AI

Vert.X microservice framework - service Verticle

Verticle

@ApplicationPath("/articleService")

desc.

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

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

@Path("/fetchByArticleId")@OperationType(Type.EVENTBUS)fetchByArticleId(String id, EBMessageReply r)

Vert.X microservice framework - router / gateway

Event Bus

Event Bus

Event Bus

Vert.X cluster

service

service

service

service

service

router/gatewayhost:port

@Path("/articleService/comments/:id")

@Path(„/../fetchByArticleIdWS")@Path(„/..byArticleId“)

client

client

client

serviceservice

serviceservice

Vert.X microservice framework - registry / heartbeat

router/gatewayhost:port

service

service

service

service

service

Vert.X cluster

registry register

register

heart-beat ping

unre

g.

Vert.X microservice framework - discovery

Vert.X cluster

service serv

ice

service serv

ice

service

router/

gateway

host:port

registry

discovery.service(„name“, op->

);

op.operation(„path“, p->

)

fail

p.eventBusSend(„message",r->{

// reply});fail

Vert.x microservice framework

DEMO

C

E

B

A

C

G

H

F

I

any questions?

C

E

B

A

C

G

H

F

I

Thank you

C

E

B

A

C

G

H

F

I