Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Building Microservices with Micronaut: A Full-Stack JVM-Based Framework

104 views

Published on

Micronaut, introduced in early 2018 by Object Computing, is a full-stack JVM-based framework for creating microservices-based, cloud native, and serverless applications that can be written in Java, Groovy, or Kotlin. This new framework provides a simple compile-time, aspect-oriented programming API that does not use reflection. Micronaut supports GraalVM-native images and offers compile-time support for Swagger, validation, and mapping annotations. With its own nonblocking web server built on top of Netty, reactive clients can be built declaratively and are implemented at compile time. This session provides an overview of Micronaut, followed by a live demonstration of an application with microservices written in Java, Groovy, and Kotlin, respectively.

Published in: Technology
  • Be the first to comment

Building Microservices with Micronaut: A Full-Stack JVM-Based Framework

  1. 1. BUILDING MICROSERVICESBUILDING MICROSERVICES WITH MICRONAUTWITH MICRONAUT ORACLE CODE ONEORACLE CODE ONE September 18, 2019September 18, 2019 Michael P. RedlichMichael P. Redlich 1 . 1
  2. 2. WHO'S MIKE?WHO'S MIKE? Bachelor of Science, Computer Science from Senior Research Technician, petrochemical research organization Java Queue News Editor, Past President, (ACGNJ) Founder & Co-Facilitator, Rutgers University InfoQ Amateur Computer Group of New Jersey ACGNJ Java Users Group 1 . 2
  3. 3. OBJECTIVESOBJECTIVES What is Micronaut? Features Why Micronaut? JVM Language Support Getting Started Live Demo 2
  4. 4. WHAT IS MICRONAUT?WHAT IS MICRONAUT? A full-featured, full-stack JVM-based lightweight application framework for creating microservice- based, cloud-native and serverless applications that can be written in Java, Groovy, and Kotlin Developed at (OCI) , Principal Software Engineer and Grails and Micronaut Product Lead at OCI Object Computing, Inc. Graeme Rocher
  5. 5. 3 . 1
  6. 6. First introduced at the in March 2018 Designed from the ground up for microservices and serverless applications Latest version: 1.2.2 Greach Conference 3 . 2
  7. 7. PROJECTS (MODULES)PROJECTS (MODULES) Micronaut AWS Micronaut GCP Micronaut RabbitMQ Micronaut Test Micronaut for Spring Micronaut Security 3 . 3
  8. 8. Based on Ahead-of-Time compilation vs. runtime re ection runtime re ection has inherent memory and performance costs 3 . 4
  9. 9. FEATURESFEATURES HTTP SERVERHTTP SERVER Fully reactive and non-blocking HTTP server built on support for Reactor and Auto con guration for common databases Netty RxJava
  10. 10. 4 . 1
  11. 11. HTTP CLIENTHTTP CLIENT Declarative, reactive, compile-time HTTP client Automatic service discovery Automatic load balancing 4 . 2
  12. 12. Support for: (OpenAPI) Amazon Web Services Google Cloud Platform GraalVM GraphQL gRPC Swagger 4 . 3
  13. 13. Microservice patterns such as: service discovery distributed tracing circuit breaker 4 . 4
  14. 14. WHY MICRONAUT?WHY MICRONAUT? LET'S TRAVEL BACK IN TIME TO 2008LET'S TRAVEL BACK IN TIME TO 2008 Grails 1.0 released Applications were monoliths Before the advent of technologies such as: Angular React Docker Microservices
  15. 15. 5 . 1
  16. 16. Attempt to t monolith-focused framework into microservices environment Spring and Grails weren't designed for the micro- environment 5 . 2
  17. 17. Graeme RocherGraeme Rocher Grails & Micronaut Lead at OCIGrails & Micronaut Lead at OCI “We believe Micronaut is the basis for a framework for the future, by resolving this tension by eliminating all use of re ection and producing all annotation metadata, proxies and framework infrastructure at compilation time through a set of annotation processors and AST transformations that perform Ahead-of-Time (AOT) compilation. What this allows Micronaut to achieve is blazing fast startup time, low memory consumption and crucially improved compatibility with GraalVM native image.” 5 . 3
  18. 18. LANGUAGE AND BUILD TOOLSLANGUAGE AND BUILD TOOLS JVM LANGUAGESJVM LANGUAGES
  19. 19. 6 . 1
  20. 20. BUILD TOOLSBUILD TOOLS 6 . 2
  21. 21. GETTING STARTEDGETTING STARTED INSTALLING MICRONAUTINSTALLING MICRONAUT $ sdk install micronaut
  22. 22. 7 . 1
  23. 23. 7 . 2
  24. 24. BUILT-IN PROFILESBUILT-IN PROFILES Generate skeleton, yet working, applications as aGenerate skeleton, yet working, applications as a building block for developing web or command linebuilding block for developing web or command line applicationsapplications create-app create-controller create-client 7 . 3
  25. 25. GENERATE AN INITIAL APPLICATIONGENERATE AN INITIAL APPLICATION Default Language: JavaDefault Language: Java $ mn create-app org.redlich.demo $ mn create-app org.redlich.demo --lang groovy $ mn create-app org.redlich.demo --lang kotlin 7 . 4
  26. 26. GENERATE AN INITIAL APPLICATIONGENERATE AN INITIAL APPLICATION Default Build Tool: GradleDefault Build Tool: Gradle $ mn create-app org.redlich.demo $ mn create-app org.redlich.demo --build maven 7 . 5
  27. 27. 7 . 6
  28. 28. GeneratedGenerated application.ymlapplication.yml lele micronaut: application: name: demo 7 . 7
  29. 29. GeneratedGenerated micronaut-cli.ymlmicronaut-cli.yml lele profile: service defaultPackage: org.redlich --- testFramework: junit sourceLanguage: java 7 . 8
  30. 30. GeneratedGenerated Application.javaApplication.java lele package org.redlich; import io.micronaut.runtime.Micronaut; public class Application { public static void main(String[] args) { Micronaut.run(Application.class); } } 7 . 9
  31. 31. $ ./gradlew run $ ./mvnw compile exec:exec 7 . 10
  32. 32. 7 . 11
  33. 33. $ mn create-controller HelloController 7 . 12
  34. 34. 7 . 13
  35. 35. GeneratedGenerated HelloController.javaHelloController.java lele package org.redlich; import io.micronaut.http.annotation.Controller; import io.micronaut.http.annotation.Get; import io.micronaut.http.HttpStatus; @Controller("/hello") public class HelloController { @Get("/") public HttpStatus index() { return HttpStatus.OK; } } 7 . 14
  36. 36. DEMO APPLICATIONDEMO APPLICATION A book inventory application built on three microservices Based on a written by , senior software engineer at OCI Uses , a distributed service mesh to connect, secure, and configure services across any runtime platform and public or private cloud tutorial Sergio del Amo Caballero Consul
  37. 37. 8 . 1
  38. 38. MICROSERVICESMICROSERVICES books microservice (Groovy) inventory microservice (Kotlin) gateway microservice (Java) 8 . 2
  39. 39. 8 . 3
  40. 40. BOOKS MICROSERVICE (GROOVY)BOOKS MICROSERVICE (GROOVY) $ mn create-app example.micronaut.books --lang groovy 8 . 4
  41. 41. INVENTORY MICROSERVICE (KOTLIN)INVENTORY MICROSERVICE (KOTLIN) $ mn create-app example.micronaut.inventory --lang kotlin 8 . 5
  42. 42. GATEWAY MICROSERVICE (JAVA)GATEWAY MICROSERVICE (JAVA) $ mn create-app example.micronaut.gateway 8 . 6
  43. 43. 9
  44. 44. NY/NJ/PA JAVA USERS GROUPSNY/NJ/PA JAVA USERS GROUPS  ACGNJ Java Users Group facilitated by Mike Redlich & Barry Burd NYJavaSIG facilitated by Frank Greco javasig.org javasig.com
  45. 45. 10 . 1
  46. 46. PhillyJUG facilitated by Paul Burton, et.al. Princeton Java Users Group facilitated by Yakov Fain meetup.com/PhillyJUG meetup.com/NJFlex 10 . 2
  47. 47. FURTHER READINGFURTHER READING INFOQ TECHNICAL ARTICLESINFOQ TECHNICAL ARTICLES Sergio del Amo Caballero December 6, 2018 Sergio del Amo Caballero October 5, 2018 Micronaut Tutorial: Part 2: Easy Distributed Tracing, JWT Security and AWS Lambda Deployment Micronaut Tutorial: How to Build Microservices with This JVM- Based Framework
  48. 48. 11 . 1
  49. 49. INFOQ NEWSINFOQ NEWS May 14, 2019 December 31, 2018 October 19, 2018 Micronaut 1.1 Features Enhanced Support for Building Cloud- Native Applications Micronaut for Spring Allows Spring Boot Apps to Run as Micronaut Apps The Road to Micronaut 1.0: A JVM-Based Full-Stack Framework 11 . 2
  50. 50. UPCOMING ACGNJ JAVA USERSUPCOMING ACGNJ JAVA USERS GROUP MEETINGSGROUP MEETINGS Tuesday, October 8, 2019 Tuesday, October 22, 2019 Monday, November 18, 2019 Beautiful SDK Design in Java for APIs Reza Rahman Ray Tsang Micah Silverman 12
  51. 51. UPCOMING EVENTSUPCOMING EVENTS Monday-Friday, November 11-15, 2019 Hyatt Regency San Francisco QCon San Francisco 13
  52. 52. MICRONAUT RESOURCESMICRONAUT RESOURCES     Website Guides Documentation News 14
  53. 53. CONTACT INFOCONTACT INFO      redlich.net mike@redlich.net @mpredli slideshare.net/mpredli01 github.com/mpredli01/micronaut- bookstore 15
  54. 54. ACKNOWLEDGEMENTSACKNOWLEDGEMENTS Object Computing, Inc. Graeme Rocher Sergio del Amo Caballero 16
  55. 55. THANKS!THANKS! 17

×