Presentation is loading. Please wait.

Presentation is loading. Please wait.

autodiscoverable microservices with vertx3

Similar presentations


Presentation on theme: "autodiscoverable microservices with vertx3"— Presentation transcript:

1 autodiscoverable microservices with vertx3
Andy Moncsek

2 About me Andy Moncsek Senior Consultant Application development
Trivadis AG Switzerland

3 Agenda about microservices Vert.x 3 introduction
H F I about microservices Vert.x 3 introduction microservices on top of Vert.x 3

4 C E B A G H F I about microservices

5 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 1 Martin Fowler : A E F G C H B I

6 microservice design patterns
Architecture patterns Router/Aggregator/Chained/shared-data Deployment patterns instance per host, VM, Container be aware of different depl. patterns Req.-Resp.: response expected, need to know who to ask; Pub-Sub. : service registers itself Events (order 123 created), Queries/Commands : what should happen A E F G C H B I

7 microservice design patterns
Interaction/communication pattern Request-Reply vs. Pub-Sub / Events vs. Queries/Commands Service discovery serverside/clientside-discovery / self-/3d-party- registration be aware of different depl. patterns Req.-Resp.: response expected, need to know who to ask; Pub-Sub. : service registers itself Events (order 123 created), Queries/Commands : what should happen A E F G C H B I

8 C E B A G H F I Vert.x 3

9 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) current version: v3.0-milestone6

10 Vert.X 3 (terms) Vert.X Verticle Event Bus Eventloop vs. Worker F E A
1: The runtime env. either as binary dist. , embedded, fat-jar 2: Verticles are chunks of code that get deployed and run by Vert.x 3: connects all parts of your application (Verticles) / clusterable (Hazlecast) 4: default: Event Loop single threaded - Don’t block the event loop! / Worker Verticles A E F G C H B I

11 Vert.X 3 (terms) Scaling, Cluster / HA VerticleFactory packaging
TCP, UDP, HTTP, WebSocket, SocketJS, FileSystem,….. 1: define number of instances (1 thread/instance), Clustering: „EventBus over network“, HA: failover 2: VerticleFactory: SPI to extend Vert.x (different languages, Spring) 3: no custom modules anymore (simple maven & maven-shade-plugin) 4: create … A E F G C H B I

12 C E B A G H F I DEMO Vert.x 3

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

14 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 A E F G C H B I

15 Vert.X microservice framework - service Verticle
@ApplicationPath("/articleService") Verticle @Path("/comments/:id") @OperationType(Type.REST_GET) final String id, Message m) classical „jersey-style“ Path + method vs. async handler registration Why? „reactive / event-driven“ is cool but for many developers still „neuland“ classical input/output (method with parameter and return type) is not applicable (it blocks!)… solution message reply handler @Path("/fetchByArticleIdWS") @OperationType(Type.WEBSOCKET) fetchByArticleIdWS(String id, WSMessageReply r) desc. @Path("/fetchByArticleId") @OperationType(Type.EVENTBUS) fetchByArticleId(String id, EBMessageReply r)

16 Vert.X microservice framework - router / gateway
client router /gateway host:port @Path("/articleService/comments/:id") @Path(„/../fetchByArticleIdWS") @Path(„/..byArticleId“) service Event Bus Vert.X cluster

17 Vert.X microservice framework - registry / heartbeat
challenge: many verticles instances (lokal and cluster) needs to synchronize registration process on startup… solution: cluster-wide counter challenge registry: clusterWideMap is not iterate able… solution: key is the router-key, value is a blob of a descriptor object with all registered descriptions generally figure out how dropwizard is usable for heartbeat router /gateway host:port ping register unreg. registry register Vert.X cluster

18 Vert.X microservice framework - discovery
router /gatew ay host:po rt regis try discovery.service(„name“, op-> ); client / server API the same connects through vertx instance or REST-URL op.operation(„path“, p-> ) fail p.eventBusSend(„message",r->{ // reply }); fail Vert.X cluster

19 Vert.x microservice framework
B A G H F I DEMO Vert.x microservice framework

20 C E B A G H F I any questions?

21 C E B A G H F I Thank you

22 [1] http://www.infoq.com/news/2014/11/gotober-fowler- microservices
[2] bien.com/roller/abien/entry/the_perfect_javaee_microser vice [3] versus-autonomy-in-microservices/ [4] design-patterns/


Download ppt "autodiscoverable microservices with vertx3"

Similar presentations


Ads by Google