an introduction to the microprofile

69

Upload: alex-soto

Post on 22-Jan-2018

463 views

Category:

Technology


1 download

TRANSCRIPT

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

Q U E S T I O N S

alexsotoblordofthejars

alexsotoblordofthejars

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

alexsotoblordofthejars

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

alexsotoblordofthejars

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

JSON-P

alexsotoblordofthejars

@Informal@Informal

publicpublicclassclassInformalGreetingInformalGreetingextendsextendsGreetingGreeting{{

publicpublicStringStringgreetgreet((StringnameStringname)){{

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

}}

}}

C D I E X A M P L E

alexsotoblordofthejars

@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

@@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

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

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

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

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

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

alexsotoblordofthejars

S T A N D A R D I Z E

alexsotoblordofthejars

alexsotoblordofthejars

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

alexsotoblordofthejars

alexsotoblordofthejars

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

alexsotoblordofthejars

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

alexsotoblordofthejars

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

List<>sessionForSpeaker(Speaker)

alexsotoblordofthejars

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

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

alexsotoblordofthejars

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

Uberjarwithbootstraplayer

alexsotoblordofthejars

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

UberjarwithbootstraplayerFractions,JavaEE+WildFly

alexsotoblordofthejars

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

alexsotoblordofthejars

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

alexsotoblordofthejars

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

SessionRatingrateSession(SessionRating)

alexsotoblordofthejars

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

SessionRatingrateSession(SessionRating)SessionRatingupdateSession(SessionRating)

alexsotoblordofthejars

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

SessionRatingrateSession(SessionRating)SessionRatingupdateSession(SessionRating)

List<>allSessionVotes(SessionId)

alexsotoblordofthejars

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

SessionRatingrateSession(SessionRating)SessionRatingupdateSession(SessionRating)

List<>allSessionVotes(SessionId)DoublesessionRatingAverage(SessionId)

alexsotoblordofthejars

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

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

alexsotoblordofthejars

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

Uberjarwithunzip

alexsotoblordofthejars

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

UberjarwithunzipLiberty,JavaEE

alexsotoblordofthejars

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

UberjarwithunzipLiberty,JavaEE

Extrasforproduction

alexsotoblordofthejars

alexsotoblordofthejars

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

alexsotoblordofthejars

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

alexsotoblordofthejars

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

alexsotoblordofthejars

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

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

alexsotoblordofthejars

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

UberjarusingCLI

alexsotoblordofthejars

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

UberjarusingCLIGlassfish,JavaEE

alexsotoblordofthejars

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

UberjarusingCLIGlassfish,JavaEE

HazelcastclusterCDI

alexsotoblordofthejars

alexsotoblordofthejars

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

alexsotoblordofthejars

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

alexsotoblordofthejars

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

alexsotoblordofthejars

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

Uberjarbootstraplayer

alexsotoblordofthejars

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

UberjarbootstraplayerItisaTomcat,JavaEE

alexsotoblordofthejars

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

alexsotoblordofthejars

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

alexsotoblordofthejars

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

SecurityviaJWT

alexsotoblordofthejars

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

SecurityviaJWTStandardConfiguration

alexsotoblordofthejars

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

SecurityviaJWTStandardConfigurationOpenAPI/Swagger

alexsotoblordofthejars

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

SecurityviaJWTStandardConfigurationOpenAPI/SwaggerServiceDiscovery

alexsotoblordofthejars

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

SecurityviaJWTStandardConfigurationOpenAPI/SwaggerServiceDiscovery

Caching

alexsotoblordofthejars

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

alexsotoblordofthejars

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

https://github.com/microprofile/evolution

alexsotoblordofthejars

alexsotoblordofthejars

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

alexsotoblordofthejars

C O N C L U S I O N SCommunityisthemostimportant

alexsotoblordofthejars

C O N C L U S I O N SCommunityisthemostimportant

EEandnon-EE

alexsotoblordofthejars

C O N C L U S I O N SCommunityisthemostimportant

EEandnon-EEItisnotasplit

alexsotoblordofthejars

alexsotoblordofthejars

http://bit.ly/2c6MWqf

[email protected]

alexsotoblordofthejars