SlideShare une entreprise Scribd logo
1  sur  25
Télécharger pour lire hors ligne
Cloud-ready Micro Java EE 8
Ondro Mihályi | Payara Engineer
| @omihalyi
| @Payara_Fish
Who am I?
• Payara Engineer
• Java EE developer and lecturer
• Conference speaker
• Czech JUG leader
• Member of JCP and Eclipse foundation
• @omihalyi
What’s this all about?
• How lightweight is Java EE, really?
• What’s in Java EE 8 today?
• What could be in Java EE EE4J ??? in the future?
A little (recent) history...
• 12 June 2013: Java EE 7 Released
•Docker was 3 months old
•WildFly was still JBoss AS (and no Swarm)
•Before Spring Boot
•WebSphere Liberty Profile recently released
A little (recent) history...
• 21 September 2017: Java EE 8 Released, 4 years later
•Docker is now the dominant container format
•WildFly have fully product-ised WildFly Swarm
•Spring Boot have been making JARs not WARs for a few years
•IBM released Open Liberty
•Payara entered the fray and released Payara Micro
•Eclipse MicroProfile is established and progressing
What’s in Java EE 8?
• Upgrades
•JAX-RS 2.1
•Servlet 4.0
•Bean Validation 2.0
•JSF 2.3
•CDI 2.0
•JSON-P 1.1
• New
•Java EE Security
•JSON-B
What is Payara Micro?
• Payara Micro is…
•Micro! (~60MB disk size, ~30 MB RAM)
•Dynamically scalable
•Fully embeddable (if you want…)
•Web Profile “plus”
•On Maven Central
<dependency>
<groupId>fish.payara.api</groupId>
<ArtifactId>payara-api</artifactId>
<version>5.0.0-Alpha3</version>
<type>jar</type>
</dependency>
What is Payara Micro?
• Key APIs
• Servlets, JSTL, EL, JSP
• WebSockets
• JSF
• JAX-RS
• EJB Lite
• JTA
• JPA
• JCA (pluggable JMS)
• Bean Validation
• CDI
• Interceptors
• JBatch
• Concurrency
• JCache
• Config
• SOAP, remote EJB
Demo
Demo Scenario
• Stock! Micro Stock!
• Publish StockTicker events
• Listen on different endpoints
Demo Scenario
StockTickerStockTickerStockTicker
Produces Events
StockWeb
Consumes Events
Websocket Push
Demo 1
Creating the Stock Ticker
• What do we need?
• Stock object
• Stock Ticker to set the stock price
• Publisher for CDI event bus
Demo 2
Creating the Stock Web listener
• What do we need?
• Websocket endpoint
• Class to manage Websocket sessions
• Class to listen for Stock events on the CDI event bus
• Both these responsibilities can be in the same class
Integrating Java EE 8 Features
Demo
Making our MicroService generic
• What do we need to change?
• Non-Payara services can’t listen on the CDI event bus
• Solution: REST Server Sent Events (from JAX-RS 2.1)
• External services may not have access to a Stock object (or interface)
• Solution: Serialise our Stock object as JSON using JSON-B 1.0
private JsonObject toJson() {
JsonObjectBuilder objectBuilder = Json.createObjectBuilder()
.add("symbol", symbol)
.add("description", description)
.add("price", price);
return objectBuilder.build();
}
@Override
public String toString() {
return this.toJson().toString();
}
Demo 3 JSON-P manual toJson() method
@JsonbNillable
public class Stock implements Serializable {
private String symbol;
@JsonbTransient
private String description;
@JsonbProperty("RandomPrice")
private double price;
@Override
public String toString() {
JsonbConfig nillableConfig = new JsonbConfig().withNullValues(true);
return JsonbBuilder.create(nillableConfig).toJson(this);
}
}
private void observe() {
source.register((sseEvent)
-> {
this.stock = JsonbBuilder.create().fromJson(sseEvent.readData(), Stock.class);
});
source.open();
}
Demo 3 JSON-B serialisation and deserialisation
Learn more:
http://json-b.net
private void reactiveClient() {
CompletionStage<Response> cs1 = ClientBuilder.newClient()
.target("http://localhost:8080/jax-rs-2-1/books")
.request()
.rx()
.get();
CompletionStage<Response> cs2 = ClientBuilder.newClient()
.target("http://localhost:8080/jax-rs-2-1/magazines")
.request()
.rx()
.get();
cs1.thenCombine(cs2, (r1, r2) ->
r1.readEntity(String.class) + r2.readEntity(String.class))
.thenAccept(System.out::println);
}
Source: https://www.ibm.com/developerworks/library/j-whats-new-in-javaee-8/index.html
Author: Alex Theedom
Demo 4 JAX-RS reactive client API
Demo 4 SSE server endpoint in JAX-RS
@GET
@Produces(MediaType.SERVER_SENT_EVENTS)
public void eventOutput(@Context SseEventSink eventSink){
// send a single event
eventSink.send(sse.newEvent(stockTicker.getStock().toString()));
// registers the requester as a consumer of events
sseBroadcaster.register(eventSink);
}
@POST
@Path("broadcast")
@Consumes(MediaType.MULTIPART_FORM_DATA)
public void broadcast(@FormParam("event") String event){
// broadcasts the event to all registered consumers
sseBroadcaster.broadcast(sse.newEvent(event));
}
Demo 4
StockTickerStockTickerStockTicker
StockWeb
JAX-RS SSE
Client
Javascript SSE Client
The Future of Java EE…?
Demo 5
Integrating MicroProfile 1.1
<dependency>
<groupId>
org.eclipse.microprofile
</groupId>
<artifactId>
Microprofile-bom
</artifactId>
<version>1.1.0</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
@Inject
@ConfigProperty(name = "stockticker.url")
private String stockTickerURL;
@Inject
@ConfigProperty(name = "stockticker.url")
private Instance<String> tickerURLConfig;
...
String url = tickerURLConfig.get()
Demo 5
Integrating MicroProfile
// Set system property
java -jar -Dstockticker.url=http://localhost:8081/StockTicker-1.0-SNAPSHOT/rest/sse StockWeb/target/StockWeb-
1.0-SNAPSHOT-microbundle.jar
// Use asadmin to set property in Hazelcast cluster
asadmin> set-config-property
--propertyName=stockticker.url
--propertyValue=http://localhost:8080/StockTicker-1.0-SNAPSHOT/rest/sse
--source=cluster
// Use asadmin to set property for specific instances in Hazelcast cluster
asadmin> send-asadmin-command
--targets=‘*‘
--command=set-config-property
--
--propertyName=stockticker.url
--propertyValue=http://localhost:8080/StockTicker-1.0-SNAPSHOT/rest/sse
--source=config
--sourceName=sever-config
Recap
•Java EE is incredibly adaptable to changing needs
• Recent change has been driven by vendors’ implementations
• Eclipse MicroProfile offers interesting ideas for the future
Thank you!

