 Hey, hello How are you doing? I'm fine. Thank you All right, so you're wearing the red hat the red hat cap. So it's a great Yes I need one as well. Okay, so I'm wearing also the red hat t-shirt, but um, well the small red hat is not that fantastic So Very cool. So Sebastian, uh, just a quick logistic thing. So, uh, Barat is having some trouble rejoining the broadcast So he would be joining us in a in a few minutes. So what we'll do is we'll move on with with Anna's talk I think she's a great great subject to speak on and then later on Barat is Barat is available. We can open up for questions if Praveen and other staff And and the walker have some great questions. So we can definitely have it answered by the speaker directly Okay, awesome. So Okay, so let me introduce you to all Anna and She's working on my team as a developer advocate and and she's great and And moreover, she's about to speak about an awesome project Quarkus, uh, it's my favorite project so far since two years now um as a developer and we our role is to to to Speak about developer experience and and with quarkus. It's so easy because yeah You just have to go then and uh, well, and I will show all of this to us See your screen is shared So what I can say if you love Java, you will you will definitely love quarkus. Oh, yeah Sure. Okay. Hey, Anna, the stage is yours and uh, see you later Okay, thank you very much. See you in a bit. Yeah, so, um, everyone Welcome to productive development with quarkus. Uh, the supersonic subatomic java today with java 17 As this is the latest long-term release that we have available as java developers So why not give it a try with working with quarkus and java 17 goodies? So those being said, let me enter in presentation mode So as sebastian has already mentioned, I am calling with him. I'm working as a developer advocate for red hat And, um, I mean calling with him and coran as well. We're all a big team here at red hat. Um, But um, my role is similar to sebastian's. I am working on improving developer experience with the red hack technologies So, uh, wherever you have the feedback regarding your experience with quarkus And not only that is welcome to be known And of course, I'm here to help you Sharing my own experiences and experiments From what I've tried with quarkus and not only I'm also java champion and a certified architect And I love to try things that are a little bit more complex In in the space out there working with the with the cloud So those being said In the talk today, uh, as we know we have been like switching our approaches and development from the monolith To the modern one. So if the vintage approach was like creating go on a big application that we used to deploy on an application server Nowadays we are um having the same Functionalities given to the our end users But by doing this in many applications that are orchestrated individually Thanks to orchestration platform. Thanks to continentalization and orchestration platforms from those containers like kubernetes or open shift So supersonic subatomic java probably you've heard about quarkus has been here around for two years and is You know available for us to be like two years and more and Is here to help us into delivering very very Good robust applications, but being smaller in memory footprint and way faster when they start And why to develop with quarkus and java because java still has so much goodness hasn't improved Not only in terms of features and the new keywords that are added in the latest revisions of java But it has also improved in the user experience. I mean if you're thinking that java 17 actually starting with java 13 You can think that java has brought so much goodness with for us as developers because we now have Much more help when we're working with not pointer exceptions. So we're not like all Doing it like in the old times when looking at this check trace and you know, just Investing in a lot of time where that null pointer exception has come We now have an a way to Debug and you see where the problem is coming from way easier. So think of only that how much goodness is there So who is this quarkus and what's all the fuss about it? So we If you're looking at quarkus and you're comparing it with the traditional enterprise java application It's 10 times smaller and a hundred times faster when you're working with it And you're going to see that and my soon coded a live example So seriously, it's like that why is like that well because well, um the tradition when you're looking at the traditional versus the quarkus ways what happens is that The framework what it does typically at At the Build time you're most of the time packaging the application at the runtime if you're using a traditional framework you're like realizing that Things are either working as expected or not not working as much as expected, but typically at runtime that That kind of actually takes longer time Although the build time was like smaller the runtime Stuff and checks and i'm packing and everything is taking way longer But in with quarkus what happens is that at build time all these actions are being incorporated there the build is taking Still a small amount of time and you get your application like up and running in just matters of a milliseconds You're just uh, you know, uh clipping a bit and you have it running So not only that you can turbospeed uh with crawl vm. So um using crawl vm you can Have a quarkus running natively What this means is that I feel like in a traditional java application You would have done like java minus charge to start your application No, like your package does jar application in the native world. You don't need the jvm to start your Application so it's simple as that it behaves like an executable So you don't need the jvm anymore what this means is meaning that well, you have smaller container images smaller container images means that Well, your containers will be started faster by kubernetes because it will be less to download and to have your pods In the running phase. This is what we want to achieve like to minimize all these times spent between Getting the image and running the image isn't it great and also you get like with with the help of crawl vm You get this way to minimize the dependencies You will have the garb m also helps you like with the dead code elimination And you're still using the goodness of java. That's the most important thing So this is why we're saying that quarkus is a kubernetes native framework and To prove that to you. I will life code in this session I am escape from this part and first of all go to My favorite place to work with quarkus code dot quarkus.io And let me get some extensions from here. So I will need to build an application. That's a little bit more complex So it will consume address Endpoint from the board api And it will of course do some transformations as we probably do in our regular applications We do some transformations for the way that we are exposed the data to our end users And of course, we want to package this application for the native And besides that We are also wanting to like deploy this to kubernetes. So let's see how to do that First of all, uh, since I said that I am like needing to work with uh and make um A rest and expose rest service. I need to like have rest easy chasen be Added as an extension so that I can serialize and expose my rest services With chasen v serialization I said I need to consume an endpoint rest endpoint. So I also need the rest client to do that But well, when I like when I work with um rest endpoints, I would very much like to um have those rest endpoints annotated and documented And uh interact because interact way easier with them. So I'm using also the small right open api extension um Also, we would like to make this application folks tolerant. So let's add some small rifle tolerance to it In next well, I need a way to package my application and to be my container image So I will choose in this case chip To package my app and for the kubernetes and the other sub parts. I'm going to add them down the way So just having these five extensions, I can download now this zip and work on my local Okay, so If you like another approach, um that I also suggest is very good to have it in uh when Working with quarkus in when you're trying to migrate is having the um one based on our quarkus archetype In the quarkus archetype way you can also generate your endpoint because typically you would get the greeting resource When you're generating your um Your code from there from code.quarkus.io, but with the archetype you can also choose The name of the class name and the path of that one. So those being sad Uh what I did here, I actually did the same I have the same extensions But I generated it from the archetype do not worry I will share how to generate from the archetype at the end of the session because there's an organized article that I wrote To support this session so that you can reproduce everything and you can get access to the code as well Um, so the same thing. Um, I get here the hobby resource Uh, which is a rest end point. So quarkus is already giving to me some things to work with I also get some docker files. So I get a good starting point Uh, but when I did the generation I am using java 11. So let's do this small manual change here and say java 17 and reload the context as well um and Just that you switched for your local work for the moment to java 17, right? um, so those being said um, let's uh go here and code The consuming end point. So we want to consume An end point. I'll let me go back to the browser the board api And uh, I'm going to use this part here to get my end point So this is the board api end point and I'm going to get some informations in my code To do that I can code an interface. Um, and I'm going to call it activity. Sorry activity service um And I'm just going to put this here for the moment so that I don't forget the end point where I'm having this To make it an um as a end point for you know consumption of my Rest end point. I'm just going to register it as a rest client And use here a path to my api and say import class and of course The path is api slash activity because I may not calibrated everything but it was like slash activity here Okay, so uh, this is the path. Um, I need also like to add this at the level of uh, of my application of properties as well Because I need to like instruct it. Um Hey, you should like consume from the end point and to have like a way to to Get it from there So mp minus rest url and here's the port api And of course eliminate this part because we don't need it So easy as that and here's my activity service now. Let's code a few A few methods to consume um, so let me just say activity service and do this I'm okay. I thought generated them but do not worry We're gonna like build the other parts down the way. So let me just Import some things Um, it's because I have only uh some um Just a few moments available for my uh for my presentation So let me import the class. I don't like this media type that I'm getting here Hey And of course, let's me import the query problems as well And yeah, I see here that I have now three classes that I have not defined yet And here's we're going to use first our goody with our good parts with Java 17. So let's create the class basic hobby And uh, what we're going to do for this one for the consumption is we are consuming it as well You know when in this part. So We want to use some Java 17 goodies when we're like establishing a class hierarchy for our dto's that we're going to use further We can like have this one saying k this basic hobby is going to be a class That is going to allow inheritance. And I'm going to use the sealed keyword only to Price hobby. So I'm going to have another one that's going to be called priced hobby Um, but let me go here to the priced hobby and actually create the classes because I think it's easier Priced hobby and complete hobby. Uh, no, let's go to Basic hobby. Okay. Now it says here per it's sealed class and permit inheritance only to price hobby Now I want to um, like it adds some annotation. So I'm going to say gson ignore properties ignore unknown true So if there are some unknown properties to basic hobby, please ignore them when serializing them And let's just uh, quickly code a little bit here. Um, and go to the browser. I just need this Uh, I don't know things by heart. So I just need to code a little bit Using these details as this is a DTO. I don't really care that I'm going to expose publicly some information So I'm going to say so I'm not going to create like getters and setters because probably it's going to be the same thing I'm going to say string type public and participants And uh, well, of course at Jason be creator Just going to create us a very helpful method basic hobby empty and of course return Here we turn new Basic hobby Okay, now that we got this one here and we have our first class defined. Let's go to permit to priced hobby so priced hobby Because probably at one end point we're going to like expose some basic information about the hobby, but we can expose some information also about the price hobby as well Uh, what are you saying to me? Notations are not allowed here class or interface. Oh, sorry It's too early. It seems to me. Uh, okay And I have forgotten something else here as well wait, I forget expected color class Is it hobby permits priced hobby? Well, I'm that you are not taking this into account for me One sec project structure Modules 17 17 Okay Notations are not allowed here Why aren't you allowing this to me? Public class interface It's the same thing Okay, uh, let's me let me go further and maybe I can solve this down road. So let's go to the one that's called priced hobby and let's make it also a sealed class and Well, I can say on this one that extends a basic hobby Um, and it also permits inheritance to complete hobby Which is another class and for this one. Sorry Uh, I forgot to you know, pay some information for this one I would say that I would need like, um, I don't know the information about the price only So I would say public double price and that's it. Um And it's going to be enough for the moment and now let's go to complete hobby And this one is not going to be a sealed class anymore as this one is the last one in our hierarchy. So I'm going to say non-sealed class complete hobby extends priced hobby Extend price hobby and I can say here public string link Maybe I want to give it a link and also public double accessibility I hope I wrote it well So, okay Uh Why are you having this problem here? Public class or interface expected? From here on to the basic hobby and to go to the more hobby Wondering if this one took into account everything Oh, let me just go a clean and go with a package That's an interesting thing um so It's a good uh a good feature of the IDE Wondering if I would like reload the project It is going to fix it reload On disk, okay Okay, so let's go further and see how this is is going. Um So this is the first part of like coding the rest easy endpoints, you know and have it available Now let's consume it also at the level of the hobby resource and um Have it defined there as well So for the hobby resource what I would like to do is actually define two endpoints of mine and Use my injected end point So I'm just gonna go here and Have these two coded with the activity service I defined earlier But not only that, uh, I want to give a little bit more. Um Like complicate things a little bit and have my own hobby like Logic and use something that is um coming also from I think from Java 13 and use um the switch case with yield So let's like Define any path for this one and say for this one type and Code it here Let's give it public these parts that hobby I type and code it here with that path program and um Did it like String type Okay And import the class and of course now the turn I'm going to do this small hack here switch by type and Let's do some switch Now what I can do I can say that for example it can happen like um If the type of the activity is recreational this end point always I would like it to return something to my end user. So Please use yield You know All right, uh to respond using status It isn't checked at the right response. Yeah, it uses the right response I was like really really worried that's not using the right response So yield response dot status And say response dot status That okay And now let's return dot entity um And say service Not Get activity by type type And now let's build This can be one of our paces Why is this not Let me Don't like this But we'll go further And use something else For the rest of the day Now next one is a case drawing And um, let's just say yield And for this one, I don't Just going to copy paste this but instead of responding with okay I would say hey, there's no content if there's drawing because there's actually no content activity api for this one And I'm going to use what I did earlier for basic hobby and use the m to response What you can see here is that I'm not using the break case anymore So this is one advantage that comes with a later versions of job It's like you don't need to use the break case anymore So now let's yield um and say like invoke service unavailable Unavailable And this is by type because I want to like create my own method that service unavailable And just going to go here Okay, and just go here Sorry about this And respond with it With this part here with the logger, of course, and I need a logger which are very popular nowadays. I think we a little like We've all been hearing about the logging issues And now things are getting slightly better. Um Let me just Look at this one. Why aren't you? Reload from disk Because the mvm cling package was okay. It's just the ide that has a problem It seems like we just go here and say Java 17 mvm Park is Dev It's gonna be interesting Compilation failure expected, of course, there's a Something that I forgot At line hobby resource line 45 What did I forget? Oh, yes, I forget something about the switch Because I'm returning something Well, let's use this one And see if everything's okay. Okay. Seems that my app is doing fine an error report Okay, I'm using java 17 a fatal Destination must be aligned Oh, I have a small grahl vm issue. It seems Um So let me go To a project that actually compiles I have another one here Oh, okay. I'm getting my sample app From another place as I Unlike all this redness so We don't mind I get it here And again same thing with the hobby I clear java 17 mvm park is that Okay, this one seems to be fine Interesting Well, it's the pretty much the same thing as we had earlier. Uh, but Let's not just go to the browser and test our things now that we We have things running So let's go to local host 8080 and go here And use the dev UI to check our endpoints And in the dev UI, I can go to the small write open api And let's invoke our actions by type because it was the most interesting thing that we coded and was like for recreational Let's check if we get a response Because for recreational, we should get something if we get drawing We shouldn't get anything so we should get no content Yeah, we get the 204 And with no content and we get just content type and if we're like saying music Uh, we should be getting a 503 like service unavailable So we're getting that the service is not available as we have coded it before So now it's being said Uh, let's go and make our application a little bit Resilient if for example, um, something is wrong with our Endpoint with our board api endpoint. Let's Make it here. Um, so if I would add like um s or an e like board api Board the pie This one doesn't exist. So let's go here and make sure that this one doesn't exist Now if we are not going to protect our services Against any type of problems What is going to happen is that this get activity by type is not going to be working properly So if I would go again here And I would execute not music. I would say recreational because that one was working earlier Uh, what I'm going to see the 500 and internal user internal error some very bad examples Exceptions which is not really really great for end user experience And we would need to like to make it a little bit resilient. So let's make this bigger And make our application resilient. Um, what we can do thanks to the full tolerance that we have added earlier in the extension part We can add the circuit breaker pattern and um a second in the the wood davia the circuit breaker annotation And use a failure ratio like to specify. Hey, when the failures are like 75 percent Please try to like we do not allow calling this for the api and true like try to see if this api is better like after four seconds Then if you can if you're like invoking a faulty endpoint, you'd like to trace a little bit if your faulty endpoint is You know working If it's not working, you don't want to wait for a long time for things to return something faulty So like you can shorten that by using a timeout. So when the timeout is reaching 250 milliseconds A timeout exception will be thrown. Thanks to this annotation And well, you can still try to see if things are not, you know getting better By using the atry try annotation and having like max retries four times And between um each retry have like I don't know one second But if things are not going to be like working for three out of these four retries In a timeout of 250 milliseconds the circuit breaker is going to be triggered At this is a 75 ratio and next what you can do is like offer it to your end users Way to like having a fallback And you can have a fallback with default basic hobby And this one with the beast default basic hobby What you can do is like offer them Something in between now typically how would you've coded this default basic hobby class before java 17? You would have had like an inner class that would have been static And would have done something for you now. Thanks to java 17. You can define this as a record And by implementing fallback handler, you can offer something to your end user until your consumed endpoint is recovering And this is pretty pretty great in like You know, I'm not having to define any more of those public static classes And I don't always think so try to use what the goodness of java 17 is bringing to you even in your custom implementations The next thing You see here that well, I have some problems when invoking things, right? And one of the goodness things that can help us when we are like consuming these faulty endpoints Even with java 17 is like to use continuous testing of quarkus So you see here that I'm say is saying tests pause and press hard to resume testing Now if I'm going to press r the tests that I have created for my endpoints are going to be ran And whenever you're making a change to your class, your tests are going to be ran All the time and show to you something in the background. So for example Earlier when you saw that my endpoints were failing my test would have failed as well So whenever you're making a change, um, this will be taken into account and your tests will run So this is another great thing about coming with with quarkus and is working awesomely with java 17 as well Next thing that we were trying to try to cover is In the session is um like why not use this kind of endpoint also with I don't know when you're integrating And you want to store something into a database. So also thanks to quarkus like version 2 You can have um defined your data source and have um I'm saying um on automatically a config for you with zero data source configuration And to do that I need a small Thing to be added to my project So let's say that I would need to persist data in my pause process ql And I just need to add the copy and leave and command and add it here cancel Okay, I'm 17 at this extension and I can also add uh because I Don't like to code all my skill queries myself. I'm going to use the hybrid rm with penachi extension I'm going to add it as well here and you can see that all the time the Context is being reloaded and everything is being done for me when I'm working in in dev mode And since I've added the new database like connection and configuration to my To my project. No, I just need to expressify the kind of database so I'm going to say pause process ql And thanks to this annotation since this part here when I'm going to let's reload this one and Start my docker contain my docker locally So I'm just top this holding on so this is going to start and That's going to run it again So when my docker is starting um What is going to happen is that quarkis is going to automatically detect the data source that I have like needing here in my local development Like post-process ql, but I didn't do any configuration to my possible scale connection. However since I am using the goodness of like Having the data source there and um quarkis too quarkis is going to try to search and start for me also a database of post-process ql database configuration. So Added here It should have been like just Hope that I have taken this into account me one second Always sometimes I can be things send me too fast and not seen so, yeah what happens is now if you see here that Container has been built. So dev services for the default data source post-process ql started and um the Database was initiated for me without me doing any changes and specifying any URLs here So that's another goodness that comes with uh with using quarkis It's like you don't need to specify your own database and your local and your local setup to have some things The spin up in the background Now let's move to like a containerizing this application and I think we can Like Oh, I am already over. Yeah. Okay. So I'm really sorry Anna, but Yes If there's this last thing that you want to wrap up Because we need to move to the next session. I'm really very sorry No worries. Maybe if you want to just wrap up wrap up your talk. Yeah, please sure. Thank you very much guys So next thing that I wanted to show to you is that you can build your own Container image using jib and you have all the configurations here And I have swapped, you know the default configuration It was for java 11 by using the base native image that is using java 17 And you can also try this all this nice code that I've shown to you today And there's a very nice article written by me on developers.redhat.com only by scanning the QR code shown here So that is going to take you to the article and to all the code that I showed to you today So everything you can find it there and I'm going to answer the questions in the chat because I've seen some questions there So do not worry. I'm staying here for a while. So please do not Worry ask your questions and I'll answer all of them in the chat. It's my pleasure to answer to your questions Thank you very much for listening to me And of course last but not least two awesome books written by our colleagues Alex Soto in a decent border and of course natalia and marcus a selly for modernizing enterprise java both using quarkis Thank you very much Thank you