SlideShare a Scribd company logo
MichelSchudel
What issues do Micronaut and Quarkus address?
• Lower memory footprint, faster startup
• Ahead-Of-Time (AOT) compilation
• Capability to build native images with GraalVM
• Designed from the ground up with
microservices in mind
• Built-in support for Fault Tolerance
• Monitoring / metrics
• Service discovery
• Cloud deployment
Project source
Website
Start/ Backed by
Github stars
#Contributors
Build tools
Languages
First Commit
github: micronaut-
project/micronaut-
core
micronaut.io
ObjectComputing
2.9K
163
Maven, Gradle
Java, Kotlin, Groovy
2017-03-16
github:
quarkusio/quarkus
quarkus.io
Red Hat
2.9K
175
Maven, Gradle
Java, Kotlin, Scala
2018-06-22
Round 1: Getting started
Round 2: Programming model
Round 3: Database persistency
Round 4: Test support
Round 5: Native images, startup and heap
The match
Conference application
Conference API
Conference Service
Conference RepositoryCountryClient
H2External country service
http(s)
GET /conferences
POST /conferences
{ “name”: “Devoxx”}
{ “name”: “Devoxx”}
{ “name”: “Devoxx”,
“countryName”: “Belgium”}
{ “countryName”: “Belgium”}/conf/{name}/country
GET /conferences-with-country
Let’s start the applications!
mvn compile quarkus:dev
mvn package exec:exec
(or start the main class)
8100
8101
REST Controller
@Path("/conferences")
public class ConferenceResource {
@Inject
ConferenceService conferenceService;
@GET
@Produces(MediaType.APPLICATION_JSON)
public List<Conference> getAll() {
return conferenceService.getAll();
}
@POST
@Consumes(MediaType.APPLICATION_JSON)
public void create(Conference conference) {
conferenceService.create(conference);
}
@Controller("/conferences")
public class ConferenceController {
@Inject
ConferenceService conferenceService;
@Get
@Produces(MediaType.APPLICATION_JSON)
public List<Conference> getAll() {
return conferenceService.getAll();
}
@Post
@Consumes(MediaType.APPLICATION_JSON)
public void create(Conference conference) {
conferenceService.create(conference);
}
Conference API
Conference Service
RepoCountryClient
Conference service
@Singleton
public class ConferenceService {
@Inject
private ConferenceRepository conferenceRepository;
@Inject
CountryClient countryClient;
public List<Conference> getAll() {
return conferenceRepository.findAll();
}
public void create(Conference conference) {
conferenceRepository.save(conference);
}
@Singleton
public class ConferenceService {
@Inject
private ConferenceRepository conferenceRepository;
@Inject
@RestClient
CountryClient countryClient;
public List<Conference> getAll() {
return conferenceRepository.findAll();
}
public void create(Conference conference) {
conferenceRepository.save(conference);
}
Conference API
Conference Service
RepoCountryClient
@Path("/")
@RegisterRestClient
@Retry(maxRetries = 3, delay = 2)
@CircuitBreaker(successThreshold = 1)
public interface CountryClient {
@GET
@Path("/conferences/{name}/country")
Country getCountry(@PathParam("name") String name);
@Client("${country.service.url}")
@Retryable(attempts = “3", delay = "1s")
@CircuitBreaker(reset = "20s")
public interface CountryClient {
@Get("/conferences/{name}/country")
Country getCountry(String name);
mypackage.CountryClient/mp-rest/url=http://localhost:9000/
mypackage.CountryClient/mp-rest/scope=javax.inject.Singleton
country.service.url=http://localhost:9000/
application.properties application.properties / yml
Conference API
Conference Service
RepoCountryClient
REST client
Configuration
app.helloMessage=Hi there! app.helloMessage=Hi there!
application.properties application.properties / application.yml
@ConfigProperty(name = "app.helloMessage",
defaultValue="hello default!")
String helloMessage;
@ConfigProperties(prefix = "app")
public class ConferenceConfiguration {
@Size(min= 5)
public String helloMessage;
}
@Value("${app.helloMessage:hello default!}")
String helloMessage;
@ConfigurationProperties("app")
public class ConferenceConfiguration {
@Size(min = 5)
public String helloMessage;
}
@Property("app.helloMessage")
String helloMessage;
Configuration profiles
app.hello-message=Hi there!
%dev.app.hello-message=Hi from dev!
%test.app.hello-message=Hi from test!
%custom.app.hello-message=Hi from custom!
app.hello-message=Hi there!
application.properties application.properties / application.yml
• dev – during quarkus:dev unless
overridden
• test- during tests
• prod – default profile
• custom
mvnw quarkus:dev –Dquarkus.profile=test
application-test.properties / application-test.yml
app.hello-message=Hi from test!
mvnw exec:exec -Dmicronaut.environments=test
Custom Configuration
Create service file
/META-
INF/services/org.eclipse.microprofile.config.spi.ConfigSour
ce
public class CustomConfigSource implements ConfigSource {
@Override
public Map<String, String> getProperties() {
//my own implementation
return null;
}
@Override
public String getValue(String s) {
//my own implementation
return null;
}
@Override
public String getName() {
return "CustomConfigSource";
}
}
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-discovery-client</artifactId>
</dependency>
spring:
cloud:
config:
enabled: true
uri: http://localhost:8888/
micronaut:
config-client:
enabled: true
• HashiCorp Consul & Vault Support
• AWS Parameter Store Support
• Spring Cloud config server Support
JP
@Singleton
public class ConferenceRepository {
@Inject
EntityManager entityManager;
@Transactional
public List<Conference> findAll() {
TypedQuery<Conference> query = entityManager
.createQuery("select c from Conference c",
Conference.class);
return query.getResultList();
}
@Transactional
public void save(final Conference conference) {
entityManager.persist(conference);
}
}
@Singleton
public class ConferenceRepository {
@Inject
EntityManager entityManager;
@Transactional
public List<Conference> findAll() {
TypedQuery<Conference> query = entityManager
.createQuery("select c from Conference c",
Conference.class);
return query.getResultList();
}
@Transactional
public void save(final Conference conference) {
entityManager.persist(conference);
}
}
JPA persistency Conference API
Conference Service
RepoCountryClient
Improved Quarkus persistency with Panache
@Entity
public class Conference extends PanacheEntity {
private String name;
public String getName() {
return name;
}
public void setName(final String name) {
this.name = name;
}
@Singleton
public class ConferencePanacheRepository {
public List<Conference> findAll() {
return Conference.listAll();
}
@Transactional
public void save(final Conference conference) {
conference.persist();
}
}
Micronaut Data
@Repository
public interface ConferenceCrudRepository extends CrudRepository<Conference, Long> {
List<Conference> findByName(String name);
List<Conference> listOrderByName();
List<Conference> listOrderByNameDesc();
List<Conference> findTop3ByNameLike(String name);
}
@Repository
public interface ConferenceCrudRepository extends CrudRepository<Conference, Long> {
}
@JdbcRepository
public interface ConferenceCrudRepository extends CrudRepository<Conference, Long> {
List<Conference> findByName(String name);
List<Conference> listOrderByName();
List<Conference> listOrderByNameDesc();
List<Conference> findTop3ByNameLike(String name);
}
No more
JPA / Hibernate needed!
Integration testing
@MicronautTest(environments = { "test" })
public class ConferenceITTest {
@Inject
EmbeddedServer embeddedServer;
@Test
@Transactional
public void testConferences() {
Conference conference = new Conference();
conference.setName("Devoxx");
given().body(conference)
.port(embeddedServer.getPort())
.contentType("application/json")
.when()
.post("/conferences")
.then()
.statusCode(200);
given().port(embeddedServer.getPort())
.when()
.get("/conferences")
.then()
.extract()
.path("[0].name")
.equals(“Devoxx");
}
application-test.yml
micronaut:
server:
port: -1
@QuarkusTest
public class ConferenceIT {
@Test
@Transactional
public void testConferences() {
Conference conference = new Conference();
conference.setName("Devoxx");
given().body(conference)
.contentType("application/json")
.when()
.post("/conferences")
.then()
.statusCode(204);
given()
.when()
.get("/conferences")
.then()
.extract()
.path("[0].name")
.equals("Devoxx");
}
quarkus.http.test-port=0
application.properties
Integration testing with Quarkus
@QuarkusTest
public class ConferenceIT {
@Inject
ConferenceResource conferenceResource;
@Test
public void testConferenceInternal() {
conferenceResource.getAll();
}
}
Testing internally
@Mock
@ApplicationScoped
@RestClient
public class MockCountryClient implements CountryClient {
@Override
public Country getCountryOfConference(String name) {
Country country = new Country();
country.setName("Belgium");
return country;
}
}
Mocking
@MicronautTest(environments = { "test" })
public class ConferenceITTest {
@Inject
private ConferenceController conferenceController;
@Test
public void testConferencesInternal() {
conferenceController.getAll();
}
@MockBean(CountryClient.class)
CountryClient countryClient() {
final CountryClient mock = Mockito.mock(CountryClient.class);
Country country = new Country();
country.setName("Belgium");
when(mock.getCountryOfConference(isA(String.class)))
.thenReturn(country);
return mock;
}
Integration testing native images
@SubstrateTest
public class NativeConferenceResourceIT extends ConferenceIT {
// Execute the same tests but in native mode.
}
Building native images with GraalVM
./mvnw package –Pnative –Dnative-
image.docker-build=true
docker build -f
src/main/docker/Dockerfile.native –t
conference-service-quarkus .
./mvnw package
docker build . –t
conference-service-micronaut
Include feature native-imageNo additional actions needed
Let’s run the applications!
JVM: port 8100
Native: port 8200
JVM: port 8101
Native: port 8201
docker run -i --rm -p 8200:8080
conference-service-quarkus
docker run -i --rm -p 8201:8080
conference-service-quarkus-micronaut
https://medium.com/graalvm/lightweight-cloud-native-java-
applications-35d56bc45673
Research Oleg Šelajev (@shelajev)
https://medium.com/graalvm/lightweight-cloud-native-java-
applications-35d56bc45673
Research Oleg Šelajev (@shelajev)
Summary
• Small images, faster startup,
lowest mem usage
• Microprofile Programming
model
• Really fast release cycle
• Close to Spring’s programming model
• Feels little more mature
• Micronaut Data
• More extensive support for existing
cloud environments
• Could do with a nicer
persistency solution
• Few of out-of-the-box
monitoring
• I’d like an initializer site!
MichelSchudel
https://github.com/MichelSchudel/conference-service-quarkus
https://github.com/MichelSchudel/conference-service-micronaut

More Related Content

What's hot

Let's talk about Garbage Collection
Let's talk about Garbage CollectionLet's talk about Garbage Collection
Let's talk about Garbage Collection
Haim Yadid
 
Cloud Native Java GraalVM 이상과 현실
Cloud Native Java GraalVM 이상과 현실Cloud Native Java GraalVM 이상과 현실
Cloud Native Java GraalVM 이상과 현실
Taewan Kim
 
Introducing KRaft: Kafka Without Zookeeper With Colin McCabe | Current 2022
Introducing KRaft: Kafka Without Zookeeper With Colin McCabe | Current 2022Introducing KRaft: Kafka Without Zookeeper With Colin McCabe | Current 2022
Introducing KRaft: Kafka Without Zookeeper With Colin McCabe | Current 2022
HostedbyConfluent
 
Cluster-as-code. The Many Ways towards Kubernetes
Cluster-as-code. The Many Ways towards KubernetesCluster-as-code. The Many Ways towards Kubernetes
Cluster-as-code. The Many Ways towards Kubernetes
QAware GmbH
 
Distributed Locking in Kubernetes
Distributed Locking in KubernetesDistributed Locking in Kubernetes
Distributed Locking in Kubernetes
Rafał Leszko
 
Zero-Copy Event-Driven Servers with Netty
Zero-Copy Event-Driven Servers with NettyZero-Copy Event-Driven Servers with Netty
Zero-Copy Event-Driven Servers with NettyDaniel Bimschas
 
Automate Oracle database patches and upgrades using Fleet Provisioning and Pa...
Automate Oracle database patches and upgrades using Fleet Provisioning and Pa...Automate Oracle database patches and upgrades using Fleet Provisioning and Pa...
Automate Oracle database patches and upgrades using Fleet Provisioning and Pa...
Nelson Calero
 
An introduction to terraform
An introduction to terraformAn introduction to terraform
An introduction to terraform
Julien Pivotto
 
Drools 6.0 (Red Hat Summit)
Drools 6.0 (Red Hat Summit)Drools 6.0 (Red Hat Summit)
Drools 6.0 (Red Hat Summit)
Mark Proctor
 
Understanding Reactive Programming
Understanding Reactive ProgrammingUnderstanding Reactive Programming
Understanding Reactive Programming
Andres Almiray
 
Wars of MySQL Cluster ( InnoDB Cluster VS Galera )
Wars of MySQL Cluster ( InnoDB Cluster VS Galera ) Wars of MySQL Cluster ( InnoDB Cluster VS Galera )
Wars of MySQL Cluster ( InnoDB Cluster VS Galera )
Mydbops
 
Query logging with proxysql
Query logging with proxysqlQuery logging with proxysql
Query logging with proxysql
YoungHeon (Roy) Kim
 
Scylla on Kubernetes: Introducing the Scylla Operator
Scylla on Kubernetes: Introducing the Scylla OperatorScylla on Kubernetes: Introducing the Scylla Operator
Scylla on Kubernetes: Introducing the Scylla Operator
ScyllaDB
 
Scalability, Availability & Stability Patterns
Scalability, Availability & Stability PatternsScalability, Availability & Stability Patterns
Scalability, Availability & Stability Patterns
Jonas Bonér
 
[Outdated] Secrets of Performance Tuning Java on Kubernetes
[Outdated] Secrets of Performance Tuning Java on Kubernetes[Outdated] Secrets of Performance Tuning Java on Kubernetes
[Outdated] Secrets of Performance Tuning Java on Kubernetes
Bruno Borges
 
DevOps Sonatype Nexus Demo_2023.pdf
DevOps Sonatype Nexus Demo_2023.pdfDevOps Sonatype Nexus Demo_2023.pdf
DevOps Sonatype Nexus Demo_2023.pdf
DevOps Tec
 
Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)
Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)
Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)
Svetlin Nakov
 
Micronaut: A new way to build microservices
Micronaut: A new way to build microservicesMicronaut: A new way to build microservices
Micronaut: A new way to build microservices
Luram Archanjo
 
NATS Connect Live!
NATS Connect Live!NATS Connect Live!
NATS Connect Live!
NATS
 
Secrets of Performance Tuning Java on Kubernetes
Secrets of Performance Tuning Java on KubernetesSecrets of Performance Tuning Java on Kubernetes
Secrets of Performance Tuning Java on Kubernetes
Bruno Borges
 

What's hot (20)

Let's talk about Garbage Collection
Let's talk about Garbage CollectionLet's talk about Garbage Collection
Let's talk about Garbage Collection
 
Cloud Native Java GraalVM 이상과 현실
Cloud Native Java GraalVM 이상과 현실Cloud Native Java GraalVM 이상과 현실
Cloud Native Java GraalVM 이상과 현실
 
Introducing KRaft: Kafka Without Zookeeper With Colin McCabe | Current 2022
Introducing KRaft: Kafka Without Zookeeper With Colin McCabe | Current 2022Introducing KRaft: Kafka Without Zookeeper With Colin McCabe | Current 2022
Introducing KRaft: Kafka Without Zookeeper With Colin McCabe | Current 2022
 
Cluster-as-code. The Many Ways towards Kubernetes
Cluster-as-code. The Many Ways towards KubernetesCluster-as-code. The Many Ways towards Kubernetes
Cluster-as-code. The Many Ways towards Kubernetes
 
Distributed Locking in Kubernetes
Distributed Locking in KubernetesDistributed Locking in Kubernetes
Distributed Locking in Kubernetes
 
Zero-Copy Event-Driven Servers with Netty
Zero-Copy Event-Driven Servers with NettyZero-Copy Event-Driven Servers with Netty
Zero-Copy Event-Driven Servers with Netty
 
Automate Oracle database patches and upgrades using Fleet Provisioning and Pa...
Automate Oracle database patches and upgrades using Fleet Provisioning and Pa...Automate Oracle database patches and upgrades using Fleet Provisioning and Pa...
Automate Oracle database patches and upgrades using Fleet Provisioning and Pa...
 
An introduction to terraform
An introduction to terraformAn introduction to terraform
An introduction to terraform
 
Drools 6.0 (Red Hat Summit)
Drools 6.0 (Red Hat Summit)Drools 6.0 (Red Hat Summit)
Drools 6.0 (Red Hat Summit)
 
Understanding Reactive Programming
Understanding Reactive ProgrammingUnderstanding Reactive Programming
Understanding Reactive Programming
 
Wars of MySQL Cluster ( InnoDB Cluster VS Galera )
Wars of MySQL Cluster ( InnoDB Cluster VS Galera ) Wars of MySQL Cluster ( InnoDB Cluster VS Galera )
Wars of MySQL Cluster ( InnoDB Cluster VS Galera )
 
Query logging with proxysql
Query logging with proxysqlQuery logging with proxysql
Query logging with proxysql
 
Scylla on Kubernetes: Introducing the Scylla Operator
Scylla on Kubernetes: Introducing the Scylla OperatorScylla on Kubernetes: Introducing the Scylla Operator
Scylla on Kubernetes: Introducing the Scylla Operator
 
Scalability, Availability & Stability Patterns
Scalability, Availability & Stability PatternsScalability, Availability & Stability Patterns
Scalability, Availability & Stability Patterns
 
[Outdated] Secrets of Performance Tuning Java on Kubernetes
[Outdated] Secrets of Performance Tuning Java on Kubernetes[Outdated] Secrets of Performance Tuning Java on Kubernetes
[Outdated] Secrets of Performance Tuning Java on Kubernetes
 
DevOps Sonatype Nexus Demo_2023.pdf
DevOps Sonatype Nexus Demo_2023.pdfDevOps Sonatype Nexus Demo_2023.pdf
DevOps Sonatype Nexus Demo_2023.pdf
 
Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)
Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)
Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)
 
Micronaut: A new way to build microservices
Micronaut: A new way to build microservicesMicronaut: A new way to build microservices
Micronaut: A new way to build microservices
 
NATS Connect Live!
NATS Connect Live!NATS Connect Live!
NATS Connect Live!
 
Secrets of Performance Tuning Java on Kubernetes
Secrets of Performance Tuning Java on KubernetesSecrets of Performance Tuning Java on Kubernetes
Secrets of Performance Tuning Java on Kubernetes
 

Similar to Battle Of The Microservice Frameworks: Micronaut versus Quarkus edition!

Hexagonal architecture in PHP
Hexagonal architecture in PHPHexagonal architecture in PHP
Hexagonal architecture in PHP
Paulo Victor Gomes
 
Ruby on Rails vs ASP.NET MVC
Ruby on Rails vs ASP.NET MVCRuby on Rails vs ASP.NET MVC
Ruby on Rails vs ASP.NET MVC
Simone Chiaretta
 
RESTEasy
RESTEasyRESTEasy
Arquitecturas de microservicios - Medianet Software
Arquitecturas de microservicios   -  Medianet SoftwareArquitecturas de microservicios   -  Medianet Software
Arquitecturas de microservicios - Medianet Software
Ernesto Hernández Rodríguez
 
May 2010 - RestEasy
May 2010 - RestEasyMay 2010 - RestEasy
May 2010 - RestEasy
JBug Italy
 
Mashups
MashupsMashups
Mashups
Johan Eltes
 
MCE^3 - Kyle Fuller - End-to-end Building Web Services in-swift-mce-2016
MCE^3 - Kyle Fuller - End-to-end Building Web Services in-swift-mce-2016MCE^3 - Kyle Fuller - End-to-end Building Web Services in-swift-mce-2016
MCE^3 - Kyle Fuller - End-to-end Building Web Services in-swift-mce-2016
PROIDEA
 
Performant APIs with GraphQL and PHP (Dutch PHP 2019)
Performant APIs with GraphQL and PHP (Dutch PHP 2019)Performant APIs with GraphQL and PHP (Dutch PHP 2019)
Performant APIs with GraphQL and PHP (Dutch PHP 2019)
Andrew Rota
 
MicroProfile, Docker, Kubernetes, Istio and Open Shift lab @dev nexus
MicroProfile, Docker, Kubernetes, Istio and Open Shift lab @dev nexusMicroProfile, Docker, Kubernetes, Istio and Open Shift lab @dev nexus
MicroProfile, Docker, Kubernetes, Istio and Open Shift lab @dev nexus
Emily Jiang
 
softshake 2014 - Java EE
softshake 2014 - Java EEsoftshake 2014 - Java EE
softshake 2014 - Java EE
Alexis Hassler
 
What's New In Laravel 5
What's New In Laravel 5What's New In Laravel 5
What's New In Laravel 5
Darren Craig
 
Spring in the Cloud - using Spring with Cloud Foundry
Spring in the Cloud - using Spring with Cloud FoundrySpring in the Cloud - using Spring with Cloud Foundry
Spring in the Cloud - using Spring with Cloud Foundry
Joshua Long
 
Native REST Web Services with Oracle 11g
Native REST Web Services with Oracle 11gNative REST Web Services with Oracle 11g
Native REST Web Services with Oracle 11g
Marcelo Ochoa
 
Cloud nativemicroservices jax-london2020
Cloud nativemicroservices   jax-london2020Cloud nativemicroservices   jax-london2020
Cloud nativemicroservices jax-london2020
Emily Jiang
 
Cloud nativemicroservices jax-london2020
Cloud nativemicroservices   jax-london2020Cloud nativemicroservices   jax-london2020
Cloud nativemicroservices jax-london2020
Emily Jiang
 
Clojure and the Web
Clojure and the WebClojure and the Web
Clojure and the Web
nickmbailey
 
Object Graph Mapping with Spring Data Neo4j 3 - Nicki Watt & Michael Hunger @...
Object Graph Mapping with Spring Data Neo4j 3 - Nicki Watt & Michael Hunger @...Object Graph Mapping with Spring Data Neo4j 3 - Nicki Watt & Michael Hunger @...
Object Graph Mapping with Spring Data Neo4j 3 - Nicki Watt & Michael Hunger @...
Neo4j
 
Альона Тудан “Microservices: better for Devs or QA’s?”
Альона Тудан “Microservices: better for Devs or QA’s?” Альона Тудан “Microservices: better for Devs or QA’s?”
Альона Тудан “Microservices: better for Devs or QA’s?”
Dakiry
 
Vertx SouJava
Vertx SouJavaVertx SouJava
Vertx daitan
Vertx daitanVertx daitan

Similar to Battle Of The Microservice Frameworks: Micronaut versus Quarkus edition! (20)

Hexagonal architecture in PHP
Hexagonal architecture in PHPHexagonal architecture in PHP
Hexagonal architecture in PHP
 
Ruby on Rails vs ASP.NET MVC
Ruby on Rails vs ASP.NET MVCRuby on Rails vs ASP.NET MVC
Ruby on Rails vs ASP.NET MVC
 
RESTEasy
RESTEasyRESTEasy
RESTEasy
 
Arquitecturas de microservicios - Medianet Software
Arquitecturas de microservicios   -  Medianet SoftwareArquitecturas de microservicios   -  Medianet Software
Arquitecturas de microservicios - Medianet Software
 
May 2010 - RestEasy
May 2010 - RestEasyMay 2010 - RestEasy
May 2010 - RestEasy
 
Mashups
MashupsMashups
Mashups
 
MCE^3 - Kyle Fuller - End-to-end Building Web Services in-swift-mce-2016
MCE^3 - Kyle Fuller - End-to-end Building Web Services in-swift-mce-2016MCE^3 - Kyle Fuller - End-to-end Building Web Services in-swift-mce-2016
MCE^3 - Kyle Fuller - End-to-end Building Web Services in-swift-mce-2016
 
Performant APIs with GraphQL and PHP (Dutch PHP 2019)
Performant APIs with GraphQL and PHP (Dutch PHP 2019)Performant APIs with GraphQL and PHP (Dutch PHP 2019)
Performant APIs with GraphQL and PHP (Dutch PHP 2019)
 
MicroProfile, Docker, Kubernetes, Istio and Open Shift lab @dev nexus
MicroProfile, Docker, Kubernetes, Istio and Open Shift lab @dev nexusMicroProfile, Docker, Kubernetes, Istio and Open Shift lab @dev nexus
MicroProfile, Docker, Kubernetes, Istio and Open Shift lab @dev nexus
 
softshake 2014 - Java EE
softshake 2014 - Java EEsoftshake 2014 - Java EE
softshake 2014 - Java EE
 
What's New In Laravel 5
What's New In Laravel 5What's New In Laravel 5
What's New In Laravel 5
 
Spring in the Cloud - using Spring with Cloud Foundry
Spring in the Cloud - using Spring with Cloud FoundrySpring in the Cloud - using Spring with Cloud Foundry
Spring in the Cloud - using Spring with Cloud Foundry
 
Native REST Web Services with Oracle 11g
Native REST Web Services with Oracle 11gNative REST Web Services with Oracle 11g
Native REST Web Services with Oracle 11g
 
Cloud nativemicroservices jax-london2020
Cloud nativemicroservices   jax-london2020Cloud nativemicroservices   jax-london2020
Cloud nativemicroservices jax-london2020
 
Cloud nativemicroservices jax-london2020
Cloud nativemicroservices   jax-london2020Cloud nativemicroservices   jax-london2020
Cloud nativemicroservices jax-london2020
 
Clojure and the Web
Clojure and the WebClojure and the Web
Clojure and the Web
 
Object Graph Mapping with Spring Data Neo4j 3 - Nicki Watt & Michael Hunger @...
Object Graph Mapping with Spring Data Neo4j 3 - Nicki Watt & Michael Hunger @...Object Graph Mapping with Spring Data Neo4j 3 - Nicki Watt & Michael Hunger @...
Object Graph Mapping with Spring Data Neo4j 3 - Nicki Watt & Michael Hunger @...
 
Альона Тудан “Microservices: better for Devs or QA’s?”
Альона Тудан “Microservices: better for Devs or QA’s?” Альона Тудан “Microservices: better for Devs or QA’s?”
Альона Тудан “Microservices: better for Devs or QA’s?”
 
Vertx SouJava
Vertx SouJavaVertx SouJava
Vertx SouJava
 
Vertx daitan
Vertx daitanVertx daitan
Vertx daitan
 

More from Michel Schudel

Testing an onion architecture - done right
Testing an onion architecture - done rightTesting an onion architecture - done right
Testing an onion architecture - done right
Michel Schudel
 
What makes a high performance team tick?
What makes a high performance team tick?What makes a high performance team tick?
What makes a high performance team tick?
Michel Schudel
 
Atonomy of-a-tls-handshake-mini-conferentie
Atonomy of-a-tls-handshake-mini-conferentieAtonomy of-a-tls-handshake-mini-conferentie
Atonomy of-a-tls-handshake-mini-conferentie
Michel Schudel
 
Spring boot Under Da Hood
Spring boot Under Da HoodSpring boot Under Da Hood
Spring boot Under Da Hood
Michel Schudel
 
Cryptography 101 for Java Developers - Devoxx 2019
Cryptography 101 for Java Developers - Devoxx 2019Cryptography 101 for Java Developers - Devoxx 2019
Cryptography 101 for Java Developers - Devoxx 2019
Michel Schudel
 
Cryptography 101 for_java_developers, Fall 2019
Cryptography 101 for_java_developers, Fall 2019Cryptography 101 for_java_developers, Fall 2019
Cryptography 101 for_java_developers, Fall 2019
Michel Schudel
 
Cryptography 101 for Java Developers - JavaZone2019
Cryptography 101 for Java Developers - JavaZone2019Cryptography 101 for Java Developers - JavaZone2019
Cryptography 101 for Java Developers - JavaZone2019
Michel Schudel
 
Micronaut brainbit
Micronaut brainbitMicronaut brainbit
Micronaut brainbit
Michel Schudel
 
Java n-plus-1-incl-demo-slides
Java n-plus-1-incl-demo-slidesJava n-plus-1-incl-demo-slides
Java n-plus-1-incl-demo-slides
Michel Schudel
 
Cryptography 101 for Java developers
Cryptography 101 for Java developersCryptography 101 for Java developers
Cryptography 101 for Java developers
Michel Schudel
 
Let's build a blockchain.... in 40 minutes!
Let's build a blockchain.... in 40 minutes!Let's build a blockchain.... in 40 minutes!
Let's build a blockchain.... in 40 minutes!
Michel Schudel
 
Cryptography 101 for Java developers
Cryptography 101 for Java developersCryptography 101 for Java developers
Cryptography 101 for Java developers
Michel Schudel
 
Let's Build A Blockchain... in 40 minutes!
Let's Build A Blockchain... in 40 minutes!Let's Build A Blockchain... in 40 minutes!
Let's Build A Blockchain... in 40 minutes!
Michel Schudel
 
What's new in Java 11
What's new in Java 11What's new in Java 11
What's new in Java 11
Michel Schudel
 
Java 9 overview
Java 9 overviewJava 9 overview
Java 9 overview
Michel Schudel
 
Test your microservices with REST-Assured
Test your microservices with REST-AssuredTest your microservices with REST-Assured
Test your microservices with REST-Assured
Michel Schudel
 

More from Michel Schudel (16)

Testing an onion architecture - done right
Testing an onion architecture - done rightTesting an onion architecture - done right
Testing an onion architecture - done right
 
What makes a high performance team tick?
What makes a high performance team tick?What makes a high performance team tick?
What makes a high performance team tick?
 
Atonomy of-a-tls-handshake-mini-conferentie
Atonomy of-a-tls-handshake-mini-conferentieAtonomy of-a-tls-handshake-mini-conferentie
Atonomy of-a-tls-handshake-mini-conferentie
 
Spring boot Under Da Hood
Spring boot Under Da HoodSpring boot Under Da Hood
Spring boot Under Da Hood
 
Cryptography 101 for Java Developers - Devoxx 2019
Cryptography 101 for Java Developers - Devoxx 2019Cryptography 101 for Java Developers - Devoxx 2019
Cryptography 101 for Java Developers - Devoxx 2019
 
Cryptography 101 for_java_developers, Fall 2019
Cryptography 101 for_java_developers, Fall 2019Cryptography 101 for_java_developers, Fall 2019
Cryptography 101 for_java_developers, Fall 2019
 
Cryptography 101 for Java Developers - JavaZone2019
Cryptography 101 for Java Developers - JavaZone2019Cryptography 101 for Java Developers - JavaZone2019
Cryptography 101 for Java Developers - JavaZone2019
 
Micronaut brainbit
Micronaut brainbitMicronaut brainbit
Micronaut brainbit
 
Java n-plus-1-incl-demo-slides
Java n-plus-1-incl-demo-slidesJava n-plus-1-incl-demo-slides
Java n-plus-1-incl-demo-slides
 
Cryptography 101 for Java developers
Cryptography 101 for Java developersCryptography 101 for Java developers
Cryptography 101 for Java developers
 
Let's build a blockchain.... in 40 minutes!
Let's build a blockchain.... in 40 minutes!Let's build a blockchain.... in 40 minutes!
Let's build a blockchain.... in 40 minutes!
 
Cryptography 101 for Java developers
Cryptography 101 for Java developersCryptography 101 for Java developers
Cryptography 101 for Java developers
 
Let's Build A Blockchain... in 40 minutes!
Let's Build A Blockchain... in 40 minutes!Let's Build A Blockchain... in 40 minutes!
Let's Build A Blockchain... in 40 minutes!
 
What's new in Java 11
What's new in Java 11What's new in Java 11
What's new in Java 11
 
Java 9 overview
Java 9 overviewJava 9 overview
Java 9 overview
 
Test your microservices with REST-Assured
Test your microservices with REST-AssuredTest your microservices with REST-Assured
Test your microservices with REST-Assured
 

Recently uploaded

Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
vrstrong314
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
kalichargn70th171
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 

Recently uploaded (20)

Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 

Battle Of The Microservice Frameworks: Micronaut versus Quarkus edition!

  • 2.
  • 3. What issues do Micronaut and Quarkus address? • Lower memory footprint, faster startup • Ahead-Of-Time (AOT) compilation • Capability to build native images with GraalVM • Designed from the ground up with microservices in mind • Built-in support for Fault Tolerance • Monitoring / metrics • Service discovery • Cloud deployment
  • 4. Project source Website Start/ Backed by Github stars #Contributors Build tools Languages First Commit github: micronaut- project/micronaut- core micronaut.io ObjectComputing 2.9K 163 Maven, Gradle Java, Kotlin, Groovy 2017-03-16 github: quarkusio/quarkus quarkus.io Red Hat 2.9K 175 Maven, Gradle Java, Kotlin, Scala 2018-06-22
  • 5. Round 1: Getting started Round 2: Programming model Round 3: Database persistency Round 4: Test support Round 5: Native images, startup and heap The match
  • 6. Conference application Conference API Conference Service Conference RepositoryCountryClient H2External country service http(s) GET /conferences POST /conferences { “name”: “Devoxx”} { “name”: “Devoxx”} { “name”: “Devoxx”, “countryName”: “Belgium”} { “countryName”: “Belgium”}/conf/{name}/country GET /conferences-with-country
  • 7.
  • 8.
  • 9.
  • 10.
  • 11. Let’s start the applications! mvn compile quarkus:dev mvn package exec:exec (or start the main class) 8100 8101
  • 12.
  • 13.
  • 14. REST Controller @Path("/conferences") public class ConferenceResource { @Inject ConferenceService conferenceService; @GET @Produces(MediaType.APPLICATION_JSON) public List<Conference> getAll() { return conferenceService.getAll(); } @POST @Consumes(MediaType.APPLICATION_JSON) public void create(Conference conference) { conferenceService.create(conference); } @Controller("/conferences") public class ConferenceController { @Inject ConferenceService conferenceService; @Get @Produces(MediaType.APPLICATION_JSON) public List<Conference> getAll() { return conferenceService.getAll(); } @Post @Consumes(MediaType.APPLICATION_JSON) public void create(Conference conference) { conferenceService.create(conference); } Conference API Conference Service RepoCountryClient
  • 15. Conference service @Singleton public class ConferenceService { @Inject private ConferenceRepository conferenceRepository; @Inject CountryClient countryClient; public List<Conference> getAll() { return conferenceRepository.findAll(); } public void create(Conference conference) { conferenceRepository.save(conference); } @Singleton public class ConferenceService { @Inject private ConferenceRepository conferenceRepository; @Inject @RestClient CountryClient countryClient; public List<Conference> getAll() { return conferenceRepository.findAll(); } public void create(Conference conference) { conferenceRepository.save(conference); } Conference API Conference Service RepoCountryClient
  • 16. @Path("/") @RegisterRestClient @Retry(maxRetries = 3, delay = 2) @CircuitBreaker(successThreshold = 1) public interface CountryClient { @GET @Path("/conferences/{name}/country") Country getCountry(@PathParam("name") String name); @Client("${country.service.url}") @Retryable(attempts = “3", delay = "1s") @CircuitBreaker(reset = "20s") public interface CountryClient { @Get("/conferences/{name}/country") Country getCountry(String name); mypackage.CountryClient/mp-rest/url=http://localhost:9000/ mypackage.CountryClient/mp-rest/scope=javax.inject.Singleton country.service.url=http://localhost:9000/ application.properties application.properties / yml Conference API Conference Service RepoCountryClient REST client
  • 17. Configuration app.helloMessage=Hi there! app.helloMessage=Hi there! application.properties application.properties / application.yml @ConfigProperty(name = "app.helloMessage", defaultValue="hello default!") String helloMessage; @ConfigProperties(prefix = "app") public class ConferenceConfiguration { @Size(min= 5) public String helloMessage; } @Value("${app.helloMessage:hello default!}") String helloMessage; @ConfigurationProperties("app") public class ConferenceConfiguration { @Size(min = 5) public String helloMessage; } @Property("app.helloMessage") String helloMessage;
  • 18. Configuration profiles app.hello-message=Hi there! %dev.app.hello-message=Hi from dev! %test.app.hello-message=Hi from test! %custom.app.hello-message=Hi from custom! app.hello-message=Hi there! application.properties application.properties / application.yml • dev – during quarkus:dev unless overridden • test- during tests • prod – default profile • custom mvnw quarkus:dev –Dquarkus.profile=test application-test.properties / application-test.yml app.hello-message=Hi from test! mvnw exec:exec -Dmicronaut.environments=test
  • 19. Custom Configuration Create service file /META- INF/services/org.eclipse.microprofile.config.spi.ConfigSour ce public class CustomConfigSource implements ConfigSource { @Override public Map<String, String> getProperties() { //my own implementation return null; } @Override public String getValue(String s) { //my own implementation return null; } @Override public String getName() { return "CustomConfigSource"; } } <dependency> <groupId>io.micronaut</groupId> <artifactId>micronaut-discovery-client</artifactId> </dependency> spring: cloud: config: enabled: true uri: http://localhost:8888/ micronaut: config-client: enabled: true • HashiCorp Consul & Vault Support • AWS Parameter Store Support • Spring Cloud config server Support
  • 20.
  • 21.
  • 22. JP @Singleton public class ConferenceRepository { @Inject EntityManager entityManager; @Transactional public List<Conference> findAll() { TypedQuery<Conference> query = entityManager .createQuery("select c from Conference c", Conference.class); return query.getResultList(); } @Transactional public void save(final Conference conference) { entityManager.persist(conference); } } @Singleton public class ConferenceRepository { @Inject EntityManager entityManager; @Transactional public List<Conference> findAll() { TypedQuery<Conference> query = entityManager .createQuery("select c from Conference c", Conference.class); return query.getResultList(); } @Transactional public void save(final Conference conference) { entityManager.persist(conference); } } JPA persistency Conference API Conference Service RepoCountryClient
  • 23. Improved Quarkus persistency with Panache @Entity public class Conference extends PanacheEntity { private String name; public String getName() { return name; } public void setName(final String name) { this.name = name; } @Singleton public class ConferencePanacheRepository { public List<Conference> findAll() { return Conference.listAll(); } @Transactional public void save(final Conference conference) { conference.persist(); } }
  • 24. Micronaut Data @Repository public interface ConferenceCrudRepository extends CrudRepository<Conference, Long> { List<Conference> findByName(String name); List<Conference> listOrderByName(); List<Conference> listOrderByNameDesc(); List<Conference> findTop3ByNameLike(String name); } @Repository public interface ConferenceCrudRepository extends CrudRepository<Conference, Long> { } @JdbcRepository public interface ConferenceCrudRepository extends CrudRepository<Conference, Long> { List<Conference> findByName(String name); List<Conference> listOrderByName(); List<Conference> listOrderByNameDesc(); List<Conference> findTop3ByNameLike(String name); } No more JPA / Hibernate needed!
  • 25.
  • 26.
  • 27. Integration testing @MicronautTest(environments = { "test" }) public class ConferenceITTest { @Inject EmbeddedServer embeddedServer; @Test @Transactional public void testConferences() { Conference conference = new Conference(); conference.setName("Devoxx"); given().body(conference) .port(embeddedServer.getPort()) .contentType("application/json") .when() .post("/conferences") .then() .statusCode(200); given().port(embeddedServer.getPort()) .when() .get("/conferences") .then() .extract() .path("[0].name") .equals(“Devoxx"); } application-test.yml micronaut: server: port: -1 @QuarkusTest public class ConferenceIT { @Test @Transactional public void testConferences() { Conference conference = new Conference(); conference.setName("Devoxx"); given().body(conference) .contentType("application/json") .when() .post("/conferences") .then() .statusCode(204); given() .when() .get("/conferences") .then() .extract() .path("[0].name") .equals("Devoxx"); } quarkus.http.test-port=0 application.properties
  • 28. Integration testing with Quarkus @QuarkusTest public class ConferenceIT { @Inject ConferenceResource conferenceResource; @Test public void testConferenceInternal() { conferenceResource.getAll(); } } Testing internally @Mock @ApplicationScoped @RestClient public class MockCountryClient implements CountryClient { @Override public Country getCountryOfConference(String name) { Country country = new Country(); country.setName("Belgium"); return country; } } Mocking @MicronautTest(environments = { "test" }) public class ConferenceITTest { @Inject private ConferenceController conferenceController; @Test public void testConferencesInternal() { conferenceController.getAll(); } @MockBean(CountryClient.class) CountryClient countryClient() { final CountryClient mock = Mockito.mock(CountryClient.class); Country country = new Country(); country.setName("Belgium"); when(mock.getCountryOfConference(isA(String.class))) .thenReturn(country); return mock; }
  • 29. Integration testing native images @SubstrateTest public class NativeConferenceResourceIT extends ConferenceIT { // Execute the same tests but in native mode. }
  • 30.
  • 31.
  • 32. Building native images with GraalVM ./mvnw package –Pnative –Dnative- image.docker-build=true docker build -f src/main/docker/Dockerfile.native –t conference-service-quarkus . ./mvnw package docker build . –t conference-service-micronaut Include feature native-imageNo additional actions needed
  • 33. Let’s run the applications! JVM: port 8100 Native: port 8200 JVM: port 8101 Native: port 8201 docker run -i --rm -p 8200:8080 conference-service-quarkus docker run -i --rm -p 8201:8080 conference-service-quarkus-micronaut
  • 36.
  • 37.
  • 38.
  • 39.
  • 40. Summary • Small images, faster startup, lowest mem usage • Microprofile Programming model • Really fast release cycle • Close to Spring’s programming model • Feels little more mature • Micronaut Data • More extensive support for existing cloud environments • Could do with a nicer persistency solution • Few of out-of-the-box monitoring • I’d like an initializer site!

Editor's Notes

  1. Quarkus uses @ConfigProperty from the microprofile specification. Properties are read from one application.properties file. Profiles are supported. There are three pofiles: dev, test and prod out-of-the-box, but you can specifiy more. Properties of all profiles have to be specified in either the application.properties (with % as prefix), or through jvm parameters (-D) Micronaut uses the @Value construction known from SpringBoot. Configuration profiles are supported and implemented by different property files like –T.yml. This seems a little more clear than with Quarkus. Moreso, micronaut supports integration with Spring Cloud Config server.
  2. Both quarkus and micronaut support Hibernate for database access, with automatic schema generation. Both frameworks support entity managers, no problem. But this feels a little... Well... Midlevel. Quarkus support Panache, which makes life a little bit easier. (show) Micronaut has Micronuat data (formerly predator), which is now on milestone 3. It has a programming model similair to Spring Data, where you can useto make declarative interfaces, as we will see now. Evenmore, you can use this so generate repos base don pure jdbc access, which is really cool. Definitely points to Micronaut here!
  3. Of course jdbc cannot do stuff like lazy loading, dirty checking, optimistic locking and stuff.
  4. Quarkus has the @QuarkusTest annotation which spins up a test version of the application. By default, it spins up on port 8081, so not a random port as we saw in Spring Boot, for example. Mock objects are supported for stubbing test clients. Micronaut has @MicronautTest annotation, same thing. Default is port 8081. Now, micronaut does not recieve the port binding automatically, so you have to set it yourself. Mocking is done through the @MockBean annotation, which you can use to specify any mock you want, for example with Mockito.
  5. You can start micronaut with a java –jar target\...jar command. Quarkus doesn’t build fat jars of the box, so if you want to do that, you need to specify the <uberJar> configuration in your maven-quarkus-plugin. If we start the application with java-jar, quarkus is notably quicker here then micronaut, but both are faster than SpringBoot. File size wise, there is not much difference. Quarkus fat jar is 42MB while Micronaut’s is 46MB, both definately smaller than any Spring Boot application that boast the same functionality. Mmemory usage: Quarkus: 425MB/176MB SpringBoot: 547MB/428MB Micronaut: 541MB/251MB Points go to Quarkus here.
  6. You can start micronaut with a java –jar target\...jar command. Quarkus doesn’t build fat jars of the box, so if you want to do that, you need to specify the <uberJar> configuration in your maven-quarkus-plugin. If we start the application with java-jar, quarkus is notably quicker here then micronaut, but both are faster than SpringBoot. File size wise, there is not much difference. Quarkus fat jar is 42MB while Micronaut’s is 46MB, both definately smaller than any Spring Boot application that boast the same functionality. Mmemory usage: Quarkus: 425MB/176MB SpringBoot: 547MB/428MB Micronaut: 541MB/251MB Points go to Quarkus here.
  7. You can start micronaut with a java –jar target\...jar command. Quarkus doesn’t build fat jars of the box, so if you want to do that, you need to specify the <uberJar> configuration in your maven-quarkus-plugin. If we start the application with java-jar, quarkus is notably quicker here then micronaut, but both are faster than SpringBoot. File size wise, there is not much difference. Quarkus fat jar is 42MB while Micronaut’s is 46MB, both definately smaller than any Spring Boot application that boast the same functionality. Mmemory usage: Quarkus: 425MB/176MB SpringBoot: 547MB/428MB Micronaut: 541MB/251MB Points go to Quarkus here.
  8. You can start micronaut with a java –jar target\...jar command. Quarkus doesn’t build fat jars of the box, so if you want to do that, you need to specify the <uberJar> configuration in your maven-quarkus-plugin. If we start the application with java-jar, quarkus is notably quicker here then micronaut, but both are faster than SpringBoot. File size wise, there is not much difference. Quarkus fat jar is 42MB while Micronaut’s is 46MB, both definately smaller than any Spring Boot application that boast the same functionality. Mmemory usage: Quarkus: 425MB/176MB SpringBoot: 547MB/428MB Micronaut: 541MB/251MB Points go to Quarkus here.