 I will get started. Hey, everybody, thanks for coming. This is my first time to be at this conference. So how many of you are first time? Oh, wow, great. Yeah. So any of you are Java developers? Okay, a few. So hopefully after this talk, if you don't use Java, hopefully you can consider to use Java. So this talk is about Cloud-native application development with a micro-profile and open liberty. I'm Emily Jiang. I'm a Java champion. I work for IBM as Cloud-native architect and chief advocate. So this session has a lot of content. So I go through the basic concept and followed by a demo. Also, good news is we have IBM stand that will give away 200 copies. The book I co-authored is over here. So please come to IBM booth to grab a copy. So I will have more details towards the end. So it's a talk about Cloud. So it's basically what a Cloud demand. One thing you need to remember in the Cloud, everything needs cost money. So your application need to be really small. So use less memory and very fast. So it's basically start up very fast and respond fast as well. Because I talk about Java, so obviously if you run Java, you need a GVM. Your GVM again need to be small and fast. So it's like there's two very popular GVM. One is Oracle HostBot. The other one is the open source project called OpenG9. Any of you have heard of OpenG9? Okay, good. If you haven't, check it out. OpenG9 is very performant. So it has kind of the very small and very fast. So what are cloud and native applications? Can I ask, is a microservice cloud and native application? Yeah, but cloud and native application not only microservices. Some monoliths also can be cloud and native application. So to be considered to be a cloud and native application, it has the need to have these seven characteristics. So first thing is it needs to be a restful. Basically for this, it needs to be able to scale up or down without losing any information. Also it needs to be configurable. So basically you can externalize the configuration. You can change the config value without redeploying your application. Again, your application needs to be very resilient. It shows a response under all kinds of different circumstances. And again, when you talk about cloud and native application, it needs to run in the cloud. So it needs to be self-advertising itself. So it can be discovered. And again, it needs to be secure. Some cloud and native application contains some sensitive data, so you need to be secure. And the last two is very important for DevOps. So it needs to traceable, it needs to monitorable. So if something is not running right, or if some operation failed, you need to figure out which application is having a problem. So you can fix it. And finally, is your application need to be intelligent? So is it able to communicate with the cloud infrastructure regarding whether it's ready to receive a request or is it still alive? So if it's not, so Kubernetes can destroy it on a startup or new instance. So you know it's kind of that this is a whole list. And as an application developer, we are paid for writing business logics. And your daytime job is kind of too daunting if you have to consider all kind of things. So luckily, MicroProfile comes to help. So it's come to rescue. So MicroProfile is an open source project under Eclipse Foundation. So here are a lot of projects under Linux Foundation, MicroProfile is under Eclipse Foundation, and it's governed by the MicroProfile Working Group. So this is a MicroProfile project that is the standard for creating Java-based cloud-native applications. So it's a community-driven, it's a SPAC, IPI-TCK, it's a public, and they're moving central. It has many implementations. So it has open liberty, also IBM has a web-sphere liberty. And there's the Red Hat, it's a wild fly, Quarkus, and also the like a community year oracle has a heledon, and et cetera. So there's a lot of implementations for you to choose from. So in this talk, we talk more about open liberty as one of the implementations of MicroProfile with demo in a minute. So it's MicroProfile releases. MicroProfile has been around for more than five years. So it started from 2016. And later last year, we released MicroPropile 5. And also last year, we released 4.0.1. So this is a functionality difference, it's kind of the very minimal. So it's 4.0.1, so it's aligned with Jakarta EE-8. And this one aligned with Jakarta EE-9.1. So basically it's the Java X and Jakarta name space change. Any of you have heard of MicroProfile? Okay, hopefully afterwards you all know about MicroProfile. What about Jakarta EE-8, any of you? Okay, so that's good. So in MicroProfile, these are two kinds of releases. One is the platform release, so these are 13 pillars. I will discuss them in more detail. Again, the standalone releases. So this top two is for creating reactive microservices. So this is for the synchronized programming. And these use GraphQL, the REST alternative. This is for microservice transaction. So it's non-running actions. So I will talk about these 13 pillars in a scenario. So it's basically how to create the first cloud-initiative applications. As you know, the REST is very popular. So MicroProfile has a solution for it. So you use REST, so you create two classes application. And this one is the Jaxar as resources. With these two applications, you have Endpoint, slash system, and slash properties. And then you can directly invoke getting properties. You get a response. And then for the one cloud-initiative application, so in order to create a loosely-coupled application, so inside, you use the contacts dependency injection. So basically, with the contacts dependency injection, you do not need to call the constructor anymore. In Java, you call constructor to create instances. So here, CDI container will directly manage all the instances for you. And then whenever you say at inject, it will fish out an instance and inject into this variable. So, and then talk about payload. So for the payload, the most popular payload, again, is JSON. So that's a language agnostic. So in Java, you use the JSON B and JSON P to help you. So here, when you say, okay, payload is JSON, all you need to do is add produces, so JSON. And then, so the type of inventory list, you can declare this class inventory list. And then what a JSON B implementation directly is serialized and deserialized. This object, when you put to wire serializing, when it's retrieved from wire, it's deserialized for you. So you don't need to serialize yourself. When you talk about cloud-initiative applications, normally you deal with many of them. So how can you connect them? How can you just like from service A directly call into service B? So in Micro Profile, we have a solution. So we have a Micro Profile Reset Client. So basically, in B, if I want to call the B's operation get a properties, in A, I directly create an interface of the B. So this is my client, so it's get operation. All I need to do is annotate it with register Reset Client. And then in A's other classes, you can direct it to add inject Reset Client and inject instance of it. And then you can directly call the any operation on here, like get a properties. And you might think, how does A knows where B lives? So that's by the configuration. So you do fully qualified the system client, so blah, blah. And then slash MP Res slash URL. So this is the service B's backend. So whenever you call default Reset Client to get a properties, it will go here and directly call the backend. And then the next thing is how can you document your application? So we use Micro Profile Open API. So that's directly based on the Open API standard. Even though you don't know Java, some of you don't use Java, any of you know Open API standard? OK, so that's good. So it's in Micro Profile Open API is based on API standard. And it has end point, host, port, and slash Open API. So here is directly the response. And also, we use the implementation swagger. So this is the if you know swagger, that's directly identical to swagger output. So in Open Liberty, we also have end point, UI integrated UI, swagger UI. So and then you can directly invoke the operation from directly from this UI. So next one is secure the microservices or secure cloud native applications. So if, for example, here, get a properties for host, you want to secure it. So you will use a Jakarta security just to say rows allowed. So which only means admin or user can allow access to this operation. So in this case, with service A, call into service B, it will pass the JWT token. Do you know JWT Jort? Anybody or? OK, cool. So this is Jort. So it's a Micro Profile JWT directly added to claims. One is the UPN. So for the users, the other one groups to say which group you belong to. So in this case, B receiver response and it can work out which group you belong. If you belong to admin, yes, you can access this back end. So this is security. The next thing is how to create resilient microservices. So we use a Micro Profile for tolerance. So it's basically, it's for tolerance to provide a retry capability, timeout, circuit breaker, and bulkhead is for limit how many concurrent requests. And also fullback. So it's kind of this is, so this is a fullback operation. You can specify if this one failed, alternative method can be invoked to return a good response. By the way, each slider has this URL. So it's also directly pointed to the Micro Profile repository. So the next one externalize the configuration. So basically, this is a Micro Profile Config provided way for you to store your configuration external to your application. So inside, it actually uses a Micro Profile Config inject property into a variable. And then this property can be specified in the config sources. In Micro Profile, it can be a Micro Profile Config properties, environment variable system property, and also customer config source can all specify this property. And then it will have associated config ordinal. So if you specify in multiple places, the config source with the highest number as the config ordinal will overrule. So here, this is 150. So in maintenance, it will be true with inject. So next thing is a cloud infrastructure. If you want to deploy application to the cloud, you must do the health metrics and open tracing. So for the health, basically, it has Micro Profile Health provided readiness, liveness, and also startup. So for you to put a business logic to specify when they're ready. And also, it has an end point, slash health, slash ready, and slash health, slash live to display the result. So next thing is metrics. So you can add the application metrics by using Micro Profile Metrics annotation at a time, and simply time, and counting, and et cetera. And one thing is that all the rest of services and methods is automatically add some metrics automatically. So I will show you in a minute. So the next thing is the kind of this is for debug purpose. If something is not working, and it will, if something is not working, it will just be able to help you where it's not working. So all the good news is all the rest for invocation automatically traced. And also, if you want to add additional trace, and then you can use add trace. As you know, this one is based on open tracing standard. And currently, open tracing or open sensors are merged into open telemetry. So at the moment, Micro Profile is adopting open telemetry. So this one will be stabilized and then replaced by Micro Profile Telemetry, hopefully in the next release. So next thing is kind of get started. So how can you create a Micro Profile application? You can go to start on microprofile.io, or you can use the VS code. Anybody use the VS code IDE? Oh, cool, that's good. I'm going to do a demo here. And then IntelliG, anybody? Okay, it's so interesting to know is Intelli, VS code is a majority of you. So it's also, we have IntelliG plugin as well. And if you use OpenLiberty, we also have OpenLiberty Starter. You can directly create a Micro Profile application running on Liberty. So let me start the demo now. So I will directly go to the VS code. So I have a VS code Micro Profile extension pack installed. So maybe I will cloud native for Java. And then I will use Visual Photo One. I running on OpenLiberty, use the Java 11, create a Maven, yeah, we'll get all of them. Okay, so I can put in this folder. So with that, we'll give you like two services, service A and service B. So basically service A will directly call into service B. So, and it's directly running on OpenLiberty. So let me directly start like this service A first. And at the same time, I go to service B, I will start that. So where is the running? So basically it's like in service A. So it's, if you, it's source code here. So it's like, this is the application. So it's all the JAXRS application. And this is a low controller. So it's in service, so this is the service A. And service B, so it has two endpoint. One is the client. So basically this one is kind of, it has operation do something. And also the other one is kind of secured. So basically this endpoint is secured. It only allow like a protected available to be accessed. And for the service A, it can directly call into service B. So it's, again I use the micro profile resident client. So directly do like creating the interface or service B do something. As you can see, it's directly being configured. This is the service B's endpoint. And in service, in other JAXRS, other classes, I just directly inject the resident client and I can directly call it. So service A, both service A and service B started. So it's the service A is on the 1980. So if I go to the, so it's the service A. So this is kind of the resident client. So that's directly call into the resident client. So here is the response. So if I go back to here, so if I change the service, change here, because this is service B. If I say service B, service B, I save this one. So this is the kind of, now I go back here. So you can see it pick up straight away. So this is the open liberty devil mode. So it's the next thing I want to show you is kind of the, in service A, in service A I want to like do something else. I want to say hello, maybe I will say hello, maybe a conference. So for this conference, I don't want to like hard code here. I want to inject. I want to use a micro profile config to directly inject it. So I will say, okay, the property is called a conference and it is a string, so comf. If I save that, so it's, as you can see, so the conference is not directly, so it's kind of like a specified. So I need to specify somewhere. So in micro profile, so there's the offer place is a micro profile configured or properties. So I can say conference is automatically picked up. Maybe OSS summit, so it's directly going here. Let's go back here. So you can see automatically say hello, OSS summit. So this is the next thing I want to demonstrate. For example, if a service B is not behaving, so sometimes it's slow and sometimes it's not working. So let me directly like a copious snippet here. And so it's in service B. Let me put a bug in service B. We'll be there, it's true exception. If I go back here, as you can see, and now it's really slow, right? And then later on it's not responding. So in these circumstances, for example, you are the owner of the service A. How can you fix your service A without fixing service B? And you may think, oh, why don't you fix service B? Sometimes you don't have authority to fix service B. So all you can do is kind of, you can use the micro profile for tolerance, you can retry it. And also, because it's a timeout, it's very slow, and then you can say, okay, I don't have time to wait for it. And I only wait for 200 millisecond, if you're not, and I will timeout. When you use a timeout, always the best practice to make it like a synchronized operation. So you will use the Java 8 completion stage, return that, hold that, and then you can do the complete for future, completed the stage. Let me save that. So if I save this one, now go back to here. So you don't see any slowness, and because the one thing is slow, it's automatically kind of did a retry. Like you can see 17 directly jump to 18 because I retried. And then the next one is succeeded. So this is the kind of, you create like a resident microservice. The other best practice is that you can use a fullback. So when you use a fullback, so you can say fullback method, and here maybe you just say my fullback, and in the cloud, and sometimes it's backhand and no responding. And you can also go to alternative like operation. So in here, maybe it's in here, directly did it to that. Here we see this is my save that. So this is like how to use, create a resident microservices. So the next thing is like document your cloud native applications. Actually right now, if you go back to the application here, like without you doing anything, it's automatically been like a documented. And also the open ability has open API slash UI. So it's like a give you directly display all these kind of end point. So we are dealing with this. And as you can see the 200 is automatically documented. And then you can add additional documentation by using like a micro profile open API. So here, if I say like what's the response for 404 means what's the response to 200 means, and you can add that. Let me also copy the input here. Let me save that. So it's in here if you can see, it's automatically been documented. You can even try it out. Try it out if I say OSS, submit and execute. And you can see the response like this. It's kind of also you can see 200 means and 404 means. So that's the kind of documentation. The other one is kind of the metrics. So there's the end point slash metrics. You can see the retry, the four tolerance automatically give you retry metrics. And also the like the Jaxres or the invocation give you metrics and also the class loading give you the metrics. So you automatically got all the metrics. If you want to and also you can use the macro profile metrics like annotation. You can add more metrics. For example, here you can see at simply timed. And then you can see name equals more metrics, for example. And you will get more metrics. So the other thing is the kind of talk about macro profile health. So here is the kind of a liveness. You can specify what means live. Maybe it's still have RAM. And the readiness is maybe it's when it's ready. Maybe when it's be able to connect to the database is ready. And then start up is when it's up. So you can specify, you implement this health check method. And in macro profile health is the automatic give you the other end point, like a slash live and a slash ready, et cetera. So the next thing is I want to say is kind of the tracing availability. So you hear, as you can see, we create a CN4G. So I did not do anything else. And all the trees, et cetera automatically trace the span automatically correlated to see where is the time is spent, et cetera. So the next thing is briefly, we talk about security. So it's in here, like I mentioned that this is the only rule protect is able to do the invocation. So in the service A, so it's in the service A to the secure. And when they try to invoke the secured backend, it can use like a web target to use. This is the Jakarta REST, it's directly Jakarta REST client. So call the backend. And when the call backend also push the header, like authorization this header with the JSON payload. This is when the create a JSON payload that you can see here, UPN. And also the group is said protected. Like at the moment, if I directly call them like the secured backend, so this is like you got to respond back. However, if I change that, if I change like service B, I say, okay, no longer protected. I want only super able to access me. And now, if I call it, I got forbidden. So it's, let me change back. So change back. Actually, you can also inject a JSON web token. So you can peek into what's the token like. So if they can inject that, you will see token. And then you can see token, can the token get a raw token. I mean, save that. Let's have a quick look at what a token is like. So you can see, or you can see this token. This is because this is all the 64 encoded. So if you go to the DWT.io, you can decode that. So you can decode that sounds like a G-brush string. If you put it in here, you can see here is the user and protected. So this is kind of the quick burst of view of the kind of like a micro profile application. How can you create it? It's a very straightforward. So let me go back to the slide. Talk about a little bit about the cloud. So when you kind of into the cloud, actually you need to like first build your application and then containerize the application and then like interact with Kubernetes. So in micro profile, actually it's actually a macro profile like the config can directly like in the kind of the, in the Kubernetes, you can create a config map and then specify the properties. And then you can map to environment variables and then macro profile can directly inject into your application. And the next thing is that I mentioned about the end point, start health, start ready. And then this directly mirror into the Kubernetes readiness problem, lemminess problem, et cetera. I will show you in a minute in my demo. So it's, again, if you use a yeast tool, you're still saying, okay, if you want to use a yeast tool and treat your application, this is like headers must be propagated. And then the open tracing automatically propagator all of them for you. So it's really, really nice integration ecosystem. So in summary, you use a macro profile as a programming model and you can still assure it will work really well with Kubernetes. So this is a useful link for the like, if you want to find more about macro profile going here and if you want to learn about macro profile go to openability.io slash guides and learn about Kubernetes. And then also I wrote a couple of blogs about compare spring and a macro profile because this kind of, this direct is very comparable to technologies. And also I wrote a blog about how to use the macro profile in the service mesh architecture. And this link for the Amazon, like a book if you want to buy it from Amazon. So with that, let me go back to the kind of the coding again. So next thing is like, I want to show you here, like already created this one. So it's in order save time. So the next thing you do, you just may even verify to package your application. And then you'll create a Docker file. So I can see this Docker file, you do a open liberty and the Java 11 OpenG9. And then you'll copy the config and copy the war and run the config.sh to create the Docker image. And then you do a Docker build and directly build it. So this is the next thing is the kind of the deployment. So basically it's when you want to deploy to Kubernetes and you create a deployment, you create services. So I have two microservices, two cloud native applications. It's the Apple A and also Apple B. So Apple A, the first thing is I want to find out the Apple B's end point. Once you deploy to Kubernetes, no longer localhost in 1980. So that would be a service name and then like a port. And then this URL. So you can configure it. You can see it's the kind of, you can configure that very easily as an environment variable. The other thing is the conference. It's a, we hard-coded conference, OSS summit. And in here you can override it. You can see open source summit 2020. Again, you can connect with Kubernetes, Laminate's probe and also the readiness probe. So you can use a micro profile like as a health, slash health, slash live, and slash health, slash ready, and directly communicate to it. So it's, and then this Apple B's deployment is kind of in listen to 1980. And then this is service. So I deployed this service like A is a no port. So basically you can access it via the port 380. And the map to the internal port is in 1980. And then this one is service B is a cluster IP. So it's, let me directly go in here. So if I do a, like a kubectl get services. So you can see the kind of, I have two services up running. It's a 1980 map to 380. Let me like go to the here. Let me go to the localhost 380. So it's running in Docker desktop. So here, like now I can, you can click on that. You can see the directly according to the service B because the conference I changed to be OSS Summit 2022. So you can display this straight away. So this is a kind of quick, like a burst I view into the kind of the, like create your cloud-related application and deploy Kubernetes. You can see it's like within these 20 minutes you are operating. So, and then is the EMI Kubernetes actually is also I specify actually give me like a replicas in two. So if I go back here, make it bigger. If I do kubectl get ports. So you can see like a two service A and two is a service B. So it's have like one final thing to just talk about. So it's, again, I said in the IBM booth we have, I have a book signing, like book signing and then is kind of the, tomorrow is a five, three, two, six, 30. Please turn up and grab a copy. And then there's a challenge, also the machine learning and also play a game, space rover challenge. It's really fun. So over there, I think you can get a lot of swag. We have water bottle hats and et cetera. And this is a book and then is the, this is from keynote is we very devoted to open source SSF. So please also getting involved. So that's the end of this talk. I don't know whether I have any, probably I don't have any time for questions. Maybe, yeah, if you have questions, find me at IBM booth or find me here. So that next speaker can set up for their presentation. Thank you so much for coming and yeah.