Contenu connexe

Tendances

Micronaut and the Power of Ahead of Time Compilation - Devnexus 2019
Micronaut and the Power of Ahead of Time Compilation - Devnexus 2019Micronaut and the Power of Ahead of Time Compilation - Devnexus 2019
Micronaut and the Power of Ahead of Time Compilation - Devnexus 2019graemerocher
 
CIS 2015- Building IAM for OpenStack- Steve Martinelli
CIS 2015- Building IAM for OpenStack- Steve MartinelliCIS 2015- Building IAM for OpenStack- Steve Martinelli
CIS 2015- Building IAM for OpenStack- Steve MartinelliCloudIDSummit
 
Microservice - Up to 500k CCU
Microservice - Up to 500k CCUMicroservice - Up to 500k CCU
Microservice - Up to 500k CCUViet Tran
 
Robe - A brand new robe for Dropwizard
Robe - A brand new robe for DropwizardRobe - A brand new robe for Dropwizard
Robe - A brand new robe for DropwizardSeray Uzgur
 
Java introduction by lara technologies
Java introduction by lara technologiesJava introduction by lara technologies
Java introduction by lara technologiestechnologieslara
 
Legacy To Docker - Lessons learned and demo of OpenUnison
Legacy To Docker - Lessons learned and demo of OpenUnisonLegacy To Docker - Lessons learned and demo of OpenUnison
Legacy To Docker - Lessons learned and demo of OpenUnisonMarc Boorshtein
 
Going Native With The OSGi Service Layer - Sascha Zelzer
Going Native With The OSGi Service Layer - Sascha ZelzerGoing Native With The OSGi Service Layer - Sascha Zelzer
Going Native With The OSGi Service Layer - Sascha Zelzermfrancis
 
