Top Banner
69

An introduction to the MicroProfile

Jan 22, 2018

Download

Technology

Alex Soto
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: An introduction to the MicroProfile
Page 2: An introduction to the MicroProfile

A L E X S O T O

R E D H A T E N G I N E E RO P E N S O U R C E A D V O C A T E

@ A L E X S O T O B

alexsotoblordofthejars

Page 3: An introduction to the MicroProfile

Q U E S T I O N S

alexsotoblordofthejars

Page 4: An introduction to the MicroProfile

alexsotoblordofthejars

Page 5: An introduction to the MicroProfile

S E P T 2 0 1 6 R E L E A S E 1 . 0JAX-RS

alexsotoblordofthejars

Page 6: An introduction to the MicroProfile

S E P T 2 0 1 6 R E L E A S E 1 . 0JAX-RSCDI

alexsotoblordofthejars

Page 7: An introduction to the MicroProfile

S E P T 2 0 1 6 R E L E A S E 1 . 0JAX-RSCDI

JSON-P

alexsotoblordofthejars

Page 8: An introduction to the MicroProfile

@Informal@Informal

publicpublicclassclassInformalGreetingInformalGreetingextendsextendsGreetingGreeting{{

publicpublicStringStringgreetgreet((StringnameStringname)){{

returnreturn"Hi,""Hi,"++namename++"!""!";;

}}

}}

C D I E X A M P L E

alexsotoblordofthejars

Page 9: An introduction to the MicroProfile

@Informal@Informal

publicpublicclassclassInformalGreetingInformalGreetingextendsextendsGreetingGreeting{{

publicpublicStringStringgreetgreet((StringnameStringname)){{

returnreturn"Hi,""Hi,"++namename++"!""!";;

}}

}}

publicpublicclassclassPrinterPrinter{{

@Inject@InformalGreetinggreeting@Inject@InformalGreetinggreeting;;

}}

C D I E X A M P L E

alexsotoblordofthejars

Page 10: An introduction to the MicroProfile

@@PathPath(("/""/"))

publicpublicclassclassGreetingResourceGreetingResource{{

@Inject@InformalGreetinggreeting@Inject@InformalGreetinggreeting;;

@GET@GET

@@PathPath(("greeting/{name}""greeting/{name}"))

@@ProducesProduces((MediaTypeMediaType..TEXT_PLAINTEXT_PLAIN))

publicpublicResponseResponsegetMessageByUsergetMessageByUser((@@PathParamPathParam(("name""name"))StringnameStringname)){{

returnreturnResponseResponse..okok((greetinggreeting..greetgreet((namename))))..buildbuild(());;

}}

}}

J A X - R S E X A M P L E

alexsotoblordofthejars

Page 11: An introduction to the MicroProfile

JsonObjectvalueJsonObjectvalue==newnewJsonBuilderJsonBuilder(())

..beginObjectbeginObject(())

..addadd(("firstName""firstName",,"John""John"))

..addadd(("lastName""lastName",,"Smith""Smith"))

..addadd(("age""age",,2525))

..endObjectendObject(())

..buildbuild(());;

J S O N - P E X A M P L E

alexsotoblordofthejars

Page 12: An introduction to the MicroProfile

JsonObjectvalueJsonObjectvalue==newnewJsonBuilderJsonBuilder(())

..beginObjectbeginObject(())

..addadd(("firstName""firstName",,"John""John"))

..addadd(("lastName""lastName",,"Smith""Smith"))

..addadd(("age""age",,2525))

..endObjectendObject(())

..buildbuild(());;

StringjsonStringjson=="...""...";;

JsonReaderreaderJsonReaderreader==newnewJsonReaderJsonReader((newnewStringReaderStringReader((jsonjson))));;

JsonValuevalueJsonValuevalue==readerreader..readObjectreadObject(());;

readerreader..closeclose(());;

J S O N - P E X A M P L E

alexsotoblordofthejars

Page 13: An introduction to the MicroProfile

JsonObjectvalueJsonObjectvalue==newnewJsonBuilderJsonBuilder(())

..beginObjectbeginObject(())

..addadd(("firstName""firstName",,"John""John"))

..addadd(("lastName""lastName",,"Smith""Smith"))

..addadd(("age""age",,2525))

..endObjectendObject(())

..buildbuild(());;

StringjsonStringjson=="...""...";;

JsonReaderreaderJsonReaderreader==newnewJsonReaderJsonReader((newnewStringReaderStringReader((jsonjson))));;

JsonValuevalueJsonValuevalue==readerreader..readObjectreadObject(());;

readerreader..closeclose(());;

JsonWriterjsonWriterJsonWriterjsonWriter==newnewJsonWriterJsonWriter((newnewFileWriterFileWriter((......))));;

JsonObjectjsonObjectJsonObjectjsonObject==newnewJsonBuilderJsonBuilder(())

..buildbuild(());;

