an introduction to the microprofile
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
@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
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
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
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
UberjarwithunzipLiberty,JavaEE
alexsotoblordofthejars
L I B E R T YJarsize~35mb,startup~7s,heapusage~21mb
UberjarwithunzipLiberty,JavaEE
Extrasforproduction
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
UberjarusingCLIGlassfish,JavaEE
alexsotoblordofthejars
P A Y A R AJarsize~33mb,startup~5s,heapusage~20mb
UberjarusingCLIGlassfish,JavaEE
HazelcastclusterCDI
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
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
https://groups.google.com/forum/#!forum/microprofile
https://github.com/microprofile/evolution
alexsotoblordofthejars
http://bit.ly/2c6MWqf
alexsotoblordofthejars