WSO2 Microservices Framework for Java - Product Overview
WSO2 Microservices Framework for Java - Product OverviewWSO2 Microservices Framework for Java - Product Overview
WSO2 Microservices Framework for Java - Product OverviewWSO2
 

Tendances (18)

Hibernate
HibernateHibernate
Hibernate
 
Java solution
Java solutionJava solution
Java solution
 
Micronaut and the Power of Ahead of Time Compilation - Devnexus 2019
Micronaut and the Power of Ahead of Time Compilation - Devnexus 2019Micronaut and the Power of Ahead of Time Compilation - Devnexus 2019
Micronaut and the Power of Ahead of Time Compilation - Devnexus 2019
 
CIS 2015- Building IAM for OpenStack- Steve Martinelli
CIS 2015- Building IAM for OpenStack- Steve MartinelliCIS 2015- Building IAM for OpenStack- Steve Martinelli
CIS 2015- Building IAM for OpenStack- Steve Martinelli
 
Microservice - Up to 500k CCU
Microservice - Up to 500k CCUMicroservice - Up to 500k CCU
Microservice - Up to 500k CCU
 
Lift
LiftLift
Lift
 
Robe - A brand new robe for Dropwizard
Robe - A brand new robe for DropwizardRobe - A brand new robe for Dropwizard
Robe - A brand new robe for Dropwizard
 
Akka.Net Overview
Akka.Net OverviewAkka.Net Overview
Akka.Net Overview
 
OSGi introduction
OSGi introductionOSGi introduction
OSGi introduction
 
Java onebrazil hk2
Java onebrazil hk2Java onebrazil hk2
Java onebrazil hk2
 
Java introduction by lara technologies
Java introduction by lara technologiesJava introduction by lara technologies
Java introduction by lara technologies
 
Above and Beyond JDK 9, 10, 11, 12... - Branko Mihaljević and Martin Žagar on...
Above and Beyond JDK 9, 10, 11, 12... - Branko Mihaljević and Martin Žagar on...Above and Beyond JDK 9, 10, 11, 12... - Branko Mihaljević and Martin Žagar on...
Above and Beyond JDK 9, 10, 11, 12... - Branko Mihaljević and Martin Žagar on...
 
Legacy To Docker - Lessons learned and demo of OpenUnison
Legacy To Docker - Lessons learned and demo of OpenUnisonLegacy To Docker - Lessons learned and demo of OpenUnison
Legacy To Docker - Lessons learned and demo of OpenUnison
 
Modular JavaScript
Modular JavaScriptModular JavaScript
Modular JavaScript
 
OSGi compendium
OSGi compendiumOSGi compendium
OSGi compendium
 
Java programming and security
Java programming and securityJava programming and security
Java programming and security
 
Going Native With The OSGi Service Layer - Sascha Zelzer
Going Native With The OSGi Service Layer - Sascha ZelzerGoing Native With The OSGi Service Layer - Sascha Zelzer
Going Native With The OSGi Service Layer - Sascha Zelzer
 
WSO2 Microservices Framework for Java - Product Overview
WSO2 Microservices Framework for Java - Product OverviewWSO2 Microservices Framework for Java - Product Overview
WSO2 Microservices Framework for Java - Product Overview
 

Similaire à Cloud-ready Micro Java EE 8

OTN Developer Days - Java EE 6
OTN Developer Days - Java EE 6OTN Developer Days - Java EE 6
OTN Developer Days - Java EE 6glassfish
 
OpenNTF Webinar 2022-08 - XPages Jakarta EE Support in Practice
OpenNTF Webinar 2022-08 - XPages Jakarta EE Support in PracticeOpenNTF Webinar 2022-08 - XPages Jakarta EE Support in Practice
OpenNTF Webinar 2022-08 - XPages Jakarta EE Support in PracticeJesse Gallagher
 
Bootstrapping a simple enterprise application with Java EE successor, Jakarta...
Bootstrapping a simple enterprise application with Java EE successor, Jakarta...Bootstrapping a simple enterprise application with Java EE successor, Jakarta...
Bootstrapping a simple enterprise application with Java EE successor, Jakarta...Buhake Sindi
 
Spring framework
Spring frameworkSpring framework
Spring frameworkKani Selvam
 
Java EE8 - by Kito Mann
Java EE8 - by Kito Mann Java EE8 - by Kito Mann
Java EE8 - by Kito Mann Kile Niklawski
 