jsonWriterjsonWriter..writeObjectwriteObject((jsonObjectjsonObject));;

jsonWriterjsonWriter..closeclose(());;

J S O N - P E X A M P L E

alexsotoblordofthejars

Page 14: An introduction to the MicroProfile

R A P I D L Y I T E R A T EA N D I N N O V A T E

alexsotoblordofthejars

Page 15: An introduction to the MicroProfile

B U I L D C O N S E N S U S

alexsotoblordofthejars

Page 16: An introduction to the MicroProfile

S T A N D A R D I Z E

alexsotoblordofthejars

Page 17: An introduction to the MicroProfile

alexsotoblordofthejars

Page 18: An introduction to the MicroProfile

R E F E R E N C E A R C H I T E C T U R E

alexsotoblordofthejars

Page 19: An introduction to the MicroProfile

alexsotoblordofthejars

Page 20: An introduction to the MicroProfile

S E S S I O N S E R V I C ESessionCRUD(Session)

alexsotoblordofthejars

Page 21: An introduction to the MicroProfile

S E S S I O N S E R V I C ESessionCRUD(Session)List<>search(Session)

alexsotoblordofthejars

Page 22: An introduction to the MicroProfile

S E S S I O N S E R V I C ESessionCRUD(Session)List<>search(Session)

List<>sessionForSpeaker(Speaker)

alexsotoblordofthejars

Page 23: An introduction to the MicroProfile

S E S S I O N S E R V I C ESessionCRUD(Session)List<>search(Session)

List<>sessionForSpeaker(Speaker)List<>speakersForSession(Session)

alexsotoblordofthejars

Page 24: An introduction to the MicroProfile

W I L D F L Y S W A R MJarsize~65mb,startup~6s,heapusage~40mb

alexsotoblordofthejars

Page 25: An introduction to the MicroProfile

W I L D F L Y S W A R MJarsize~65mb,startup~6s,heapusage~40mb

Uberjarwithbootstraplayer

alexsotoblordofthejars

Page 26: An introduction to the MicroProfile

W I L D F L Y S W A R MJarsize~65mb,startup~6s,heapusage~40mb

UberjarwithbootstraplayerFractions,JavaEE+WildFly

alexsotoblordofthejars

Page 27: An introduction to the MicroProfile

W I L D F L Y S W A R MJarsize~65mb,startup~6s,heapusage~40mb

UberjarwithbootstraplayerFractions,JavaEE+WildFly

Non-EE(ServiceRegistry,Circtuit-Breaker,Configuration)

alexsotoblordofthejars

Page 28: An introduction to the MicroProfile

alexsotoblordofthejars

Page 29: An introduction to the MicroProfile

V O T I N G S E R V I C EAttendeeCRUD(Attendee)

alexsotoblordofthejars

Page 30: An introduction to the MicroProfile

V O T I N G S E R V I C EAttendeeCRUD(Attendee)

SessionRatingrateSession(SessionRating)

alexsotoblordofthejars

Page 31: An introduction to the MicroProfile

V O T I N G S E R V I C EAttendeeCRUD(Attendee)

SessionRatingrateSession(SessionRating)SessionRatingupdateSession(SessionRating)

alexsotoblordofthejars

Page 32: An introduction to the MicroProfile

V O T I N G S E R V I C EAttendeeCRUD(Attendee)

SessionRatingrateSession(SessionRating)SessionRatingupdateSession(SessionRating)

List<>allSessionVotes(SessionId)

alexsotoblordofthejars

Page 33: An introduction to the MicroProfile

V O T I N G S E R V I C EAttendeeCRUD(Attendee)

SessionRatingrateSession(SessionRating)SessionRatingupdateSession(SessionRating)

List<>allSessionVotes(SessionId)DoublesessionRatingAverage(SessionId)

alexsotoblordofthejars

Page 34: An introduction to the MicroProfile

V O T I N G S E R V I C EAttendeeCRUD(Attendee)

SessionRatingrateSession(SessionRating)SessionRatingupdateSession(SessionRating)

List<>allSessionVotes(SessionId)DoublesessionRatingAverage(SessionId)

List<>votesByAttendee(Attendee)

alexsotoblordofthejars

Page 35: An introduction to the MicroProfile

L I B E R T YJarsize~35mb,startup~7s,heapusage~21mb

alexsotoblordofthejars

Page 36: An introduction to the MicroProfile

L I B E R T YJarsize~35mb,startup~7s,heapusage~21mb

Uberjarwithunzip

alexsotoblordofthejars

Page 37: An introduction to the MicroProfile

L I B E R T YJarsize~35mb,startup~7s,heapusage~21mb

UberjarwithunzipLiberty,JavaEE

alexsotoblordofthejars

Page 38: An introduction to the MicroProfile

L I B E R T YJarsize~35mb,startup~7s,heapusage~21mb

UberjarwithunzipLiberty,JavaEE

Extrasforproduction

alexsotoblordofthejars

Page 39: An introduction to the MicroProfile

