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

Serverless Java with Spring Boot

Serverless Java with Spring Boot

Applications in a microservices architecture can communicate with each other in different ways. Adopting an event-driven paradigm based on asynchronous messaging provides services with a way of communicating while reducing runtime coupling. Applications in a microservices architecture can communicate with each other in different ways. Adopting an event-driven paradigm based on asynchronous messaging provides services with a way of communicating while reducing runtime coupling. Functions are a natural way of implementing event-driven business logic regarding suppliers, processors, and consumers. Furthermore, when going serverless, we aim at executables with instant startup and efficiency. Enter Spring.

Spring Cloud Function favours using the functional programming paradigm to implement your business logic and provides useful features to build data pipelines, including type conversion and function composition. Functions can be exposed through different options (like web endpoints or message channels), and adapters can run them on platforms like Knative, AWS Lambda, Azure Functions, and GCP Functions.

Spring Cloud Stream integrates your functions with messaging systems like RabbitMQ and Kafka without requiring any change to your code.

Finally, Spring Native lets you compile your applications as native executables using GraalVM and provides instant startup, instant peak performance, and reduced memory consumption.

C20b9829daddbee16e359b0a750660a5?s=128

Thomas Vitale

June 08, 2022
Tweet

More Decks by Thomas Vitale

Other Decks in Technology

Transcript

  1. Thomas Vitale DevTalks June 8th, 2022 Serverless Java With Spring

    Boot @vitalethomas
  2. Systematic • Software Architect at Systematic, Denmark. • Author of

    “Cloud Native Spring in Action” (Manning). • Spring Security and Spring Cloud contributor. Thomas Vitale thomasvitale.com @vitalethomas
  3. Serverless thomasvitale.com @vitalethomas

  4. Serverless Architectures Developers focus on code Focus on business logic

    Developer Platform Infrastructure Provisioning Workload Management Autoscaling Scaling to zero thomasvitale.com @vitalethomas
  5. Spring Native thomasvitale.com @vitalethomas

  6. Spring Native Native executables with GraalVM Slower Heavier Build Instant

    Startup Reduced Memory Consumption Instant Peak Performance Fewer Runtime Optimizations thomasvitale.com @vitalethomas
  7. Packaging Spring Boot JAR and native thomasvitale.com @vitalethomas JAR Native

    Gradle bootJar Maven spring-boot:repackage Gradle nativeCompile Maven -Pnative package
  8. Packaging Spring Boot Container images with Cloud Native Buildpacks thomasvitale.com

    @vitalethomas Container Image Gradle bootBuildImage Maven spring-boot:build-image
  9. Knative thomasvitale.com @vitalethomas

  10. Knative Serving Serverless Containers on Kubernetes Developer-friendly abstractions From code

    to URL Autoscaling Scaling to zero Progressive Rollouts Request-driven Event-driven Cloud agnostic thomasvitale.com @vitalethomas
  11. Serverless experience on Kubernetes From containers to deployment with Knative

    Image pack kpack bootBuildImage kn URL Kubernetes Cluster Container Container Container Knative Serving thomasvitale.com @vitalethomas
  12. Functions thomasvitale.com @vitalethomas

  13. Functional Programming Paradigm Java 8 Functional Interfaces thomasvitale.com @vitalethomas Supplier<O>

    Function<I,O> Consumer<I>
  14. Spring Cloud Function thomasvitale.com @vitalethomas

  15. Spring Cloud Function Business logic as functions thomasvitale.com @vitalethomas Transparent

    Type Conversion Function Arity Function Composition Reactive Support JAR Functions
  16. Spring Cloud Function Deployment and integrations thomasvitale.com @vitalethomas Knative CloudEvents

    RSocket Azure Functions Google Cloud Functions AWS Lambda
  17. CloudEvents Interoperability and standardization Metadata Data Id Source Type Payload

    JSON AMQP Kafka MQTT thomasvitale.com @vitalethomas
  18. Spring Cloud Stream thomasvitale.com @vitalethomas

  19. Spring Cloud Stream Event-driven microservices thomasvitale.com @vitalethomas Integration with event

    brokers Bindings with functions Publish Subscribe Consumer Groups Partitions
  20. 'HVWLQDWLRQ%LQGHU 'HVWLQDWLRQ %LQGLQJ .DIND 5DEELW04 )XQFWLRQ 6SULQJ%RRW$SSOLFDWLRQ 'HVWLQDWLRQ %LQGLQJ 6SULQJ&ORXG6WUHDP$SSOLFDWLRQ0RGHO

    thomasvitale.com @vitalethomas
  21. Discount codes Manning • 35% discount code, valid for all

    products in all format • ctwdevtalksro22 • manning.com
  22. https://github.com/ThomasVitale/awesome-spring

  23. Resources Source code and more • Sample project: • https://github.com/ThomasVitale/devtalks-2022-serverless-java

    • Knative and Spring - Bringing back the func: • https://youtu.be/EKDYE_dStTI thomasvitale.com @vitalethomas
  24. Thomas Vitale DevTalks June 8th, 2022 Serverless Java With Spring

    Boot @vitalethomas