Java EE Revisits GoF Design Patterns
Java EE Revisits GoF Design PatternsJava EE Revisits GoF Design Patterns
Java EE Revisits GoF Design PatternsMurat Yener
 
Migrating to Jakarta EE 10
Migrating to Jakarta EE 10Migrating to Jakarta EE 10
Migrating to Jakarta EE 10Josh Juneau
 
스프링 프레임워크
스프링 프레임워크스프링 프레임워크
스프링 프레임워크Yoonki Chang
 
Spring MVC framework
Spring MVC frameworkSpring MVC framework
Spring MVC frameworkMohit Gupta
 
Voxxed Athens 2018 - Java EE is dead Long live jakarta EE!
Voxxed Athens 2018 - Java EE is dead Long live jakarta EE!Voxxed Athens 2018 - Java EE is dead Long live jakarta EE!
Voxxed Athens 2018 - Java EE is dead Long live jakarta EE!Voxxed Athens
 
Sysco Oracle Tour 2016 - What's new in FMW 12.2.1?
Sysco Oracle Tour 2016 - What's new in FMW 12.2.1?Sysco Oracle Tour 2016 - What's new in FMW 12.2.1?
Sysco Oracle Tour 2016 - What's new in FMW 12.2.1?Jon Petter Hjulstad
 
Red Hat JBoss BRMS and BPMS Workbench and Rich Client Technology
Red Hat JBoss BRMS and BPMS Workbench and Rich Client TechnologyRed Hat JBoss BRMS and BPMS Workbench and Rich Client Technology
Red Hat JBoss BRMS and BPMS Workbench and Rich Client TechnologyMark Proctor
 
Java EE 6, Eclipse @ EclipseCon
Java EE 6, Eclipse @ EclipseConJava EE 6, Eclipse @ EclipseCon
Java EE 6, Eclipse @ EclipseConLudovic Champenois
 
Feature Bits at LSSC10
Feature  Bits at LSSC10Feature  Bits at LSSC10
Feature Bits at LSSC10Erik Sowa
 
Overview of Java EE 6 by Roberto Chinnici at SFJUG
Overview of Java EE 6 by Roberto Chinnici at SFJUGOverview of Java EE 6 by Roberto Chinnici at SFJUG
Overview of Java EE 6 by Roberto Chinnici at SFJUGMarakana Inc.
 
Starting with jQuery
Starting with jQueryStarting with jQuery
Starting with jQueryAnil Kumar
 
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)Mihail Stoynov
 
The Java EE 6 platform
The Java EE 6 platformThe Java EE 6 platform
The Java EE 6 platformLorraine JUG
 
MicroProfile for MicroServices
MicroProfile for MicroServicesMicroProfile for MicroServices
MicroProfile for MicroServicesMert Çalışkan
 

Similaire à Cloud-ready Micro Java EE 8 (20)

OTN Developer Days - Java EE 6
OTN Developer Days - Java EE 6OTN Developer Days - Java EE 6
OTN Developer Days - Java EE 6
 
OpenNTF Webinar 2022-08 - XPages Jakarta EE Support in Practice
OpenNTF Webinar 2022-08 - XPages Jakarta EE Support in PracticeOpenNTF Webinar 2022-08 - XPages Jakarta EE Support in Practice
OpenNTF Webinar 2022-08 - XPages Jakarta EE Support in Practice
 
Bootstrapping a simple enterprise application with Java EE successor, Jakarta...
Bootstrapping a simple enterprise application with Java EE successor, Jakarta...Bootstrapping a simple enterprise application with Java EE successor, Jakarta...
Bootstrapping a simple enterprise application with Java EE successor, Jakarta...
 
Spring framework
Spring frameworkSpring framework
Spring framework
 
Java EE8 - by Kito Mann
Java EE8 - by Kito Mann Java EE8 - by Kito Mann
Java EE8 - by Kito Mann
 
JSF2
JSF2JSF2
JSF2
 
Java EE Revisits GoF Design Patterns
Java EE Revisits GoF Design PatternsJava EE Revisits GoF Design Patterns
Java EE Revisits GoF Design Patterns
 
Migrating to Jakarta EE 10
Migrating to Jakarta EE 10Migrating to Jakarta EE 10
Migrating to Jakarta EE 10
 
스프링 프레임워크
스프링 프레임워크스프링 프레임워크
스프링 프레임워크
 
Spring MVC framework
Spring MVC frameworkSpring MVC framework
Spring MVC framework
 
