Build Eclipse MicroProfile apps quickly with Quarkus | Jakarta TechTalks

Build Eclipse MicroProfile apps quickly with Quarkus | Jakarta TechTalks



okay hi everyone we're just about to start another exciting Tech Talk and carcass is the team of the month for sure everyone is buzzing about it and we have this great opportunity to have John clinger here with us and he will be talking about how to build Eclipse micro profile applications with carcass so without really wasting too much time I'll just hand it over to John and John if you want to take it over and go ahead sure so I am going to share my screen okay everyone see the screen okay I lost your audio don't know if that's me or you okay is your screen awesome okay so welcome everyone thanks for taking your valuable time out to hear about how to build micro profile apps with Korkis and my name is John Klingon I'm a product manager at Red Hat and also a micro profile committer one of the co-founders kind of helped start my profile and my twitter handle is at Jaclyn so you'll you'll see me chat a lot about about quark is and it's a micro profile and stuff like that too so I got a few slides and then an awful lot of live coding so we'll we'll see how this goes I'll beg forgiveness now just in case we run into problems okay let me see here okay going to talk a little bit about the evolution of the Java stack I suspect many of you are familiar with doing development with Java EE right so we've we've got this stack this Java stack that's been optimized for most of the last 20 years for basically running Java applications and servers right so the expectation is that you're running on either directly on hardware or in a virtual machine you're running a heavy an application server running on top of that running on top of the JDK the JDK has been optimized for to a large degree for running application servers right running lots of tons of threads a lot of dynamic activity as you deploy none deploy applications and you've got frameworks that have increasingly over time become more and more dynamic and that means using a lot of reflection making a lot of decisions at runtime so we're where we've kind of been moving over the last three or four years has been more and more towards micro services and as you know Java EE slowed down for a while now it's moving to the Eclipse Foundation as Jakarta EE but why would it had slowed down for a while we basically as a community as you know whether it's vendors or individuals Java user groups created the Eclipse micro profile right the idea was to continue the idea of creating specifications that foster you know multiple implementations but we do it in a different way than was done with Java EE and even different from I think how Jakarta EE will evolve and that basically means we treat micro profile a lot like it's an open source community right so it's an open source project I mean so we we have multiple releases per year we don't necessarily guarantee backwards compatibility quite like Java EE or even Jakarta EE probably plans to write so we consider ourselves a faster-moving community to address the needs of microservices development there's still a lot of movement in this area so if you look to the right hand side of this diagram you'll see that there's a healthy set of specifications there's a base programming model based on Java EE with CDI JSON processing and Jason binding and then jax-rs that kind of defines the base programming model and on top of that we've got specifications that define how to utilize micro-services patterns with a specific set of api's and in the market there's multiple implementations of these api's so on the lower left hand side what you can see is it's a rather large community both vendors organizations and individuals a very active community micro profile Daioh and in the lower right hand side you see a bunch of implementations and Korkis which i'll be talking about it is also an implementation we just haven't fully run the micro profile tcks yet but there's also multiple specifications in the pipeline meaning in fact one of them is done we have micro profile reactive streams operators and there's a reactive messaging spec context propagation graph QL long-running actions so there's lots of specifications that are kind of being baked that should come out probably within you know the next six months or so so we continue to evolve pretty quickly but again we're evolving in the context of micro services development right now what's interesting is if we think about the modern enterprise Java micro services stack really what we do is we take the same philosophy that we've had in in many cases the same frameworks that we've had you know over the last you know 15 years or so and we just applied them towards micro services so instead of deploying multiple apps on top of a JVM what we what we do is we just deploy single app averaging again many of the same frameworks there are new frameworks right so Micro profile is a good example right we've got so far eight or nine homegrown specs with a bunch more in the pipeline like I mentioned so there are some new frameworks but the way that these frameworks have been evolving is if they're still fairly dynamic right they make a lot of runtime decisions and even the runtimes underneath like an application server still do a lot of optimizations and decision-making at runtime all right so that's what we're course comes in right quark is basically rethinks this and it says well let's let's optimize this stack so that we we understand that our target environment isn't necessarily running multiple applications on an app server right that is by the way monoliths the java ee model that's still available right so um what we're talking about here is if I'm specifically targeting micro services and a single app stack that's where we're looking at something like like Korkis right where I can take these applications and these these frameworks and build them with the understanding that it's going to be deployed to a kubernetes Linux container based environment and that's kind of those two icons that you see under the stack all right that's that's kind of the new target environment that organizations are deploying to and so quark is specifically targets kubernetes and containers so what that means is well in a kubernetes environment it's it's a very it's an immutable environment right meaning that when I develop a container I tend not to log into the container and make changes right what I do is I make my changes in code and then I run that code through a pipeline and it redeploys a new container right so this is the idea of a mutable infrastructure so if you think about those dynamic frameworks that I've kind of been talking about where we do lots of reflection we're making a lot of run decisions in deploying to it what's really an immutable infrastructure so Korkis tree thinks that it says well let's not target or let's not make a lot of these decisions at at runtime let's optimize the frameworks with the understanding that I'm targeting immutable infrastructure so what we do is we do the optimizations things like scanning the classpath or annotations pre compiling the results of that into the the jar file if you're going to run on top of Java or into the native binary if you're going to be running you know directly on on the operating system with it without a JDK so we do a lot of this work now at build time with the understanding that we're going to be deploying two immutable infrastructure so we're basically optimizing that entire stack right so you'll see some examples of this no quark is can run on the on the JDK you can put it in production on the JDK if you want to alright but you can also compile it down to native binary and in fact in development mode we'll run strictly on top of the JDK all right I'm gonna do a quick time check all right now if I do want to compile down to a binary well we utilize growl VM to do that growl vm is a pretty awesome project for running highly efficient Java code or even dynamic languages that run on top of the JVM now Korkis doesn't really focus on that aspect of it on the dynamic language aspect as much but it does utilize kind of those red boxes that you see in this diagram the the growl compiler or to compile it down to a native code and we really focus mostly on the Java language although we do support Kotlin running on top of Korkis as well all right and underlying even inside of your binary there's still a virtual machine running but its role is is greatly reduced compared to just running OpenJDK with with a hotspot vm so what Korkis utilizes grow vm for is both native compilation and dead code elimination so one of the things that we've done with Korkis is we've optimized a lot of the libraries so that we reduce dependencies both within the library and even across libraries and what this means that if your application doesn't use some of the code it'll be eliminated during the compilation phase and that means you get a relatively small executable binary ok ok so let's do a little bit of live coding ok so um can everyone see let's see here I'm gonna make this bigger I do have the chat open in another monitor so if folks want to ask questions or make comments about bit you know being able to see the code I write and stuff just just let me know alright so to create a project with Korkis what we're going to do is we're going to use the Quercus maven plugin so this will actually generate the outline of us a very simple restful endpoint we are working on kind of a web-based starter as well but for now what we're going to be using is the maven plug-in to generate the source code so what you can see here is I'm just pre providing the maven artifact information that I want to be generated for this right well for this project right what the group idea is the artifact idea here we're going to call it person we're gonna create a restful resource called person resource and it'll be listening at the person endpoint hey I'm gonna go ahead and create this alright so if I want to take a look at the source code real quickly what you see is it is you know kind of like what I said it's a very simple restful endpoint now let's add some additional maven dependencies so that we can build out an actual micro profile application so Korkis again with the maven plug-in has something has a goal called list extensions an extension in Quercus is basically what i mentioned it's a pretty optimized framework that well it's optimized for efficiency like I mentioned before but it's also you can assume that if it's in a chorus extension it could also be compiled down to a native binary not all the frameworks out in the Java ecosystem can be compiled down to a native binary without some extra work and we've kind of done that extra work on behalf of the developer for these frameworks so if we take a look at the extensions we've got our keys our CDI implementation for Korkis you see we got some camel extensions flyweight and other database related extensions hibernate some JDBC drivers let's see what else we have in Finnish band supports as a client Jason consuming and producing Jason via Jason binding and processing key cloak for security kubernetes I hope to have time to show that one it generates the amyl that enables you to take your application and deploy it into a kubernetes environment Catelyn I mentioned see you got transactions all these small right ones are basically micro profile spec implementations right so you can see context propagation fault tolerance Health metrics a lot of those are implemented in the small right project and kafka support and all that all right so that's quite a big list so what I'm going to do now is and here is show you a how to add some extensions to our project so what we're going to do is use the add extension goal and we're gonna specify the extensions oops if I could spell properly alright so one of the nice things about this extension is you don't have to necessarily type in the entire strings that you see here you can just type in a subset and if it can find without any kind of name it without any kind of name collision it'll add it alright so let's do a Kubb I mentioned that for doing kubernetes ya mole generation fault tolerance let's use the micro profile restclient I'm going to show that I'm gonna show some metrics I'm gonna show open API and swagger this one I'm not about because we will hit a namespace collision Korkis rest easy Jason binding let's see I'm gonna do panache panache is a layer and ease of use layer on top of GPA and hibernate so that'll be interesting show I'm gonna show we're going to use the h2 database while we're developing locally so that we use in memory database but when we go into production on our kubernetes cluster which I have running on my laptop please post Chris and we'll use micro profile health check we'll see how much of this we can actually get to during this hour so now this is going to fail because we actually ran into a namespace collision I mentioned post Chris but there's actually two different post CRA's database drivers one for you for using the async reactive driver the other one for using a standard JDBC driver so what I'm going to do is choose the standard JDBC one and we'll fix that okay so that was added now I'm gonna do one other kind of a little bit of pre optimization here in this for this project and I'm gonna set an environmental variable so I'm gonna set Quercus on task or profile equals dev so this is going to come in handy when we using micro profile config where we can have different configuration profiles one for development and one for production all right now I'm going to open this all up into Visual Studio code of course you can use your favorite IDE again well let's take a look at the palm file and you'll see we're using version 17 of quark is this is the most recent version and you could see all these maven dependencies that we just added with an extension okay and there's also if we want to compile down to native code one of the things you'll see is a pro maven profile called native and that'll let us generate a native binary I'm gonna try to minimize that because it takes a while and we don't have a lot of time to show an awful lot of functionality so I'm going to create a terminal now what I'm going to do is put Quercus in development mode actually I should have set the profile here so in fact when we do that in this terminal window now we're gonna run Quercus in developer mode so I can develop this project maven quark is : dev so what this is gonna do it's it's going to open up a debugging endpoint if I want to do the bugging I don't think I'm gonna show that here again because of time and then it actually runs the app now let's see here I am going to pull over a another window and we're gonna go to localhost colon 8080 /ui so micro profile has open API support and that's what's kind of underlying this endpoint Korkis supports the an embedded swagger user interface so you can try out the restful endpoints that you create in this case it's a simple hello world so oops actually want to extend that so let's actually try out the the restful endpoint I may have to make this bigger okay and we're going to execute the endpoint and you'll see that responds with hello now I'm not going to be using the browser to interact with the application because that I want to have to constantly switch back and forth between the browser and and the application so I'm going to do most of the work directly in in the IDE and a terminal okay so so you can kind of check check box off the fact that micah profile supports open api out of the box so i'm gonna go back to actually the presentation here go fullscreen and talk a little bit about micro profile config good micro profile sorry good micro services development style you know kind of a twelve factor app is you want to externalize your application configuration and you could do that with micro profile config where you can inject the value of a property into your application and behind the scenes there's multiple property sources config sources right so you can specify a property using a java property on the command line or you could set an environmental variable that's the middle box on the bottom or you can define it in a micro profile – config dot properties file now our Quercus does it does support that micro profile config properties file but it also supports an application type properties file and that's the one I'll be using during this presentation and you could also create custom config sources so you could create a config source for vault for eureka whatever right there's other event config sources out there in fact there's a micro profile extensions project that actually extends a lot of these capabilities of micro profile so micro github I think it's a github comm slash micro profile – extensions project alright so let's go back and do a little bit of coding so I am going to bring up oops not test mein Java person resource here we go so this is this is the code that was generated now what we're going to do is add in the ability to inject resources from an external location all right so let's do at inject config property this is a micro profile API let's make sure we choose the right one let's see what is it here we want to do name is going to be greeting and we're also going to give it a default value just so we can test it out right now and the default value is going to be hello okay and we're going to inject this into a string variable reading down here we're just going to return greeting all right so let's go back to I think create a new terminal window and I'm just going to use the HTTP ie kind of command line tool so you just type HTTP and then the URL that you want to access so we're going to do an HTTP localhost colon 8080 slash / sincere got hello now what you may not have noticed is that I didn't have to compile anything I didn't have to hit control-c recompile and then restart the app right so Korkis is actually live loading all the changes that i'm making as they make them right and it doesn't not just for code but also for properties in the property file so let's go ahead and do that oops here we go application DEP properties so we're gonna do here is we're gonna add a greeting and here let's see we want to call it oh okay okay yeah I'll do hola there we go and it's at the endpoint again and what we'll see is that get up out of the property file so there's an order of precedence with micah profile right where the look at the config file first and pull it out of there you can override that by using an environmental variable and you can eat override both of those if you use a Java system property right bye – dee greeting okay so that's pretty cool now let's take a look at another API the micro profile rest client so with jax-rs the red building out a a REST API takes a little bit of work it uses a builder pattern to interact with a restful service with a micro profile rest client what it does is it takes a very type safe approach to doing development of a restful client so for interacting with a restful service really you're just manipulating a Java object alright so let's go ahead and build out a restful client so um go back to our code and what's also nice about the restful client is there's gifts rid of some of the boilerplate so I'm gonna go find our project here oh I moved to file on accident I'm gonna just delete that earlier when I was scrolling up I accidentally copied a file all right here we go let's go back here and now we're gonna create a new file we're gonna call this the hello rest client dot Java all right and we a package and what we're to do is create a an interface interface hello rest client now we have to annotate this interface with a couple of things the first is register rest client okay and we that's going to register this this restful client so that we can actually inject it in our actual application code so next I'm going to do is at path so which end point is this going to access slash and what is the the remote service what is the remote services method signature look like from an you know method and if the HTT and for HTTP endpoint look like so we're going to use a get and we're going to produce juices a media type no that's not what I wanted that was bad auto completion there the type dot text plane okay and the mess it is just going to be public string hello so basically in my we gotta fix our imports and what the jax-rs produces there we go so what this is whenever I invoke this this end point or sorry invoke this method it's going to call the restful endpoint but one of the things we need to do is point to the URL where the actual end point is so I can either specify that I think here or I can specify it in the property file and so what I'm going to do is specify this in the property file all right so I'm gonna go back to actually I have to show something slightly different first I was gonna go back to the command line but instead I'm gonna show you the fact that I've already got a hello service running so basically I have to start it the hello service is the code that was basically generated when I generated this project at first right it's just a response hello or was some other message so what I did is I took that and I actually compiled it down to a native binary and deployed it to kubernetes and if you take a look here real quick what you'll see if I look at the actual log you'll see that this actually started in 39 milliseconds right which is actually kind of slow normally this starts in like 10 milliseconds but I have lots of things going on right now on a machine so that's pretty impressive for a java application right alright so what I need is the endpoint it's a number back to my source code I'm going to open up the property file and I'm going to paste this in what I can now what I have to do is provide the property that the micro profile rest client will read and there's a specific pattern for that the pattern basically starts with the name of the package so I'm going to copy that because it's convenient dot the name of the the class lo restclient followed by MP rest followed by the URL okay so this is going to be the endpoint and I think I need also have to add hello so micro profile rest client will read this property and figure out this is the endpoint I need to access and into the Java binding Java object binding if I need to okay so see that let's go back to our client now here we have to inject the restful client right so at inject now we're going to do at rest client okay and we are going to then have our hello rest client I'll call it a hello client alright so sorry I'm to do that a few different things going on in the background I'm trying to stop okay now this should actually inject our hello client proxy directly into the hello client variable and then invoke what when I actually invoked the hello method it'll actually make the remote call so what I'm going to do here is do hello client dot hello right so let's cross our fingers and make sure this actually works and it did so it's it's calling howdy which is the message that's actually predefined in the hello service running in the CUDA at ease runtime right which is OpenShift okay so let's head over back to our slides if we can now what's nice is again you didn't see me recompile you know all I had to do is say didn't have to rebuild recompile restart a very nice natural flow towards doing development now since we're making a remote call we're gonna add some fault tolerance support into our application so how do we deal with failure if the low service happens to be down so in fact let's even let's even do that let's actually no I'll do that in a second so what strategies do we have to deal with fault tolerance well I can use the asynchronous annotation and run a method call in in a different thread I can use a bulkhead that basically limits the number of concurrent accesses to a resource so that you're not going to overload it circuit breaking a lot of you probably understand what that is but basically let you fail fast and it will occasionally check the remote service to see if it's up and if it's up then it will call it and if it's not it'll potentially do a fallback and that's the next annotation so if you're making a method call and that method happens to fail you can provide alternative logic with the fallback annotation I'll be showing that one if you happen to have a failure you can also use retry logic with the retry annotation some might think that's an anti-pattern but if you have an unstable network it could actually come in kind of handy and then the last one is a timeout if you want to make sure that you provide a responsive well response back to your to your client you can limit the amount of time your remote call might make so you can set it though it'll throw a timeout exception if it exceeds some threshold so what I'm going to do here is we're going to take this call in fact I think at this point I can just get rid of the the endpoint that you with that big jax-rs endpoint and just simply making a method call and what we're going to do is we're going to basically make this a timeout and after a certain period of time if we don't get a response then it's going to return with a timeout exception okay and let's see here I think I need to import that and now there's two parameters I can provide one is the unit so unit of time I'll just leave it at the default which is milliseconds and it's also going to by default take one second 2,000 milliseconds but we'll just make this shorter we'll say what was it value equals a half a millisecond right so it's going to timeout after a half a millisecond we're also going to provide a fallback method so if this method fails through because of some exception then what we're gonna do is provide some fallback logic so what we're going to do is specify a fallback method we're gonna call it hello fall back okay now what to do is provide the fallback method oops sorry about that go down here and say public and the fallback method just has to have the same method signature as the method that the fallback annotation is on so public stringing we're gonna call it hello fallback and it has to return a string all right so I'm gonna return and this is Doubtfire there we go so I am now going to rerun this application and hold on a second here ah I forgot to do something let me switch gears here real quick I'm gonna add a little bit of JPA logic first like actually should I do I want to do it that way this the problem with live coding there's so many different paths you can take um actually no we'll just do it this way I guess so oh I took the endpoint off so let's just do it this way here real quick we'll add it back in it gets and a path there we go oh no just acted as only thing I think we need okay so now it's calling okay uh I went out of order here a little bit of what I was intending to do so I'm gonna go back and go back in order so first we're gonna do a JP entity using panache and then we're actually gonna rely on the fallback method so let's actually go ahead and create a new file we're gonna call this person dot Java alright so with with person we may get a GPA entity I am with a GP entity it's basically an annotated Java Bean right in a lot of ways but what we're going to do is we're going to use something called panache and to use panache we're going to extend panache entity and for some reason I am NOT getting auto completion on that so let me go back to my palm do I have panache in here yes I do hold on entity let me try that there we go oh did it do that would be nice that was the problem and we are going to import the JPA entity all right now I get some really nice things with panache typically you would have to create private fields with getters and setters but with panache you can just make them public fields so we're gonna miss a public string name and public int age right and I could annotate these with JP annotations like you know at column I can put in hibernate validator constraints and so on in the interest of time I'm not going to do that but at this point this is basically a JPA entity now what we're going to do is go back to our code and let's provide a new method get and at path we'll say list all going to list all the entities in the database and we are going to produce I think it imported the wrong one no I produces produces produces that's the wrong one all right sir that produces where we adhere jax-rs version of that okay media type dots we're going to return a Jason application Jason and why am I getting application do I have the right media type no I don't for some reason I'm having a hard time today importing the right packages okay it's dark over here come on media type and we want the jax-rs version of that Jason okay finally turn that now we're going to return the list of all the persons in the database so we're going to return let's see public list of person list all and now because we don't have a name query we're going to use a nice convenience method in the panache base class called person dot find all right is that find all there we go and return that as a list of entities now we got to fix our imports a public list must return oh I haven't returned it that would be nice now try and actually hit the end point list all and it's gonna fail because we haven't defined our application properties for the JPA datasource so what I'm going to do this is where I'm going to do a little bit of cheating I'm gonna copy and paste alright so what I've got now is a development in development mode I'm going to talk to the h2 in memory database and in production we're going to talk to Postgres now this is where that profile comes in so with Korkis if you have an environmental variable or property set called Korkis and the square profile it'll actually then utilize that profile name here and select the properties with that profile name right so i specified dev as the profile right so i prefix this these with the dev profile now let's go ahead and try this and I'm still running into errors let's see here no database driver is specified did I not hold on dev make sure I set my might my profile correctly okay and still having problems because I wonder if I have the h2 database driver in my palm this is the live coding the problem with live coding no h2 is there right here now you're all probably screaming at me right now saying you forgot something no dialogue driver specified by Quercus database that data source not driver okay go back oh I didn't save the file I think that was it actually okay that didn't work either this is actually quite embarrassing okay I have I saved the property file go back to person list that should work why is that not working well person table the table person is not found so that means I forgot to do something here I forgot to basically set drop and create so there was no database table so we have to drop and create the database table that's what the problem is all right so there we go now it worked sorry about that but the nice thing is I'm running into all these problems because of my poor coding style but I'm never having to restart right so I guess you might say that I'm actually failing fast so so now we're talking to a database let's do one other thing with the database let's make sure that we can add a person right so now we're going to use at post we're going to do a produces and consumes of adjacent data type and we're going to public persons so we're gonna return the person that we're adding edie person we're going to be adding a person person now the way that you add with panache again there's no named query there's no entity manager involved directly in the code that you write what we're just going to do is we're just going to call a person dot persist method we're inheriting that from the parent class right and then we're going to return that same person so that's pretty cool I'm going to see code and now what I'm going to try and do is actually add a person method post does not provide okay running into another error get oh I forgot to add something a transactional this has to be done in the context of a transaction because we're updating the database and I think that might be my problem there we go so you'll notice that there's actually an ID being created for me so panache actually provides automatic ID generation out-of-the-box if you want to use your own strategy panache supports that as well right okay so with all of this in mind what we're gonna do is go back to our code and we're gonna add one more method here we're gonna say it gets this time we're gonna get a specific person so we're going to specify the ID and we are going to seed public let's see we're going to make it return a string get person at path per am so we have two paths per am ID long ID here we go so what we're gonna do is then find the person person person to do a lookup by ID it's actually really easy with panache we just say person dot find by ID and we're going to pass in the ID and we're gonna return something here so what we're going to return is a string but we're going to kind of build this string from scratch so we're gonna call the hello method so I'm gonna greet this person plus and it's person's name person name plus remember it's a public property but if they were a getter it would call the getter so that's some really nice feature okay oops you are person dot age plus years old okay so that works now what you're gonna find is if we actually try to list all the people they're going to be gone that's because what panache is really doing under the scenes as its dropping the class loader and basically reloading the entire application from scratch so anything that's in memory is lost unless you persist it somewhere like a database right so what I'm going to do is I'm going to actually post these people back create these people again now if I actually want to go and just list that one person what you'll see is it saying howdy Duke you are twenty five years old right so now if we go back to our fallback logic right what we want to do then is basically do a fallback if there was a problem with making this remote call to person so what's I'm looking for our here we go for our hello call right so what happens if this fails well let's find out so I am going to go back to open shift kill all copies all instances of this application so now we have nothing and running so hopefully this time it will actually call the fallback logic which it does so that's pretty cool all right so what if we want to do some additional logic around counting how many times this method fails and then being able to view that and a graph on a dashboard for instance right so if we go back to our our presentation micro profile also has let's see where we had here micro profile metrics so with micro profile metrics I can actually create custom metrics in my application and this gives you an idea of some of the metrics that are available what I'm going to use is that counter some of this is changed with micro profile metrics 2.0 but right now we're using my profile metrics 1.1 right but what you get out of the box with metrics is an endpoint slash metrics that can be pulled by four exist for example Prometheus right and with with that you get some base metrics that are required by Mikah profile things like you know CPUs and memory available some vendor specific metrics if a vendor wants to provide that and then of course your application metrics right so let's actually try and add a metric in here so what I'm going to do is see here come back back here we're going to track a metric I'm going to say at inject a metric and we're going to give this metric and name of hello fail the number of times the hello method fails and we're gonna make this a counter okay so let's do a little bit of Auto importing there we go now every time the method fails some of these if you can find the we're gonna increment the counter so I'm gonna say counter increment right okay so let's add a couple more people because remember we reloaded so we're gonna add our people again now what I'm going to do is hit the metrics endpoint let's see metrics so this is in Prometheus format by default but you can see there's some vendor specific metrics there's some base metrics that are required by micro profile and now what I'm going to do is see if I can do a grep I'm gonna look for our application metric and then you can see see so far it says it's failed zero times so let's try this again it should fall back whenever we get this person let's see hello now let's go back and count it again and you'll see that it's failed three times right so now I can keep track of application metrics and created for fauna dashboard running inside of kubernetes and everything so I think maybe at this point we got a few minutes left I don't know if I'm gonna have time to compile this down to a native binary well maybe I'll try but I have to do one thing first I'm gonna change the endpoint here because when we're running in I forgot to make this as a part of the profiles so we are going to do colon 8080 slash hello when we're running in inside of kubernetes the URL for the service is going to be different because we're not going through an external gateway an external proxy so there we go so I'm gonna try and compile this down to a binary and we should be utilizing these database properties when we do that so first I'm going to do maybe I'll do it right now before I forget is I am going to modify my docker file to make sure that I'm specifying and the right profile equals prod there we go and we're gonna compile it down to a native binary by by specifying native but we want it to be in a Linux container so we got to compile it into a Linux binary right so that's what this line right here is it's basically says build it as a docker image which is gonna be a Linux binary alright this is going to take maybe more time than we have left but we're going to give it a shot Tanya I'm not sure how we handle QA so far seems that you're doing just the perfect job search in silver anyone have questions around micro profile or quark is please enter them into the chat and I apologize for having some some technical difficulties along the way don't really my life coding was a little bit better than that because sound came across pretty well because I was having problems on my own but I think it's a problem okay I'm double checking my cable modem and it looks to be okay okay while it builds let's see here maybe what I'll do is show you a little bit about getting started with Korkis if you want to get started with Korkis go to quark SiO there's literally a get started page where it will take you through some of the steps that I've showed you here about creating your first application that you know use the maven plug-in to create a project kind of like you saw and we do here how to build a native image how to use maven and Gradle Gradle is also supported with Korkis there's actually I'll go to extensions first there are many many extensions like I mentioned that cover all sorts of functionality that you can use with Korkis if you're running in JVM mode you could pretty much use any Java library that you want the issue is when if you want to compile down to a native binary then you might run into some issues right where you'll have to use Quercus extensions or do a little bit of extra work or work with the framework provider to kind of support native native development there's guides for all of this functionality with Korkis there's a guide on that specific functionality if you have code within your organization and your own custom frameworks we have a guy that kind of explains to you well if it doesn't compile down to native binary out of the box and you can create your own extension so that your framework providers in your organization can make them an extension that other folks can use right so we've got guides on doing you know database manipulation there's a Mongo extension being worked on right now all sorts of web style extensions some of them I showed you messaging with Kafka and reactive messaging with micro profile reactive messaging hmm some security extensions so there's actually quite a bit there I think there's something we had some camel guides here too let's see how our compilation is doing oops wear it this way and it's still building yeah I don't think it's gonna build in time so it takes about five minutes but one thing I did do and you might find this kind of interesting is I kind of pre ran this in another openshift project right so if we go to kind of like my backup project you'll see that I have this running I have the person project running and what's really cool is because Korkis is so efficient I can just run just a ton of copies of this I'll just do you know 34 now here for the database I'll go and I'll create maybe six copies what I've actually done I did this yesterday kind of testing the limits of what I could do with this on my machine and I had 200 copies of hello running as a native Java natively compiled Java application along with 25 copies of the person project so you could see it scaling up right so it's actually starting these natively compiled Java applications like super fast right and then I've got about half the CPUs allocated to this virtual machine so it's actually pretty cool and I guess with that we're at the top of the hour I apologize for some of the technical difficulties I ran into I didn't get to show you micro profile whole health checks and so with micro profile health checks there's the ability to kind of expose the health the lightness and readiness of your application to your to the environment in this case kubernetes so that if it sees that it's it's it's not life it'll kill the Potter you start it right or if the pot isn't ready it won't direct traffic to it so that's a quick summary of micro profile health again sorry for the technical difficulties no matter how many times you practice this and trust me I did there always seems to be issues Tanya I don't know if there's any close closing verbage that you wanted to add all right well I think we are actually done here I think we seem to have lost Tanya and I think we're still recording all right Oh anyway thanks everyone for joining I apologize you can find me on at edge a Klingon on Twitter and although I'm kind of embarrassed with some of the problems I ran into so just be nice alright thanks bye

Leave a Reply

Your email address will not be published. Required fields are marked *