alexsotoblordofthejars

Page 40: An introduction to the MicroProfile

S C H E D U L E S E R V I C EScheduleCRUD(Schedule)

alexsotoblordofthejars

Page 41: An introduction to the MicroProfile

S C H E D U L E S E R V I C EScheduleCRUD(Schedule)List<>allForVenue(Venue)

alexsotoblordofthejars

Page 42: An introduction to the MicroProfile

S C H E D U L E S E R V I C EScheduleCRUD(Schedule)List<>allForVenue(Venue)List<>activeAtTime(time)

alexsotoblordofthejars

Page 43: An introduction to the MicroProfile

S C H E D U L E S E R V I C EScheduleCRUD(Schedule)List<>allForVenue(Venue)List<>activeAtTime(time)List<>allForDay(date)

alexsotoblordofthejars

Page 44: An introduction to the MicroProfile

P A Y A R AJarsize~33mb,startup~5s,heapusage~20mb

alexsotoblordofthejars

Page 45: An introduction to the MicroProfile

P A Y A R AJarsize~33mb,startup~5s,heapusage~20mb

UberjarusingCLI

alexsotoblordofthejars

Page 46: An introduction to the MicroProfile

P A Y A R AJarsize~33mb,startup~5s,heapusage~20mb

UberjarusingCLIGlassfish,JavaEE

alexsotoblordofthejars

Page 47: An introduction to the MicroProfile

P A Y A R AJarsize~33mb,startup~5s,heapusage~20mb

UberjarusingCLIGlassfish,JavaEE

HazelcastclusterCDI

alexsotoblordofthejars

Page 48: An introduction to the MicroProfile

alexsotoblordofthejars

Page 49: An introduction to the MicroProfile

S P E A K E R S E R V I C ESpeakerCRUD(Speaker)

alexsotoblordofthejars

Page 50: An introduction to the MicroProfile

S P E A K E R S E R V I C ESpeakerCRUD(Speaker)Set<>search(Speaker)

alexsotoblordofthejars

Page 51: An introduction to the MicroProfile

A P A C H E T O M E EJarsize~35mb,startup~3s,heapusage~75mb

alexsotoblordofthejars

Page 52: An introduction to the MicroProfile

A P A C H E T O M E EJarsize~35mb,startup~3s,heapusage~75mb

Uberjarbootstraplayer

alexsotoblordofthejars

Page 53: An introduction to the MicroProfile

A P A C H E T O M E EJarsize~35mb,startup~3s,heapusage~75mb

UberjarbootstraplayerItisaTomcat,JavaEE

alexsotoblordofthejars

Page 54: An introduction to the MicroProfile

https://github.com/microprofile/microprofile-conference

alexsotoblordofthejars

Page 55: An introduction to the MicroProfile

N E X T F E A T U R E SPersistence

alexsotoblordofthejars

Page 56: An introduction to the MicroProfile

N E X T F E A T U R E SPersistence

SecurityviaJWT

alexsotoblordofthejars

Page 57: An introduction to the MicroProfile

N E X T F E A T U R E SPersistence

SecurityviaJWTStandardConfiguration

alexsotoblordofthejars

Page 58: An introduction to the MicroProfile

N E X T F E A T U R E SPersistence

SecurityviaJWTStandardConfigurationOpenAPI/Swagger

alexsotoblordofthejars

Page 59: An introduction to the MicroProfile

N E X T F E A T U R E SPersistence

SecurityviaJWTStandardConfigurationOpenAPI/SwaggerServiceDiscovery

alexsotoblordofthejars

Page 60: An introduction to the MicroProfile

N E X T F E A T U R E SPersistence

SecurityviaJWTStandardConfigurationOpenAPI/SwaggerServiceDiscovery

Caching

alexsotoblordofthejars

Page 61: An introduction to the MicroProfile

W H E R E I S M Y F E A T U R E ?

alexsotoblordofthejars

Page 62: An introduction to the MicroProfile

https://groups.google.com/forum/#!forum/microprofile

https://github.com/microprofile/evolution

alexsotoblordofthejars

Page 63: An introduction to the MicroProfile

alexsotoblordofthejars

Page 64: An introduction to the MicroProfile

L E T ' S W I N D D O W N

alexsotoblordofthejars

Page 65: An introduction to the MicroProfile

C O N C L U S I O N SCommunityisthemostimportant

alexsotoblordofthejars

Page 66: An introduction to the MicroProfile

C O N C L U S I O N SCommunityisthemostimportant

EEandnon-EE

alexsotoblordofthejars

Page 67: An introduction to the MicroProfile

C O N C L U S I O N SCommunityisthemostimportant

EEandnon-EEItisnotasplit

alexsotoblordofthejars

Page 68: An introduction to the MicroProfile

alexsotoblordofthejars

Page 69: An introduction to the MicroProfile

http://bit.ly/2c6MWqf

[email protected]

alexsotoblordofthejars