SlideShare a Scribd company logo
Serverless functions
with Micronaut
Álvaro Sánchez-Mariscal
@alvaro_sanchez
About me
— Coming from Madrid
!
— Developer since 2001 (Java / Spring stack).
— Former BEA Systems
⚰
and Sun Microsystems
— Founded Salenda in 2007. Left in 2013.
— Working @ OCI since 2015: Groovy, Grails & Micronaut!
— Speaker at conferences like Devoxx, GeeCON,
JavaLand, JavaZone, Codemotion and Spring IO.
! % & ' ( ) * + , -
@alvaro_sanchez
Introducing
@alvaro_sanchez
 Introducing Micronaut
The productivity of Spring Boot / Grails with a
compile-time, non-blocking performance.
— Designed from the ground up with microservices and
the cloud in mind ("Natively Cloud Native").
— Ultra-lightweight and Reactive (based on Netty)
— Integrated AOP and Compile-Time DI for Java, Groovy
and Kotlin.
@alvaro_sanchez
Hello, Galaxy!
interface HelloApi {
@Get("/hello") String hello();
}
@Controller("/")
class HelloServer implements HelloApi {
@Get("/hello")
public String hello() {
return "Hello, Galaxy!";
}
}
@Client("/") // Client Generated at Compile Time
interface HelloClient extends HelloApi {}
@alvaro_sanchez
Hello, Galaxy!
@MicronautTest
class ApplicationTest {
@Inject
HelloClient helloClient;
@Test
void testHello() {
Assertions.assertEquals("Hello, Galaxy!", helloClient.hello());
}
}
@alvaro_sanchez
Natively Cloud Native
— Service Discovery - Consul, Eureka, Route 53 and
Kubernetes.
— Configuration Sharing - Consul Supported and
Amazon ParameterStore planned.
— Client Side Load Balancing - Integrated or Netflix
Ribbon Supported
— Distributed tracing - Zipkin or Jaeger.
— Support for Serverless Computing; AWS Lambda,
@alvaro_sanchez
Ge!ing started
$ curl -s "https://get.sdkman.io" | bash
$ sdk install micronaut
$ mn create-function uppercase
| Generating Java project...
| Function created at /tmp/uppercase
@alvaro_sanchez
Ge!ing started: @FunctionBean
import io.micronaut.function.FunctionBean;
import java.util.function.Function;
@FunctionBean("isbn-validator")
public class IsbnValidatorFunction
implements Function<IsbnValidationRequest, IsbnValidationResponse> {
@Override
public IsbnValidationResponse apply(IsbnValidationRequest request) {
return new IsbnValidationResponse(); //do stuff
}
}
@alvaro_sanchez
Ge!ing started: @FunctionBean
— Use Java 8's java.util.function.*:
— Supplier<O>: no arguments, single result.
— Consumer<I>: single argument, no result.
— BiConsumer<I, J>: two arguments, no result.
— Function<I, O>: single argument, single result.
— Function<I, J, O>: two arguments, single result.
@alvaro_sanchez
Ge!ing started: @Factory
@Factory
public class WordFunctions {
@FunctionBean("uppercase")
public Function<String, String> uppercase() {
return String::toUpperCase;
}
@FunctionBean("lowercase")
public Function<String, String> lowercase() {
return String::toLowerCase;
}
}
@alvaro_sanchez
Ge!ing started: Groovy
//src/main/groovy/com/acme/HelloFunction.groovy
import groovy.transform.Field
import javax.inject.Inject
@Field @Inject HelloService helloService
String hello(String name) {
helloService.hello(name)
}
@alvaro_sanchez
Testing functions
— Micronaut can expose functions as local REST
endpoints.
— @FunctionClient can be leveraged in tests:
@FunctionClient
public interface IsbnValidatorClient {
@Named("isbn-validator")
@Retryable(attempts = "5", delay = "5s")
Single<IsbnValidationResponse> validate(@Body IsbnValidationRequest req);
}
@alvaro_sanchez
Invoking remote functions
— The same @FunctionClient can invoke remote
functions:
# src/main/resources/application.yml
aws:
lambda:
functions:
slack:
functionName: slack-message
region: eu-west-1
@alvaro_sanchez
Functions as CLI applications
— The build is configured to produce runnable JARs:
$ echo '{value: 3}' | java -jar build/libs/math-function-0.1-all.jar
— This allows functions written with Micronaut to be
deployed to platforms that process standard input/
output, such as OpenFaaS.
@alvaro_sanchez
GraalVM
— New Polyglot VM from Oracle.
— Runs JS, Java, Ruby, R etc.
— Ability to turn Java code into native images.
— Can run Micronaut applications and functions
blazingly fast!
@alvaro_sanchez
Demo
Serverless functions with Micronaut
Q & A
Álvaro Sánchez-Mariscal
@alvaro_sanchez