Voxxed Athens 2018 - Java EE is dead Long live jakarta EE!
Voxxed Athens 2018 - Java EE is dead Long live jakarta EE!Voxxed Athens 2018 - Java EE is dead Long live jakarta EE!
Voxxed Athens 2018 - Java EE is dead Long live jakarta EE!
 
Sysco Oracle Tour 2016 - What's new in FMW 12.2.1?
Sysco Oracle Tour 2016 - What's new in FMW 12.2.1?Sysco Oracle Tour 2016 - What's new in FMW 12.2.1?
Sysco Oracle Tour 2016 - What's new in FMW 12.2.1?
 
Red Hat JBoss BRMS and BPMS Workbench and Rich Client Technology
Red Hat JBoss BRMS and BPMS Workbench and Rich Client TechnologyRed Hat JBoss BRMS and BPMS Workbench and Rich Client Technology
Red Hat JBoss BRMS and BPMS Workbench and Rich Client Technology
 
Java EE 6, Eclipse @ EclipseCon
Java EE 6, Eclipse @ EclipseConJava EE 6, Eclipse @ EclipseCon
Java EE 6, Eclipse @ EclipseCon
 
Feature Bits at LSSC10
Feature  Bits at LSSC10Feature  Bits at LSSC10
Feature Bits at LSSC10
 
Overview of Java EE 6 by Roberto Chinnici at SFJUG
Overview of Java EE 6 by Roberto Chinnici at SFJUGOverview of Java EE 6 by Roberto Chinnici at SFJUG
Overview of Java EE 6 by Roberto Chinnici at SFJUG
 
Starting with jQuery
Starting with jQueryStarting with jQuery
Starting with jQuery
 
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
 
The Java EE 6 platform
The Java EE 6 platformThe Java EE 6 platform
The Java EE 6 platform
 
MicroProfile for MicroServices
MicroProfile for MicroServicesMicroProfile for MicroServices
MicroProfile for MicroServices
 

Plus de Payara

Easy Java Integration Testing with Testcontainers​
Easy Java Integration Testing with Testcontainers​Easy Java Integration Testing with Testcontainers​
Easy Java Integration Testing with Testcontainers​Payara
 
Payara Cloud - Cloud Native Jakarta EE.pptx
Payara Cloud - Cloud Native Jakarta EE.pptxPayara Cloud - Cloud Native Jakarta EE.pptx
Payara Cloud - Cloud Native Jakarta EE.pptxPayara
 
Jakarta Concurrency: Present and Future
Jakarta Concurrency: Present and FutureJakarta Concurrency: Present and Future
Jakarta Concurrency: Present and FuturePayara
 
GlassFish Migration Webinar 2022 Current version.pptx
GlassFish Migration Webinar 2022 Current version.pptxGlassFish Migration Webinar 2022 Current version.pptx
GlassFish Migration Webinar 2022 Current version.pptxPayara
 
10 Strategies for Developing Reliable Jakarta EE & MicroProfile Applications ...
10 Strategies for Developing Reliable Jakarta EE & MicroProfile Applications ...10 Strategies for Developing Reliable Jakarta EE & MicroProfile Applications ...
10 Strategies for Developing Reliable Jakarta EE & MicroProfile Applications ...Payara
 
Securing Microservices with MicroProfile and Auth0v2
Securing Microservices with MicroProfile and Auth0v2Securing Microservices with MicroProfile and Auth0v2
Securing Microservices with MicroProfile and Auth0v2Payara
 
Reactive features of MicroProfile you need to learn
Reactive features of MicroProfile you need to learnReactive features of MicroProfile you need to learn
Reactive features of MicroProfile you need to learnPayara
 
Effective cloud-ready apps with MicroProfile
Effective cloud-ready apps with MicroProfileEffective cloud-ready apps with MicroProfile
Effective cloud-ready apps with MicroProfilePayara
 
A step-by-step guide from traditional Java EE to reactive microservice design
A step-by-step guide from traditional Java EE to reactive microservice designA step-by-step guide from traditional Java EE to reactive microservice design
A step-by-step guide from traditional Java EE to reactive microservice designPayara
 
Transactions in Microservices
Transactions in MicroservicesTransactions in Microservices
Transactions in MicroservicesPayara
 
Fun with Kubernetes and Payara Micro 5
Fun with Kubernetes and Payara Micro 5Fun with Kubernetes and Payara Micro 5
Fun with Kubernetes and Payara Micro 5Payara
 
