Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Microservices with Micronaut - practical approach

Microservices with Micronaut - practical approach

1. Micronaut: A New Hope
2. Reflection-based approach to DI/AOP
3. Micronaut compile-time approach to DI/AOP
4. Sample Project: LAB Insurance Sales Portal
5. Accessing Relational Database with JPA
6. Mock Database for Testing
7. Accessing MongoDB
8. Exposing REST Exposing - simple way
9. Talking to Other Services Using Kafka
10. Talking to Other Services with HttpClient
11. Service Discovery with Consul
12. Client-Side Load Balancing with Ribbon
13. Securing Services with JWT
14. Running Scheduled Tasks
15. Tracing with Zipkin
16. Management and Monitoring
17. Deployment

B30c151ccb4d043a2028691515db4130?s=128

Robert Witkowski

November 09, 2018
Tweet

Transcript

  1. Wojciech Suwała, Head Architect, ASC LAB Robert Kuśmierek, Lead Software

    Engineer, ASC LAB Robert Witkowski, Senior Software Engineer, ASC LAB Microservices with Micronaut - practical approach
  2. 2 http://micronaut.io/ A modern, JVM-based, full-stack framework for building modular,

    easily testable microservice applications.
  3. 3 http://micronaut.io/

  4. Micronaut: A New Hope • lightweight and reactive • producing

    small and fast executables • supports Java, Kotlin, Groovy development • supports Maven/Gradle as build tools • designed with microservices and cloud computing in mind with a lot of cloud-native features like: – service discovery, – distributed tracing and logging, – asynchronous communication using Kafka, – retriable HTTP clients, – circuit breakers, – scalability and load balancing
  5. Reflection-based approach to DI/AOP • no common reflection cache in

    Java, each library/framework produces a unique reflection cache. This makes it extremely difficult to optimize memory consumption • reflective calls are much more difficult for the JIT to optimize • traditional AOP is the heavy reliance on runtime proxy creation which slows app performance, makes debugging harder and increases memory consumption
  6. Micronaut compile-time approach to DI/AOP • uses Ahead of Time

    (AOT) compilation via annotation processors or AST transforms for Groovy • improves startup performance • reduces memory consumption • reducing proxies and stack trace sizes • improving debugging
  7. Sample Project: LAB Insurance Sales Portal https://github.com/asc-lab/micronaut-microservices-poc

  8. 8 Accessing Relational Database with JPA pom.xml application.yml * REMARK:

    in newest version all artifacts from io.micronaut* started from “micronaut-” Example: <artifactId>micronaut-jdbc-hikari</artifactId>
  9. 9 Accessing Relational Database with JPA

  10. 10 Mock Database for Testing

  11. 11 Accessing MongoDB pom.xml application.yml * REMARK: in newest version

    all artifacts from io.micronaut* started from “micronaut-” Example: <artifactId>micronaut-jdbc-hikari</artifactId>
  12. 12 Accessing MongoDB

  13. 13 Exposing REST Exposing - simple way

  14. 14 Exposing REST Exposing - better consistency between client definitions

    and controllers
  15. 15 Exposing REST Exposing - better consistency between client definitions

    and controllers
  16. 16 Talking to Other Services Using Kafka pom.xml application.yml *

    REMARK: in newest version all artifacts from io.micronaut* started from “micronaut-” Example: <artifactId>micronaut-jdbc-hikari</artifactId>
  17. 17 Talking to Other Services Using Kafka - publish event

  18. 18 Talking to Other Services Using Kafka - subscribe event

  19. 19 Talking to Other Services with HttpClient - client

  20. 20 Service Discovery with Consul pom.xml application.yml * REMARK: in

    newest version all artifacts from io.micronaut* started from “micronaut-” Example: <artifactId>micronaut-jdbc-hikari</artifactId>
  21. 21 Client-Side Load Balancing with Ribbon pom.xml application.yml * REMARK:

    in newest version all artifacts from io.micronaut* started from “micronaut-” Example: <artifactId>micronaut-jdbc-hikari</artifactId>
  22. 22 Securing Services with JWT pom.xml application.yml * REMARK: in

    newest version all artifacts from io.micronaut* started from “micronaut-” Example: <artifactId>micronaut-jdbc-hikari</artifactId>
  23. 23 Running Scheduled Tasks

  24. 24 Tracing with Zipkin pom.xml application.yml * REMARK: in newest

    version all artifacts from io.micronaut* started from “micronaut-” Example: <artifactId>micronaut-jdbc-hikari</artifactId>
  25. 25 Management and Monitoring pom.xml application.yml * REMARK: in newest

    version all artifacts from io.micronaut* started from “micronaut-” Example: <artifactId>micronaut-jdbc-hikari</artifactId>
  26. Deployment • docker-compose – localhost only – consul-based service- discovery

    • kubernetes – local & cloud – dns-based service- discovery
  27. More information about slides? https://asc.altkom.pl/en/blog/ microservices-micronaut/

  28. 28 asc.altkom.pl github.com/asc-lab @AltkomSC asc-lab@altkom.pl