More Related Content

PDF
Reactive microservices with Micronaut - Greach 2018
PDF
Reactive microservices with Micronaut - GR8Conf EU 2018
PDF
6 things you need to know about GORM 6
PDF
Reactive Streams and RxJava2
PDF
Reactive programming in Angular 2
PDF
Reactive Thinking in Java with RxJava2
PDF
Using React with Grails 3
PDF
Reactive Thinking in Java
Reactive microservices with Micronaut - Greach 2018
Reactive microservices with Micronaut - GR8Conf EU 2018
6 things you need to know about GORM 6
Reactive Streams and RxJava2
Reactive programming in Angular 2
Reactive Thinking in Java with RxJava2
Using React with Grails 3
Reactive Thinking in Java

What's hot (20)

PDF
Apache Camel - FUSE community day London 2010 presentation
PDF
Developing, Testing and Scaling with Apache Camel - UberConf 2015
PPT
sbt 0.10 for beginners?
PDF
The JavaFX Ecosystem
PDF
EWD 3 Training Course Part 39: Building a React.js application with QEWD, Part 3
PPTX
Angular beans
PDF
Micronaut For Single Page Apps
PPTX
Spring boot for buidling microservices
PDF
JavaCro'14 - Scala and Java EE 7 Development Experiences – Peter Pilgrim
PPTX
Spring boot Introduction
PDF
Workshop 22: React-Redux Middleware
PDF
HotPush with Ionic 2 and CodePush
PDF
Angular2 Development for Java developers
PPTX
Getting started with ReactJS
PDF
Workshop 13: AngularJS Parte II
PDF
手把手教你如何串接 Log 到各種網路服務
PDF
Intro to JavaScript
PDF
Play Framework workshop: full stack java web app
PDF
JavaCro'14 - Unit testing in AngularJS – Slaven Tomac
Apache Camel - FUSE community day London 2010 presentation
Developing, Testing and Scaling with Apache Camel - UberConf 2015
sbt 0.10 for beginners?
The JavaFX Ecosystem
EWD 3 Training Course Part 39: Building a React.js application with QEWD, Part 3
Angular beans
Micronaut For Single Page Apps
Spring boot for buidling microservices
JavaCro'14 - Scala and Java EE 7 Development Experiences – Peter Pilgrim
Spring boot Introduction
Workshop 22: React-Redux Middleware
HotPush with Ionic 2 and CodePush
Angular2 Development for Java developers
Getting started with ReactJS
Workshop 13: AngularJS Parte II
手把手教你如何串接 Log 到各種網路服務
Intro to JavaScript
Play Framework workshop: full stack java web app
JavaCro'14 - Unit testing in AngularJS – Slaven Tomac
Ad

Similar to Serverless functions with Micronaut (20)

PPTX
React Basic and Advance || React Basic
PDF
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...
PPTX
Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025
PDF
Modular Test-driven SPAs with Spring and AngularJS
PPTX
Java Technology Define In Short Time
PDF
B.Sc. III(VI Sem) Advance Java Unit2: Appet
PDF
Quick Start to iOS Development
PDF
A tour through Swift attributes
PDF
Java concurrency model - The Future Task
PDF
Refactoring JavaScript Applications
PDF
JSAnkara Swift v React Native
PPTX
Micro Front-Ends
PDF
Webpack Encore Symfony Live 2017 San Francisco
PDF
Os Haase
KEY
Play Support in Cloud Foundry
PPTX
Could Virtual Threads cast away the usage of Kotlin Coroutines
PPT
this_is_how_to_start_coding_in_java_lang.ppt
PDF
Refactor Large applications with Backbone
PDF
Refactor Large apps with Backbone
PDF
Refactoring Large Web Applications with Backbone.js
React Basic and Advance || React Basic
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...
Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025
Modular Test-driven SPAs with Spring and AngularJS
Java Technology Define In Short Time
B.Sc. III(VI Sem) Advance Java Unit2: Appet
Quick Start to iOS Development
A tour through Swift attributes
Java concurrency model - The Future Task
Refactoring JavaScript Applications
JSAnkara Swift v React Native
Micro Front-Ends
Webpack Encore Symfony Live 2017 San Francisco
Os Haase
Play Support in Cloud Foundry
Could Virtual Threads cast away the usage of Kotlin Coroutines
this_is_how_to_start_coding_in_java_lang.ppt
Refactor Large applications with Backbone
Refactor Large apps with Backbone
Refactoring Large Web Applications with Backbone.js
Ad

