Rapid Development with Azure Spring Cloud

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
all right welcome back to the architecture track it has been a mind-blowing morning at spring one and we're not going to stop there we are going to i'm going to rapidly hand it off to josh julian and layla to talk about rapid application developer development with azure spring cloud so take it away guys hi hello welcome welcome to a session on weapon development with azure screen cloud we're going to introduce you to the new enterprise chair from other spring clubs that was just announced a few hours ago so that's the first time anybody does it because it was just announced a few hours ago so i'm julian ajiwa i work at microsoft in the java developer advocacy team i'm here with my friend josh long hi my friend aria good morning evening yeah evening for me morning for you happy to be with you josh and you can see that both josh and me we are wearing glasses why why are you wearing glasses leila do you have an idea maybe it's because you can't see sharp like me hopefully hopefully hopefully it doesn't get any worse than this there's nowhere to go from here and so layla is going to be here for cutting chap stuff because we can't and thank you for joining us leila also so let's get started look at the coding uh let's finish that presentation because we've only got one slide uh we're going to be cutting for nearly one hour so here is the new azure spring cloud enterprise here so i'm going to create a new cluster and then we're going to play with it josh is going to cut some some spring uh java stuff leila is going to cut some c-sharp stuff i'm going to deploy everything and we're going to have a look at how everything works so i'm going to create a new cluster so don't have a look at this it's this is a dog food subscription i'm testing something which is not released yet it's in preview so that's normal uh i'm going to create a new service i'm going to call it string one and keep it in s2s and as you can see we've got basic tier so that was announced some time ago for other screen code but we've got new tier so so that's here was what we used to have by default uh like last year and now we've got this new enterprise chair for production workload so let me select it and i'm going to select the box here because uh this is something for testing and let's have a look at this new dialog box that did not exist before that's vmware tons of so that's the new enterprise here we've got several new things here so you can see we've got screen support so if you're using spring well if you use azure spring cloud i'm guessing you're using spring so if you're using spring now you've got spring support here directly from vmware we've got a new build service so we still have a build service for the basic and enterprise chair but this one is completely manageable you can customize everything it uses something called build packs so if you if you don't know about it i will look at that's what spring uses by default to build docker images and air is going to be built by the cluster so that's what i'm going to do in fact i'm going to just push my java code and it's going to going to be built by this build service we've got a service registry so that's eureka if you used as a sprint code before that's it says the usual uk but it's a enterprise edition from vmware so let's say it's more secured and and so on and we've got a new application configuration service this one is a bit more complex and that's why i'm going to detail it a little bit more traditionally with spring we configure our application with something called the spring cloud config server that's what we have for the basic and solar chair here we have the application configuration service which works the same so i'm going to connect a git repository to get my configuration it's working same but it's a kubernetes service so it's more secured it's more powerful and well we're going to to see how it works in a minute so i'm setting everything because i want to show everything i'm going to then select one log analytics to workspace to analyze my data this is application insights so starting also now we're going to have a detailed monitoring of our java application inside azure sprint cloud it's not limited to central quest here you get this everywhere in in fact everywhere in azure when you run java so we will have a look at this we will have live matrix of our application and then i can review and create so that's my cluster i'm going to click on create and well we'll see it's going to take roughly 10 minutes to create my cluster whilst it's getting created i'm going to give back the screen to josh and josh is going to code our first micro service in java so josh thank you my friend screen so uh so now that you've kicked that off we we we started the presentation and we ran straight into kicking off the cluster and the reason we wanted to do that is because it does take some time but i think it's worth uh restating what we're doing right what we want is to have a platform to help us automate deployment into production and so we have this really really amazing turnkey environment built on top of kubernetes called azure spring cloud and it's a jointly developed by both microsoft and and uh and vmware um and it's a it's a we we're trying to make it the best place for you to run your spring-based workloads hopefully you saw some of this in the keynote this morning but if you didn't you should know that this platform is uh is now at least two years old and um we've just announced some big things today including the enterprise uh tier right so uh we'll talk about that uh more you already saw some of that one of the things you have to understand is that you can actually provision the cluster in azure so it's just another thing that azure offers you and you can actually provision a cluster scale it and and configure everything that you just saw and then you can use it uh and what better thing to use it for than to deploy uh and manage applications so let's go ahead and do that we're gonna go of course to my second favorite place on the internet uh my first favorite place if you saw the keynote you will know is production and uh today as often as not production is a cloud like azure spring cloud so what i'm gonna do is i'm gonna build a new micro service here and i don't really wanna spend all that much time worrying too much about the domain or the or the specifics of this application so i'm going to build it just a trivial domain trivial demo application we're going to build an application that uses the spring boot actuator it's going to use the reactive web support it's going to use r2dbc which is the reactive sql datastore abstraction it's going to use postgres which is a sql database uh it's going to use eureka for service registration discovery it's going to use spring cloud sleuth for for distributed tracing and with that i think i'm satisfied with my selection obviously i've got a lot of other choices i could make but for now i think that'll do so i'm going to go ahead and hit generate and then i'll open this up in my ide so customers.zip and this is you know it doesn't much matter what id you use uh layla from the net uh ecosystem taught us i i think just yesterday that you can actually use visual studio code and kotlin together which i think is super interesting i i had no idea that was a thing you can do but if you were using java you certainly could definitely easily you know almost everything will support editing java to such a level and quality that you could actually build spring boot applications in those tools so visual studio code of course is excellent for this kind of thing uh intellij and and of course eclipse and uh anything that supports language servers so emacs and what's that one from from github adam right adam they also support it so a lot of different options here to do a that'll support a competent sort of experience uh but i'm gonna use intellij which is for whatever reason not that competent these days i i love uh my my intellij but for some reason nowadays when i open up a new project if the local if the maven dependencies on which my project depends are already resolved and locally cached it shows that sync error when it first starts up and that we've you know uh that bug has been reported you can easily clear it by just refreshing one more time and it just seems to i don't know it seems to be fine the second time around but anyway we're going to build a new service it's going to be an application that stores data into a sql database and i'm going to create an entity to manage that state uh so i'm going to create an object this is a an object uh and you know i want getters and setters and tostring and hash code and all that kind of stuff i could of course manually create that but instead in kotlin i can use this nice little convention here to create a dana class okay now this is going to have getters uh these are going to have only getters not setters because these are immutable fields and i'm going to map this data uh to a primary key which i'll signal with this annotation here and the repository is going to be the thing that actually looks for that so i'll create a reactive crud repository and you know we could spend a lot of time talking about reactive apis and so on but all i'm trying to do here is to establish that um i'm going to create a simple api that writes data to the database okay or rather reads data from the database i'm going to create a risk controller here and i'm going to inject in the constructor a reference to the repository so customer repository voila and i'm going to create an endpoint just to return all the customer data so i'll say give me the customer data using the repository thusly okay so i'm just having i have a constructor it takes it defines a field and that field is for the repository uh and uh and i use that field i use that storage uh to resolve all the records and then return them and those get turned into json so this is the basic structure of my java code but in order for this to work i need to create a um i need to configure how this application connects i need to configure uh what it looks like uh when it's when it's connected and so on so a couple things i need here first of all rtbc username and password to r2dbc uh r2dbc colon postgres localhost asc now i have an our i have a sql data store i have a postgres sql data store running on my local machine here just for ease of debugging and so on uh and i'm going to use this you know the uh demo dev password that i've set up here which i can i can afford to encode but i certainly wouldn't want this to be the production credentials right and i want to make sure that spring will initialize my sql database for me at all times not just for embedded sql databases as i would by default and then finally i want to give this thing an application name i'm going to call it customers and i think that once i've done that i actually need some sql to uh to initialize the application so schema.sql will be if you know spring boot will evaluate this file so i'm going to say drop table customer right um and i'll say create table customer id serial primary key name var car 255 not null all right so there we go and now i want to write some data to the database as well and so here after schema.sql has been evaluated spring boot will evaluate data sql so i can say insert into customer uh name and we're going to put some names here right these are names of people that i want to have as customers so obviously uh julian you're my first uh lucky customer leila there we go our buddy asir and of course i'm counted among those so uh we can now restart the application assuming that slack and that's like the zooms a little toolbar gets out of the way and we should see that i should be able to hit localhost 8080 uh and see the instance reflected in the service registry so 8761 uh is my service registry is it still compiling oh it's the first time it's compiled anything so it's taking its sweet sweet time okay um so hello computer oh it is not happy at all look at that what have i done wrong [Music] keep that list down to just 500 things um some presumably some sort of syntax error create a table customer doesn't oh yeah because you put a drop table instead of table if exists it's is it like this is it like this i never remember so drop table if exists customer so we want an edemptent drop table uh statement here okay and presumably i don't oh there it is there we go there's my service instance it's up and running it's accessible and so i think now we uh we should you know talk about deploying it what do you think there julian oh yeah let's deploy this to production okay good i'm done i'm going to take back the screen and so here we are so my cluster is still being deployed because you went too fast so i'm going to use this usually taking 10 minutes but i mean you don't create cluster every day can you show me what that do you have a smiley face in your terminal in your shell yes uh i've got a smiley face by default like a ted lass of those shells yeah that's great uh so well let's have a look at this class that i already created uh and and uh well it will allow us to go maybe a little bit quicker so few things i want to show you here so the service registry so that's eureka and and when we will deploy uh applications there well we will see them here uh we've got application configuration service so oh it's deploying that one let's keep this one because i'm not going to go through too many screens so uh this is new so this is going to configure my application using a git repository so that's basically what the the the classical screenprint config server does but it's under the implementation and this is set up to go to this specific repository let let's just go there so it's public so you can go there too and have a look at our configuration what i'm reconfiguring here is uh well the database configuration from george so i'm going to use this postgresql database that i created earlier with the specific username and no password i'm not putting my password on a public git repository thank you so what's important here is of course a normal person will secure this and here you will have all your spring configurations that will be secured and and version here and that configuration data will be sent automatically injected into your app which is called customer let's have a look at my app so i've got an app which is called customer oh and i'm going to show you how i do the database password so you you see that i'm not cheating too much so in order to deploy an app you wouldn't have to recreate the cluster each time you just create this one time and then you just reuse that cluster is that true yes oh let me create sorry let me create a new app just to see how it works i'm going to create a new app which is called test giving it another two cpu and i just click create and that's that creates a new app that's as easy as that it takes a couple of minutes and we'll see when it's created so you know and so customers is already created and it's already uh uh configured so i've got my database password which is in my environment variables here there are many ways to do that you can use also something called key vault in azure there are many ways to do this but just don't put your database password somewhere with available for everyone so i've got my application which is created but i haven't deployed any code yet so i'm going to deploy the code from from josh and that code is going to so credit the database table and and everything let's go here and let me use the command line so you there are many ways to deploy we even have plugins with intelligent and uh and and this is your code well i can show you the plugin here but as it's a preview version i'm not totally sure the plugin will work fine so i'm not going to use the plugin here but here we've got uh the azure explorer and if you go there you can i think there's also an even plugin yeah oh yeah to deploy sorry to deploy yeah there are many ways there's maven plugins there's a greater plugin that's terraform stuff also uh we have performed support we've got bsap support because we microsoft we've got ide plugins and we've got the command line uh so there's like 10 ways to do it uh the probably the easiest way well i mean for for a demo is to use the command line we can see here i'm saying so easy it's your common line i'm saying azure spring load app deploy so to this resource group to this cluster to this app and to the subscription so deploy the code that is inside here so i'm not building my code i'm just sending the code that josh coded i'm sending it to the cluster and the cluster will build it so that's what we called earlier the build service uh so that's very interesting because uh you can also deploy like basically you can deploy stuff in three different ways you can build your own docker image and send it you can build a jar file and send it or like i'm doing here you just push the source code and it works this has got different interesting attributes the most important thing is that it's going to be built on the server using build packs so that means that your admins uh can select for example the gvm you you use can apply security patches and so on so you're going to have something which is more secured and more up-to-date than what you would do by yourself so it's normally a better way to do it and it can be fully tuned on the enterprise tier of other spring code so i'm going to let it build so as you can see it's building the jar file building the docker image putting the java inside of the perimeter then going to push it to the server and then it will be deployed uh let's not wait until it's deployed and let's go to our second app so we got fast and we can see more things uh second thing we want to do so josh created the java file a java project layla is going to do the same thing with net and i've heard that it's working same thing in dotnet in java so that's pretty exciting leila can i give you the screen of course you can okay yeah you are awesome right let me share my screen and there we go so as a nat developer we're not going to be using spring we're going to be using steel toe which brings you a lot of the functionality that spring does and this is going to look really familiar compared to what josh just did we have an initializer here in steel toe as well and josh has already given me sort of some some database structure and api structure that he wants me to return to his app so we're going to go ahead and code that up now so just like in the other initializer i can set up orders here uh we're going to use the latest version of steel toe which came out just a few weeks ago and azure spring cloud supports.net core 3.1 because that's a long term support version and i think we're getting an upgrade coming january to be confirmed so we need this to be 3.1 now we're going to add a couple of dependencies here the first one is going to be eureka because i'm going to show you how you can easily connect an app to eureka we're also going to need hosting and those are the only two things that we're going to need for now so i'm going to click generate and then we're going to take this down into the command line so let's go and have a look let me minimize that oh just before i do that i want to show you that i've got eureka running locally you can see there's no instances here there's no trickery there's nothing happening so josh gave me that and there it is running locally so if we come over to the downloads that's where my orders has just gone to so i've just got this nifty little thing we're just going to unzip it into the correct repo so if we ls in here you can see i've got my orders so i oh hello go away i am just going to cd into orders and then i'm going to open rider so i'm using rider today uh you could use visual studio code visual studio and yeah let's open that as a directory there we go so i'm going to give you a quick tour around this application so if i come in here and have a look at our cs proj you can see that we have let me make that much bigger we've got our steel toe version net core app 3.1 and then we've got our two new get packages that came with our template also with our template as with most.net projects created from a template we have weather forecasts we don't need that we can delete it one of my favorite things is deleting code and we also have a weather forecast controller well we're not talking about weather forecasts today we're talking about orders so again i can delete that now just before i continue with anything i want to show you some of the other things that the template and initializer have added if we go into the program file you can see it's added this line here use cloud hosting and if i go into the startup it's added in the middleware already for us and this is kind of the default configuration there's a lot more settings that you can do with it but we have the services dot add discovery client and that's going to do everything for us to connect to eureka we don't need to do anything else at this point uh so we've got that now we're just going to create that endpoint so i'm going to create a new controller so let's go ahead and do that this one's going to be orders controller and we're going to zoom in now this is a view controller we don't want a view controller so i'm going to get rid of some more code yay i love deleting code it's so much fun so the first thing i want to do is make this into an api controller and i'm going to give it a route and josh and julianne have told me the route they want which is uh not pound sign orders now uh we also need an order object uh because we love our objects i have some quick shortcuts because no one wants to see me uh fudge all of my uh keys as we go um so if i bring in the usings now i have this nice little order model here which just has an id and a customer id and i'm using system.json system.txt.json to give when it's uh serialized uh the write uh json property names id and customer id so that will do it all for us uh so if we come in here the next thing i want to do is a quick method that randomly generates a whole load of orders when it receives a customer id so i have redone that as well because again you do not need to see me going through that um so if i just bring in all of my using statements you can see that this takes a customer id generates some random orders and spits out a collection of random orders uh with an id and a customer id the last bit we need to do is the actual endpoint and because this is an api controller um i can use my verbs so this one is going to be a get i'm going to give this another root definition which is going to be a little bit of a nullable one so in here is going to be customer id because that's what josh's app is going to pass us and i'm going to make that nullable just in case excuse me so this is going to be a public i'm just going to return a list of um order and that would be a get and i'm expecting an int of customer id there so that's that bit and now i set that up all i have to do is just return a random order and pass in that customer id that we got there so that's nice and straightforward hopefully and i'm gonna hit play i've got my uh eureka already running so if we go and run that hopefully everything builds it looks like it has so if i just minimize this window and hopefully if i go into eureka we can see yeah there it is it's registered and if i just go and check in here refresh the page hopefully we can see right there that it has registered itself with very little interaction from me and that's how quickly you can get a net app connecting to eureka and hopefully we'll see it deployed or some sort of deployment uh to azure spring cloud momentarily and that's all using steel toe so i guess julian we're back over to you now yeah yes thank you sir it's back to me um so sorry so my java application deployed correctly so i've got some json output saying everything's succeeded you can see it's succeeded here oh sorry i'm not sharing my screen sorry about that sorry so here here is my output from the command i just gave to the command line and we can see it was deployed to the enterprise chair and that it succeeded so if i go here to apps and i go to customers well it succeeded it's not uh well it's uh it's a microservice so we're going to access it afterwards we need we need to first go to gateway well josh is going to call the gateway to access this but here we can see that my uh my uh java app is deployed i created another gateway uh to do the same thing as what layla did but i haven't deployed it yet so we can see we've got a winning instance but it's a test instance so there's nothing uh what's important here is to see registration zero so it's not registered so i have deployed the java app but not the net app it's not that i don't like you layla so that i don't like dotnet uh it's part of the of what we want to show um josh is going to create a gateway that connects both microservices and uh well it's fun to show when everything succeeds but it's also interesting to show when something fails so i didn't deploy it on purpose so we're going for some failure and we're going to have a look at how the enterprise chair of azure spring cloud uh well manages that and and and monitors it um oh by the way i just forgot to say if you want to deploy your.net app on azure sprinkler same thing as java you can build it so it builds a dll from what i understand and you push it same thing as a jar file or you just do like i did for java you know i pushed the the java code you just put the dotnet code and it's going to build it and run it for you so same thing uh so in order to be able to access those micro services well access java one and fail to access the dot net one we're going to need a gateway and so i'm giving back the the screen to josh because josh you're going to build a gateway for us is that correct all right good stuff so um thank you for that so we have now a we have a um a customer service with a lowercase c and then we have an order service with a capital o and uh it's fine yes you're wrong josh you're wrong remember you're the wrong one that's true i'm gonna i'm gonna ah it's fine the world's fine anyway uh we've got our we've got our two micro services and happily they shall coexist uh in production um but i i don't want to give direct access to each of these constituent microservices to our outside clients so i tend to as is my habit uh introduce and a gateway right and so uh we can you know this is one of those things that you can actually do um is it already there or will it be there is it a do it i've already got a gateway but it's created but it's not it's not running okay so uh i mean is that in the enterprise tier oh sorry uh you you you you you're removing all the fun yeah what you're going to do is is for nursing uh one of the new stuff of the entrepreneurs here is that we're going to have a commercial edition of springfield gateway so currently uh it's not really yet not in the preview so you need to cut it like josh does and and what you do uh in the standard or basically but very soon in the troposphere you will have a commercial edition of springfield gateway so everything that josh is going to call will be useless because it will be well provided out of the box by spring clude by other spring cloud right on but in the meantime we can we can get some of that power just by using spring cloud gateway directly and this is also a good chance to demonstrate uh you know some of the nice nice features of reactive apis namely that it supports easy scatter gather service orchestration and composition and so what i'm going to do is i'm going to create a gateway service here a configuration class let's see here configuration class crm configuration and in that class i'm going to define a spring cloud gateway gateway and i you do that just by creating a bean that returns a route locator so i'll use a route locator builder and the route locator builder will be uh you know i'll use this nice kotlin dsl that comes for spring cloud gateway to make the work of creating a gateway even easier so if you've ever done it in java you know that it's it's it's it's as trivial as a trivial as it can get uh given java but with kotlin we can go just a step further and so the structure of a spring cloud gateway application is that you have routes with zero to end routes where each route can have a predicate and so in this case i want to uh describe a path i want to match a path coming into this service on the port which is um let's say 99.99 and i want to give it a spring application name uh and i'm going to call this gateway so uh when a request comes in to localhost 99.99 for size proxy this will get matched and then i want to take that request that incoming request and forward it on to the customer service okay so i've got the customer service running on my local machine and in the service registry uh it's it's discoverable through the service registry um and that'll work just fine right that'll be okay but the problem is that proxy this path doesn't exist as such on the customer service right so what i need to do is i need to actually use a filter here to swap out the incoming path and replace it with customers which is a known path that exists under the customer service right so this is a very trivial gateway but it's just it does work right and now i also want to have the order service running that layla just finished up so i want to go here and i'm going to run that cd orders net uh and i'm going to do dot net i don't know actually i think i do i have it already running no i don't okay so net run and go okay this worked a minute ago yes okay good stuff so localhost uh sorry i don't even need localhost let's just go to the registry to confirm that everything's okay there we go so our services are there both of them are just fine now i want to i want to be able to um uh i've got a gateway and this is this is kind of like a proxy what i want to do now is i want to actually create an api adapter that's going to use reactive apis to uh interact with the downstream service and i'm going to use the reactive non-blocking http web client uh and in order for that to work i need to create that client right so i'll create a bean uh like this and the web client in order to create it i need to have a web client builder leslie so web client dot builder dot build okay and uh in order for that to work i want this thing to also understand how to do service registration and discovery so service registration and discovery so what i'm gonna do is i'm gonna i'm gonna actually create the web client builder bean itself and i'll annotate it with at load balanced right so this was gonna plug in an interceptor that will understand what what i mean when i give a host name that matches a service id in the registry so customers orders etc so this prefix means load balance this is the service id this is not dns okay so that's my spring cloud gateway code let's also um create a uh you know create a reactive endpoint that composes the data we're gonna do scatter gather sort of surface orchestration and composition i'm gonna i'm gonna do that here with a um a crm client okay so class crm client and private val http web client all right now uh first things first i want to get the customers don't die so i want to say this dot http dot get uri and here too i want to use the service id not the host and port so i'll use uh because i've configured an interceptor to support service registration this will just work uh the data that i get back i want to turn that into a stream of customers so i'll use rayified generics here sort of quite you know pseudo-refined generics i need a i need a client-side representation of that type so obviously i'm going to go to the service type here and i'm going to do something terrible uh again something you should never ever do ever not even when you're all by yourself at home and no one is looking i am going to copy and paste code and there we go so there's my my customers proxy and my end point now i want to do the same thing for the orders endpoint here of course i don't actually have a service i can just copy and paste from probably for the better so i will just uh i'll just do the old-fashioned way okay good so there's my order type and my customer type and remember these are these are two different microservices a customer has orders zero to n orders um you know it it's it's a it's a question about modeling maybe one is a you know bounded context and one is one part of the aggregate of the other and i i imagine that in a real production environment both records would continue to exist even if one side or the other was uh was deleted so i keep this as a separate thing so get this.http.get. uri http orders and i want to get the orders endpoint um and i think it takes an id right is that true yes it does it takes an id okay so i'll take retrieve and i want to get the stream of orders okay there's my stream of orders and i have to actually pass in the parameter there and that'll come from here good so for now whenever whenever i want to get the reactive stream of orders i can just call that one i want to get the customers i can call this one and what i want to do now is to take both streams of data and compose them into one view of the data so i'm going to create a composite type an aggregate uh so it's going to be called customer orders and i'll have the customer and i'll have the orders seems reasonable list of order and this will look like this custom orders equals this dot customers dot uh flat map and here i want to create a tuple i want to store them i want to store in memory the reactively resolved customer so for each customer in this reactive stream i'm going to visit it using this flat map operator and there's an implicit variable called it so i'm going to store that uh in you know a a kind of a named typed array where each element can have its own unique type that's called a tuple okay so the first element will be a reactive stream of customer the second element will be the orders for that customer right so orders it dot id and i'm going to collect all that into a list and so now i've got a tuple if you look at this thing right here if you look at the next type it you know the the thing i'm using here it dot uh you know it is a tuple two it's a type called tuple2 and it has a field called t1 and another one called t2 and so t1 corresponds to the customer and t2 corresponds to the list of orders for that customer so i can given that i can actually just map that into a an aggregate type right so it dot t1 and it dot t2 okay good uh so there's our uh aggregate and um i can now use this i want to actually just create another http endpoint here i'll just create a controller so at rest controller class customer orders private val crm crm client and you know i'm using i'm using http because you know why not i'm using rest uh but as we just talked about this morning you could use graphql right you could do some really interesting things here it doesn't have to be rest you can use our socket right you can do all sorts of things here okay so there we go there's my simple endpoint and i'll make this available whenever somebody goes to cos does that look right that looks good to me i think so i'll go ahead and make sure we've got the properties let's kick it off now this is going to talk to both services one.net one uh you know jvm kotlin right and it's going to give me a view of the data through the proxy and it'll give me a view that i'm going to compose now obviously in production in our production for uh the purposes of this demo we don't have the order service so you know when this when we when we invoke this service pay attention because it's the only time you'll see the whole thing working for now right okay so localhost uh what do we say here 99.99 is that right uh yep cos okay there we go so we've got a customer and we've got orders for that customer got a customer and orders for the customer and again the endpoint there that layla built just returns a random number of orders but given a customer id we just want to synthesize some orders so that we can see what it looks like but you can see it's all for the same customer right so customer id 1 customer id 1 etc good so that's working now what about the proxy endpoint well again thanks to spring cloud gateway that was trivial to set up and that works as well all right i think we've got a gateway now um so you think it looks awesome uh i'm very impressed to see that well everything that you can call in such a little time and i think it's great for people to see that they can use a microservice in java and microservices.net compose them with a microservice also in java and that everything works together uh in a unified way and so whatever the language or the tool that you want to use well you you're supported by azure spring cloud so let me share my screen again and let's have a look at how we can deploy that gateway so um oh sorry so those are the logs from my uh previously deployed app so i'm going to kill the log i'm going to go to the gateway and i'm going to do the same thing and deploy it so same thing as before i just do ac spring code deploy uh with the gateway and i'm going to push the code and it's going to be built by the build service and so on and so forth so all of this should work uh this is going to take a couple of minutes so i'm going to now show you what uh we are deploying this to so uh we've got so different apps oh so we've got four apps because we created tests earlier just to show that we could create a test so this one is not really working uh we've got customers so the java app that works orders.net apps that doesn't work and the gateway which is being deployed at the moment and the gateway is a is a uh has got an endpoint which is assigned so it's available on the internet so others should not be available on the internet that's the whole point of microservices it's a hidden there's stuff that you work on but the gateway here is available on the internet and is opening up uh votes to those micro services so the first thing i wanted to show second thing i wanted to show quickly uh just to show exactly what we're doing uh is postgresql because it all comes from postgresql we've got data coming from postgresql so you remember josh created a sql file earlier uh sorry here it is uh he created a sql file earlier to create some data and we deployed and so if we go to postgresql uh uh well it traded uh in in our in our schema it created one table called customer where we've got our customer so we're going now to have a look if all of this works together well if my data is in my database we can guess that the microsoft is deployed correctly but then we need to see if the gateway connects to the microservice which connects to the database and all of this works together uh let's have a look at what the book is deployed well i guess we can call it now so i'm going to do two curls so the first one is on the proxy so that's what george did and that connects to our java microservice so this one should work without any issue yes and it's giving back data from our database so we know that our micro service connects to the database and everything is working fine so that's cool uh second thing that we want to do is connect uh to that aggregate uh root which will not work so i'm going to call it and indeed we've got a five or a 500 error message internal server error which is bad and so as a developer here so i can see everything is working but it's quite limiting to to to do call requests so let's have a look at the monitoring capabilities of other spring cloud and for this i'm going to go directly to something called application insights so it's another tool for monitoring applications and so it's very complete there are lots of stuff as we've got only 10 minutes i'm just going to focus on the most important ones the first one is live matrix so this is new uh this is arriving to everybody who is running java and azure including as a spring cloud but not limited to other spring cloud and so this is monitoring our application live so here we've got a java agent that uh instrumented our app and without doing anything as you saw we just get pushed to code well my app is instrumented and we can have a look at it in real in real time so let me just do some call requests at the same time so oh sorry so we can see some requests arriving as a request yeah good request good request good request and we can see here you should be able to see the request arriving here and then we can see also our services here we can see the customer service and the gateway service and both of them are having a few requests per second well not a lot i'll just click you know quickly and we've got some requests here arriving uh that's the first thing that that's just to have a look live that's what's happening in my in my cluster then the most interesting part is the application map so again we didn't do anything uh here we also request by the way uh if i go to application map uh without doing anything well the only thing that we did is that josh selected a other spring called slice when he generated the apps so thanks to slurs our apps have got automatic tracing on them and they are automatically instrumented by other screen cloud so when you deploy an app towards the screen cloud what that app automatically uh is scene a and is instrumented and this is going to show us what's happening in our cluster and i don't see the errors we should have some errors i'm going to push them so this is of course a batch so you're not having them live you need to wait a little bit to refresh well let's have a look at the calls that worked and then we'll have a look at the calls that didn't work if i have a look here i can click on my instance uh view oh i know let's have a look at this a little bit uh later because we can see some errors here uh we can go to the details and see what's happening uh what's interesting here is we can see what is slow which risk requests are slow and are working but you you still want to investigate performance and have a look at why this request is slow and what's going on uh and you can also have a look at what's failing and if it does not refresh on our air here it is here we've got an error so that's probably the error i did earlier and if i click on my l i'm going to be able well to to see my issues and and detail exactly what happened so let's investigate the failure so again in real life you're not going to investigate the failure like 10 seconds after they happen so this is a batch and that's normal but here just for the demo you can see that few seconds after having the error you can click on it it's telling you okay you got that l oh and that error is this one and you even go to stack trace and just actually see that i go to four or five or three oh from orders order with one which is what joshua did i've even got the stack trace so i can i can know exactly what happened so what's interesting here is that as soon as i've got an error well i can just drill down i've got the stack trace i've got to error i can understand what's happening because the issue that many customers have told us on azure spring cloud is that they're deploying hundreds of microservices well several gauge words also and it's very complicated when you get an error to drill down and understand what the error is and why did you get that error and with that tool without doing anything you've got a graphical view where you can drill down and better understand all the errors that you got and of course improve everything uh you can also see when you've got some correct requests arriving you can see why they're slow you can also instrument your database so you can have a look at your sql code and know that maybe you did a sequel request which was not optimal with me you're missing an index or something so this is extremely important if you want to better understand what's happening in your cluster and it's a it's a very important tool for production use again as the sprinkler is all about production so we're giving you all the tools that you need in order to better understand what's happening inside your cluster um i think that's all that i wanted to show for uh uh application insights uh we've got a few slides just to to to wrap up uh except if josh or layla you got some last words on what we just did uh i just i love that there's an option here for turnkey development and uh production worthiness like i it blows my mind that we just created a cluster and we're able to get a whole system of services up and running including databases and and monitoring and observability and all that stuff in the scope of one little talk at spring one that's that's the dream that's what you want you did like and this was and that was despite our cheesy jokes we still got it done in that time right like can you imagine somebody focused on the uh on the keeping their eye on their prize could do and even less time it's amazing yeah thank you um so just to to to wrap up uh uh if so sorry just let me show our faces again uh if you want to discuss with us or or learn more about other screen cloud please well come and see us uh you can follow us on twitter so my twitter handle is at julian dubois josh it's at starbucksman i think b-u-x yeah and layla what is your favorite bundle layla codes it they like it very easy yeah i should have remembered it you should have but never mind you you remembered a lot all right i'm following you so it auto completes so that's it's you and for george it's fun because starbucks because you don't sleep enough if you want to have more information about azure sprint cloud and the various tools that run as a sprinkler we've got a lot of sessions at spring one so here we have listed the most important ones there are two that i want to point to so on the left the third session there's a workshop and as a screen cloud it's an extremely good workshop because i wrote it and it's done by my team so it's excellent people doing an excellent workshop uh it's a workshop on the normalized spring cloud so you won't have the enterprise features but what we just saw is that the otherwise features basically work out of the box so if you know the normal as a sprint load well you know enterprise has a string cloud and the second one i wanted to highlight is the one at the bottom right which is a panel discussion with well our other sprinkled customers so those are some of the people already using as a sprinkler it's a discussion with them with our good friend azir uh so people who well we really know the sprinkler very well because they're using it in production uh so if you're interested by a sprinkler that's probably where you want to go uh if you want to learn more about other spring cloud we've put in here some uh url uh where you can learn about the screen cloud or you can well there's a workshop by the way uh it's at the middle one on the top so the workshop so you can do the workshop by yourself uh we've got also oh we've got a learning path for java on azure that's my t-shirt by either way that's microsoft learn so it's a great place to learn about different technologies including java and azure and last thing if you want to try as a screen called enterprise edition uh here we've got on the left we've got a qr code so you can just go there and register and you will have access to a private beta so you can do exactly like we did and play with it again it's a private beta so it's not open to everybody and there can be bugs we're still you know finishing it before releasing it but it's very interesting if you want to want to test it before it's released and that brings me to my second qr code on the right if you have some thoughts any issue anything about azure sprinkler well please go there and tell us what you think you can win a price worth up to 150 dollars uh but don't do it for the money do it for the love of spring of course uh i think we're just on time we have three minutes left so if you want to join us afterwards as a q a session uh where we'll all be going so that's that's another zoom meeting and well that's it for me so thanks a lot um joe shayla thank you thank you lady julian and thank you everybody else for joining us thanks so much see you soon yeah see you in the q a and thank you josh and leila for for this wonderful presentation my pleasure thank you josh julian and layla that was an outstanding talk be sure and join the q a session dude to continue discussing azure spring cloud in fact uh it that that topic and azure spring cloud enterprise and all that that actually coincides uh with a talk i'll be giving a little bit later today speaking of which i am going to leave my mc chair for a few hours go continue putting the final touches on my talk and then i'll see you back in this track at the end of the day but i'm going to hand it off now to ivan after the break to introduce our next set of speakers so i hope you have a great time at spring one for the rest of the conference and see you later
Info
Channel: SpringDeveloper
Views: 438
Rating: 5 out of 5
Keywords: Core Framework, .NET, Serverless/Microservices
Id: mua54c7XzZA
Channel Id: undefined
Length: 54min 6sec (3246 seconds)
Published: Wed Sep 22 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.