What's new in Jakarta EE and Eclipse GlassFish (May 2019)
What's new in Jakarta EE and Eclipse GlassFish (May 2019)What's new in Jakarta EE and Eclipse GlassFish (May 2019)
What's new in Jakarta EE and Eclipse GlassFish (May 2019)Payara
 
Previewing Payara Platform 5.192
Previewing Payara Platform 5.192Previewing Payara Platform 5.192
Previewing Payara Platform 5.192Payara
 
Secure JAX-RS
Secure JAX-RSSecure JAX-RS
Secure JAX-RSPayara
 
Gradual Migration to MicroProfile
Gradual Migration to MicroProfileGradual Migration to MicroProfile
Gradual Migration to MicroProfilePayara
 
Monitor Microservices with MicroProfile Metrics
Monitor Microservices with MicroProfile MetricsMonitor Microservices with MicroProfile Metrics
Monitor Microservices with MicroProfile MetricsPayara
 
Java2 days -_be_reactive_and_micro_with_a_microprofile_stack
Java2 days -_be_reactive_and_micro_with_a_microprofile_stackJava2 days -_be_reactive_and_micro_with_a_microprofile_stack
Java2 days -_be_reactive_and_micro_with_a_microprofile_stackPayara
 
Java2 days 5_agile_steps_to_cloud-ready_apps
Java2 days 5_agile_steps_to_cloud-ready_appsJava2 days 5_agile_steps_to_cloud-ready_apps
Java2 days 5_agile_steps_to_cloud-ready_appsPayara
 
Rapid development tools for java ee 8 and micro profile [GIDS]
Rapid development tools for java ee 8 and micro profile [GIDS] Rapid development tools for java ee 8 and micro profile [GIDS]
Rapid development tools for java ee 8 and micro profile [GIDS] Payara
 
Ondrej mihalyi be reactive and micro with a micro profile stack
Ondrej mihalyi   be reactive and micro with a micro profile stackOndrej mihalyi   be reactive and micro with a micro profile stack
Ondrej mihalyi be reactive and micro with a micro profile stackPayara
 

Plus de Payara (20)

Easy Java Integration Testing with Testcontainers​
Easy Java Integration Testing with Testcontainers​Easy Java Integration Testing with Testcontainers​
Easy Java Integration Testing with Testcontainers​
 
Payara Cloud - Cloud Native Jakarta EE.pptx
Payara Cloud - Cloud Native Jakarta EE.pptxPayara Cloud - Cloud Native Jakarta EE.pptx
Payara Cloud - Cloud Native Jakarta EE.pptx
 
Jakarta Concurrency: Present and Future
Jakarta Concurrency: Present and FutureJakarta Concurrency: Present and Future
Jakarta Concurrency: Present and Future
 
GlassFish Migration Webinar 2022 Current version.pptx
GlassFish Migration Webinar 2022 Current version.pptxGlassFish Migration Webinar 2022 Current version.pptx
GlassFish Migration Webinar 2022 Current version.pptx
 
10 Strategies for Developing Reliable Jakarta EE & MicroProfile Applications ...
10 Strategies for Developing Reliable Jakarta EE & MicroProfile Applications ...10 Strategies for Developing Reliable Jakarta EE & MicroProfile Applications ...
10 Strategies for Developing Reliable Jakarta EE & MicroProfile Applications ...
 
Securing Microservices with MicroProfile and Auth0v2
Securing Microservices with MicroProfile and Auth0v2Securing Microservices with MicroProfile and Auth0v2
Securing Microservices with MicroProfile and Auth0v2
 
Reactive features of MicroProfile you need to learn
Reactive features of MicroProfile you need to learnReactive features of MicroProfile you need to learn
Reactive features of MicroProfile you need to learn
 
Effective cloud-ready apps with MicroProfile
Effective cloud-ready apps with MicroProfileEffective cloud-ready apps with MicroProfile
Effective cloud-ready apps with MicroProfile
 
A step-by-step guide from traditional Java EE to reactive microservice design
A step-by-step guide from traditional Java EE to reactive microservice designA step-by-step guide from traditional Java EE to reactive microservice design
A step-by-step guide from traditional Java EE to reactive microservice design
 
Transactions in Microservices
Transactions in MicroservicesTransactions in Microservices
Transactions in Microservices
 