More from Alvaro Sanchez-Mariscal (20)

PDF
Asynchronous and event-driven Grails applications
PDF
Practical Spring Cloud
PDF
Creating applications with Grails, Angular JS and Spring Security - G3 Summit...
PDF
Mastering Grails 3 Plugins - G3 Summit 2016
PDF
Desarrollo de aplicaciones con Grails 3, Angular JS y Spring Security
PDF
Creating applications with Grails, Angular JS and Spring Security - GR8Conf U...
PDF
Mastering Grails 3 Plugins - GR8Conf US 2016
PDF
Mastering Grails 3 Plugins - GR8Conf EU 2016
PDF
Creating applications with Grails, Angular JS and Spring Security - GR8Conf E...
PDF
Mastering Grails 3 Plugins - Greach 2016
PDF
Creating applications with Grails, Angular JS and Spring Security
PDF
Efficient HTTP applications on the JVM with Ratpack - Voxxed Days Berlin 2016
PDF
Efficient HTTP applications on the JVM with Ratpack - JDD 2015
PDF
Stateless authentication with OAuth 2 and JWT - JavaZone 2015
PDF
Stateless authentication for microservices - GR8Conf 2015
PDF
Ratpack 101 - GR8Conf 2015
PDF
Ratpack 101 - GeeCON 2015
PDF
Stateless authentication for microservices - Spring I/O 2015
PDF
Stateless authentication for microservices - Greach 2015
PDF
Stateless authentication for microservices applications - JavaLand 2015
Asynchronous and event-driven Grails applications
Practical Spring Cloud
Creating applications with Grails, Angular JS and Spring Security - G3 Summit...
Mastering Grails 3 Plugins - G3 Summit 2016
Desarrollo de aplicaciones con Grails 3, Angular JS y Spring Security
Creating applications with Grails, Angular JS and Spring Security - GR8Conf U...
Mastering Grails 3 Plugins - GR8Conf US 2016
Mastering Grails 3 Plugins - GR8Conf EU 2016
Creating applications with Grails, Angular JS and Spring Security - GR8Conf E...
Mastering Grails 3 Plugins - Greach 2016
Creating applications with Grails, Angular JS and Spring Security
Efficient HTTP applications on the JVM with Ratpack - Voxxed Days Berlin 2016
Efficient HTTP applications on the JVM with Ratpack - JDD 2015
Stateless authentication with OAuth 2 and JWT - JavaZone 2015
Stateless authentication for microservices - GR8Conf 2015
Ratpack 101 - GR8Conf 2015
Ratpack 101 - GeeCON 2015
Stateless authentication for microservices - Spring I/O 2015
Stateless authentication for microservices - Greach 2015
Stateless authentication for microservices applications - JavaLand 2015

Recently uploaded (20)

PPTX
Advanced SystemCare Ultimate Crack + Portable (2025)
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
CHAPTER 2 - PM Management and IT Context
PPTX
assetexplorer- product-overview - presentation
PDF
Designing Intelligence for the Shop Floor.pdf
PDF
medical staffing services at VALiNTRY
PDF
Download FL Studio Crack Latest version 2025 ?
PDF
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
AutoCAD Professional Crack 2025 With License Key
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Tally Prime Crack Download New Version 5.1 [2025] (License Key Free
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
Complete Guide to Website Development in Malaysia for SMEs
PPTX
L1 - Introduction to python Backend.pptx
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
CCleaner Pro 6.38.11537 Crack Final Latest Version 2025
PPTX
Monitoring Stack: Grafana, Loki & Promtail
PDF
iTop VPN Free 5.6.0.5262 Crack latest version 2025
Advanced SystemCare Ultimate Crack + Portable (2025)
Internet Downloader Manager (IDM) Crack 6.42 Build 41
CHAPTER 2 - PM Management and IT Context
assetexplorer- product-overview - presentation
Designing Intelligence for the Shop Floor.pdf
medical staffing services at VALiNTRY
Download FL Studio Crack Latest version 2025 ?
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
AutoCAD Professional Crack 2025 With License Key
Odoo Companies in India – Driving Business Transformation.pdf
Tally Prime Crack Download New Version 5.1 [2025] (License Key Free
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Complete Guide to Website Development in Malaysia for SMEs
L1 - Introduction to python Backend.pptx
Navsoft: AI-Powered Business Solutions & Custom Software Development
CCleaner Pro 6.38.11537 Crack Final Latest Version 2025
Monitoring Stack: Grafana, Loki & Promtail
iTop VPN Free 5.6.0.5262 Crack latest version 2025

Serverless functions with Micronaut

  • 1. Serverless functions with Micronaut Álvaro Sánchez-Mariscal @alvaro_sanchez
  • 2. About me — Coming from Madrid ! — Developer since 2001 (Java / Spring stack). — Former BEA Systems ⚰ and Sun Microsystems — Founded Salenda in 2007. Left in 2013. — Working @ OCI since 2015: Groovy, Grails & Micronaut! — Speaker at conferences like Devoxx, GeeCON, JavaLand, JavaZone, Codemotion and Spring IO. ! % & ' ( ) * + , - @alvaro_sanchez
  • 5.  Introducing Micronaut The productivity of Spring Boot / Grails with a compile-time, non-blocking performance. — Designed from the ground up with microservices and the cloud in mind ("Natively Cloud Native"). — Ultra-lightweight and Reactive (based on Netty) — Integrated AOP and Compile-Time DI for Java, Groovy and Kotlin. @alvaro_sanchez
  • 6. Hello, Galaxy! interface HelloApi { @Get("/hello") String hello(); } @Controller("/") class HelloServer implements HelloApi { @Get("/hello") public String hello() { return "Hello, Galaxy!"; } } @Client("/") // Client Generated at Compile Time interface HelloClient extends HelloApi {} @alvaro_sanchez
  • 7. Hello, Galaxy! @MicronautTest class ApplicationTest { @Inject HelloClient helloClient; @Test void testHello() { Assertions.assertEquals("Hello, Galaxy!", helloClient.hello()); } } @alvaro_sanchez
  • 8. Natively Cloud Native — Service Discovery - Consul, Eureka, Route 53 and Kubernetes. — Configuration Sharing - Consul Supported and Amazon ParameterStore planned. — Client Side Load Balancing - Integrated or Netflix Ribbon Supported — Distributed tracing - Zipkin or Jaeger. — Support for Serverless Computing; AWS Lambda, @alvaro_sanchez
  • 9. Ge!ing started $ curl -s "https://get.sdkman.io" | bash $ sdk install micronaut $ mn create-function uppercase | Generating Java project... | Function created at /tmp/uppercase @alvaro_sanchez
  • 10. Ge!ing started: @FunctionBean import io.micronaut.function.FunctionBean; import java.util.function.Function; @FunctionBean("isbn-validator") public class IsbnValidatorFunction implements Function<IsbnValidationRequest, IsbnValidationResponse> { @Override public IsbnValidationResponse apply(IsbnValidationRequest request) { return new IsbnValidationResponse(); //do stuff } } @alvaro_sanchez
  • 11. Ge!ing started: @FunctionBean — Use Java 8's java.util.function.*: — Supplier<O>: no arguments, single result. — Consumer<I>: single argument, no result. — BiConsumer<I, J>: two arguments, no result. — Function<I, O>: single argument, single result. — Function<I, J, O>: two arguments, single result. @alvaro_sanchez
  • 12. Ge!ing started: @Factory @Factory public class WordFunctions { @FunctionBean("uppercase") public Function<String, String> uppercase() { return String::toUpperCase; } @FunctionBean("lowercase") public Function<String, String> lowercase() { return String::toLowerCase; } } @alvaro_sanchez
  • 13. Ge!ing started: Groovy //src/main/groovy/com/acme/HelloFunction.groovy import groovy.transform.Field import javax.inject.Inject @Field @Inject HelloService helloService String hello(String name) { helloService.hello(name) } @alvaro_sanchez
  • 14. Testing functions — Micronaut can expose functions as local REST endpoints. — @FunctionClient can be leveraged in tests: @FunctionClient public interface IsbnValidatorClient { @Named("isbn-validator") @Retryable(attempts = "5", delay = "5s") Single<IsbnValidationResponse> validate(@Body IsbnValidationRequest req); } @alvaro_sanchez
  • 15. Invoking remote functions — The same @FunctionClient can invoke remote functions: # src/main/resources/application.yml aws: lambda: functions: slack: functionName: slack-message region: eu-west-1 @alvaro_sanchez
  • 16. Functions as CLI applications — The build is configured to produce runnable JARs: $ echo '{value: 3}' | java -jar build/libs/math-function-0.1-all.jar — This allows functions written with Micronaut to be deployed to platforms that process standard input/ output, such as OpenFaaS. @alvaro_sanchez
  • 17. GraalVM — New Polyglot VM from Oracle. — Runs JS, Java, Ruby, R etc. — Ability to turn Java code into native images. — Can run Micronaut applications and functions blazingly fast! @alvaro_sanchez
  • 18. Demo
  • 20. Q & A Álvaro Sánchez-Mariscal @alvaro_sanchez