Fun with Kubernetes and Payara Micro 5
Fun with Kubernetes and Payara Micro 5Fun with Kubernetes and Payara Micro 5
Fun with Kubernetes and Payara Micro 5
 
What's new in Jakarta EE and Eclipse GlassFish (May 2019)
What's new in Jakarta EE and Eclipse GlassFish (May 2019)What's new in Jakarta EE and Eclipse GlassFish (May 2019)
What's new in Jakarta EE and Eclipse GlassFish (May 2019)
 
Previewing Payara Platform 5.192
Previewing Payara Platform 5.192Previewing Payara Platform 5.192
Previewing Payara Platform 5.192
 
Secure JAX-RS
Secure JAX-RSSecure JAX-RS
Secure JAX-RS
 
Gradual Migration to MicroProfile
Gradual Migration to MicroProfileGradual Migration to MicroProfile
Gradual Migration to MicroProfile
 
Monitor Microservices with MicroProfile Metrics
Monitor Microservices with MicroProfile MetricsMonitor Microservices with MicroProfile Metrics
Monitor Microservices with MicroProfile Metrics
 
Java2 days -_be_reactive_and_micro_with_a_microprofile_stack
Java2 days -_be_reactive_and_micro_with_a_microprofile_stackJava2 days -_be_reactive_and_micro_with_a_microprofile_stack
Java2 days -_be_reactive_and_micro_with_a_microprofile_stack
 
Java2 days 5_agile_steps_to_cloud-ready_apps
Java2 days 5_agile_steps_to_cloud-ready_appsJava2 days 5_agile_steps_to_cloud-ready_apps
Java2 days 5_agile_steps_to_cloud-ready_apps
 
Rapid development tools for java ee 8 and micro profile [GIDS]
Rapid development tools for java ee 8 and micro profile [GIDS] Rapid development tools for java ee 8 and micro profile [GIDS]
Rapid development tools for java ee 8 and micro profile [GIDS]
 
Ondrej mihalyi be reactive and micro with a micro profile stack
Ondrej mihalyi   be reactive and micro with a micro profile stackOndrej mihalyi   be reactive and micro with a micro profile stack
Ondrej mihalyi be reactive and micro with a micro profile stack
 

Dernier

Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 

Dernier (20)

Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 

Cloud-ready Micro Java EE 8

  • 1. Cloud-ready Micro Java EE 8 Ondro Mihályi | Payara Engineer | @omihalyi | @Payara_Fish
  • 2. Who am I? • Payara Engineer • Java EE developer and lecturer • Conference speaker • Czech JUG leader • Member of JCP and Eclipse foundation • @omihalyi
  • 3. What’s this all about? • How lightweight is Java EE, really? • What’s in Java EE 8 today? • What could be in Java EE EE4J ??? in the future?
  • 4. A little (recent) history... • 12 June 2013: Java EE 7 Released •Docker was 3 months old •WildFly was still JBoss AS (and no Swarm) •Before Spring Boot •WebSphere Liberty Profile recently released
  • 5. A little (recent) history... • 21 September 2017: Java EE 8 Released, 4 years later •Docker is now the dominant container format •WildFly have fully product-ised WildFly Swarm •Spring Boot have been making JARs not WARs for a few years •IBM released Open Liberty •Payara entered the fray and released Payara Micro •Eclipse MicroProfile is established and progressing
  • 6. What’s in Java EE 8? • Upgrades •JAX-RS 2.1 •Servlet 4.0 •Bean Validation 2.0 •JSF 2.3 •CDI 2.0 •JSON-P 1.1 • New •Java EE Security •JSON-B
  • 7. What is Payara Micro? • Payara Micro is… •Micro! (~60MB disk size, ~30 MB RAM) •Dynamically scalable •Fully embeddable (if you want…) •Web Profile “plus” •On Maven Central <dependency> <groupId>fish.payara.api</groupId> <ArtifactId>payara-api</artifactId> <version>5.0.0-Alpha3</version> <type>jar</type> </dependency>
  • 8. What is Payara Micro? • Key APIs • Servlets, JSTL, EL, JSP • WebSockets • JSF • JAX-RS • EJB Lite • JTA • JPA • JCA (pluggable JMS) • Bean Validation • CDI • Interceptors • JBatch • Concurrency • JCache • Config • SOAP, remote EJB
  • 10. Demo Scenario • Stock! Micro Stock! • Publish StockTicker events • Listen on different endpoints
  • 12. Demo 1 Creating the Stock Ticker • What do we need? • Stock object • Stock Ticker to set the stock price • Publisher for CDI event bus
  • 13. Demo 2 Creating the Stock Web listener • What do we need? • Websocket endpoint • Class to manage Websocket sessions • Class to listen for Stock events on the CDI event bus • Both these responsibilities can be in the same class
  • 14. Integrating Java EE 8 Features
  • 15. Demo Making our MicroService generic • What do we need to change? • Non-Payara services can’t listen on the CDI event bus • Solution: REST Server Sent Events (from JAX-RS 2.1) • External services may not have access to a Stock object (or interface) • Solution: Serialise our Stock object as JSON using JSON-B 1.0
  • 16. private JsonObject toJson() { JsonObjectBuilder objectBuilder = Json.createObjectBuilder() .add("symbol", symbol) .add("description", description) .add("price", price); return objectBuilder.build(); } @Override public String toString() { return this.toJson().toString(); } Demo 3 JSON-P manual toJson() method
  • 17. @JsonbNillable public class Stock implements Serializable { private String symbol; @JsonbTransient private String description; @JsonbProperty("RandomPrice") private double price; @Override public String toString() { JsonbConfig nillableConfig = new JsonbConfig().withNullValues(true); return JsonbBuilder.create(nillableConfig).toJson(this); } } private void observe() { source.register((sseEvent) -> { this.stock = JsonbBuilder.create().fromJson(sseEvent.readData(), Stock.class); }); source.open(); } Demo 3 JSON-B serialisation and deserialisation Learn more: http://json-b.net
  • 18. private void reactiveClient() { CompletionStage<Response> cs1 = ClientBuilder.newClient() .target("http://localhost:8080/jax-rs-2-1/books") .request() .rx() .get(); CompletionStage<Response> cs2 = ClientBuilder.newClient() .target("http://localhost:8080/jax-rs-2-1/magazines") .request() .rx() .get(); cs1.thenCombine(cs2, (r1, r2) -> r1.readEntity(String.class) + r2.readEntity(String.class)) .thenAccept(System.out::println); } Source: https://www.ibm.com/developerworks/library/j-whats-new-in-javaee-8/index.html Author: Alex Theedom Demo 4 JAX-RS reactive client API
  • 19. Demo 4 SSE server endpoint in JAX-RS @GET @Produces(MediaType.SERVER_SENT_EVENTS) public void eventOutput(@Context SseEventSink eventSink){ // send a single event eventSink.send(sse.newEvent(stockTicker.getStock().toString())); // registers the requester as a consumer of events sseBroadcaster.register(eventSink); } @POST @Path("broadcast") @Consumes(MediaType.MULTIPART_FORM_DATA) public void broadcast(@FormParam("event") String event){ // broadcasts the event to all registered consumers sseBroadcaster.broadcast(sse.newEvent(event)); }
  • 21. The Future of Java EE…?
  • 22. Demo 5 Integrating MicroProfile 1.1 <dependency> <groupId> org.eclipse.microprofile </groupId> <artifactId> Microprofile-bom </artifactId> <version>1.1.0</version> <type>pom</type> <scope>provided</scope> </dependency> @Inject @ConfigProperty(name = "stockticker.url") private String stockTickerURL; @Inject @ConfigProperty(name = "stockticker.url") private Instance<String> tickerURLConfig; ... String url = tickerURLConfig.get()
  • 23. Demo 5 Integrating MicroProfile // Set system property java -jar -Dstockticker.url=http://localhost:8081/StockTicker-1.0-SNAPSHOT/rest/sse StockWeb/target/StockWeb- 1.0-SNAPSHOT-microbundle.jar // Use asadmin to set property in Hazelcast cluster asadmin> set-config-property --propertyName=stockticker.url --propertyValue=http://localhost:8080/StockTicker-1.0-SNAPSHOT/rest/sse --source=cluster // Use asadmin to set property for specific instances in Hazelcast cluster asadmin> send-asadmin-command --targets=‘*‘ --command=set-config-property -- --propertyName=stockticker.url --propertyValue=http://localhost:8080/StockTicker-1.0-SNAPSHOT/rest/sse --source=config --sourceName=sever-config
  • 24. Recap •Java EE is incredibly adaptable to changing needs • Recent change has been driven by vendors’ implementations • Eclipse MicroProfile offers interesting ideas for the future