Build Microservices with Spring Data, Cassandra, and Stargate.io

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] [Music] [Music] [Music] [Music] [Applause] and welcome everybody to our building microservices with spring data cassandra and stargate.io workshop we'll get going here in a minute but first we have a really cool music video for you to watch [Music] [Applause] is [Music] [Applause] [Music] stargate [Music] all right and welcome everybody to our workshop today i am david jones already joined by cedric linvon hello cedric hello hello everybody so happy to be with you everybody for this new workshop everybody's back to work we are in september today uh today david we will cover these spring world spring boots spring data and all the magic of the java world that's right and by the way i still have that song kind of rocking in my head over here if you guys liked that video that video was fun all right that's right yeah yeah above the cloud miss me you know maybe we will put that back that that that song in the end oh yeah that's a good idea we could do that we'll put it on the end all right so hello hello um well how about how about we just start off real quick cedric a little bit about you setter who are you who are you so i'm cedric and i'm leading the developer advocacy team here at datastax uh i'm a java geek i've been doing a spring for 14 years already yeah it stick a bit i've created an open source framework in java of course it is called ffr j feature flipping for java enable and disable part of your application at runtime with no restart and like everybody on the team i'm a cassandra expert and i do some training teaching and fun workshop like today with all of you uh i would be happy to have everybody in my network so you have my twitter hunter guitar bundle and my linkedin it's the same as my twitter so you know invite me and i will be happy to answer you what about you david oh let's see so my list i don't have as much of a filled out list as you cedric i should put more things on here is what it comes down to um but like like cedric i'm also a java geek um coded in a bunch of different languages been doing whether it's it programming database administration stuff for like 25 years um so thankfully i don't have too much white in that picture that's in my beer just yet but uh it is coming um and and like cedric though um you know i'm a cassandra expert um advanced stargate user all that kind of thing and same deal you know if you have er you know if you ever want any follow-up or anything like that you have questions you want to reach out you can find me on both linkedin twitter uh github whatever all over the place either at sonic dmg or linkedin i actually use my my real name and uh you know what's funny is i just realized cedric at the top of the slide it has ryan's name let's let's move on i'm apparently ryan wilford as well so so hello everybody and you know cedric and i may be hosting today but with this we have a whole team of folks that are ma you know in the chats that are their support this is meant to be an interactive session so if you've not joined us for one of these workshops before ask your questions no question is dumb or anything like that um and we will try our best to get at all of them so just a couple housekeeping housekeeping items so we are streaming to both youtube and twitch chances are you're watching us on youtube right now uh we do use twitch as more of a backup right so if you go to a twitch data sex devs that's one way you can view us now the key thing to really point out there is that we're watching the chat on youtube and in discord and discord is the link you see there up in the top right hand corner that dt sx dot io discord that'll bring you to our discord channel here's the big difference between the youtube chat and the discord channel the discord channel will persist after the session is over so the session is two hours so we'll be with you in the youtube chat but if you want to follow up after the session or if you've got some questions or you need to share your screen or something discord is totally the place to go we have a huge community of other cassandra users and coders and stuff that are there something like 15 000 now um so join us on the discord channel if you want to continue the conversation and then on the bottom you'll see mendy.com we're going to use that here in a moment so we use menti to ask you a set of questions but then later on we're going to do our swag quiz so you're going to want if you want swag if you want to win some swag you have to compete against everybody that's always fun but then mentee.com is the place to go okay so the tools that we're going to use today i saw some questions coming in earlier about you know what are there prerequisites do i need to install anything no actually you don't need to install anything everything that we're going to do today we provide up in the cloud and using a combination of github gitpod which is uh like vs code in the cloud through github uh and then astrodb for our data layer now we'll explain all of these things and such um you will need a github account uh so if you're if you do have one when we start going through the exercises you want to log in if not you'll want to create one if you're going to follow along the key thing is all the tools we use everything is free right there's nothing here that's going to charge you anything so you should feel safe from that standpoint okay then you know if you're kind of trying to get a gauge of where is the difficulty level of this one right a little bit between low and medium really um the way that we build these workshops they are built to be self-service they are built so you can follow step by step so if you came into this not knowing java spring any of the tools or whatever you should be able to follow the the workshop step by step and be able to do all the things right um now for those of you who are more veterans and if you're experts or whatever you might choose to clone the github repo and run it locally and such like that there might be a bit more of a challenge though and that's really where the get pod piece comes into play because we actually pre-configure a lot for you in git pod so everybody can just start and be on the same page and we have to spend an hour trying to configure everybody's ides uh so we do recommend that you go with us pod um you know and and you know but like i said if you want to run it locally that's that's up to you but generally speaking not terrible difficult kind of like between low and intermediate no because really in two hours uh there is no big time for us to ask you to really code yes the code will be there and we will review the code navigate the code you will have it to run it on your machine afterwards get all the knowledge uh but most of the code is done for you already yes yes all right and then if you want to get yourself some bragging rights and earn yourself a badge whoo badge mad match um here's what you do all right in the workshop repository there is a homework section you just follow the instructions in the homework section because we will be giving you some homework and once you've done that you submit your homework and again the instructions are there uh right there in the workshop repo then you'll earn yourself a batch what's cool about these badges uh is that you can then you get a you get a verified url that's just yours that will uh that you can include in something like linkedin you can put it in your feature section you can include the url and it'll pop that badge in your linkedin things like that right so some bragging rights um we have a bunch of others i want to say we have about a dozen now different workshops that we do um so if you so choose earn your badge and get the bragging rights okay so finally let's go to mendy.com we'll ask you some questions so i'm going to put a screen up here you should see a qr code that you can just scan with your phone on the right hand side or if you go to menti.com and enter in the code you see at the bottom and do me a favor you'll see a little thumbs up right give us the thumbs up let us know that you are with us and let's see yep you see i'm seeing the thumbs up come in already give us more thumbs up because for the amount of folks that we have on here today we have almost 500 of you with us today so we should have a lot more folks than mentee that's for sure yes dropping the link to menci so if this is the first time you attend one of these interactive sessions please open a new tab in your brother enter menti.com and enter the code either on screen also copy in the chat you can also open your mobile phone and scan the qr code to be rooted to the proper quiz in the beginning three four questions with no challenge in the end we go back and we are we do have a contest if you want for fast you get points and the three fastest among you will get some swag for free shipped to their location everywhere in the world all right and i see i see a bunch of code i almost have 200 people in the mentee i'll give it another minute and you know i did see some questions and i think alex is all over them i think i saw you answer some to cedric about what makes cassandra different uh cassandra and astra different from an rgb mess right um and just very quickly i'll say one huge difference is scalability you can scale cassandra indefinitely whether that is a handful of nodes or thousands of nodes two great examples that people are familiar with would be apple and netflix they have cassandra clusters that they use for their core operations handle things like tens of millions in operations a second um using cassandra and that's because that horizontally scales it's extremely robust and resilient you can luge lose not luge that's a new word you can lose uh significant portions of your database and still have an active you know available database um and then it's meant you know it's known for its performance at scale so even if you scale at a thousand nodes you can still maintain extremely tight um either millies or microsecond performance and rights and millies and reads right and so these are kind of like some major major pieces there for to answer that question all right let's see we've got 300 in here i think we're probably pretty good to move on to the questions what do you think cedric uh i think we're good i think we're good anyway we need to move on because we get to have the station recorded in the two hours that's right for some of you it's already late uh so let's keep moving yeah let's do it okay so first one how much experience do you have with spring boot oh cedric we have a good percentage of folks that feel confident with the technology prepare for awesome questions prepare okay so you play the demo and you know i i got the challenged question okay i'm just going to punch all the challenging questions over to cedric you know why do any work why do any work uh sure today it is two hours the session is two hours all right so how much have you used astra or stargate if you've never used it or heard about it that's totally cool you will today oh we have some folks that have already attended welcome back thank you oh wow look at that most of the folks answering have never used them before okay hope you will enjoy the ride okay and when you we can see also that we have people returning so yeah that's awesome so thank you for that we'll hopefully make it better today all right wonderful going on to the next question which apis are you currently developing with and you can pick multiple here you see alex is on the chat oh yeah you cannot miss it right now [Laughter] alex is all over the chat yeah he's the is the bad cup you know right you know you know i love the soap web services help me i'm i still so silk was so good for so long soap was such a good improvement um but you know notice cedric we do have a majority of folks at least compared you know filtering out restful that are still using soap today and that's not allowed i'm not laughing at you by the way i mean more like it's still relevant like people are still totally using it oh yeah of course all right wow a lot of rest folks in here today all right we're gonna we're gonna have some fun we're gonna definitely experiment with that yeah so you will do rest today as well so you know soap that's funny slippery soap web sockets you know we do have web sockets all right cool all right and have you been to any of our workshops before i'd like to think that there's 28 i'm going to say it's 28. okay uh let's say 20. that's fine let's see what happens okay oh wow blue passed okay yeah yeah wow yeah you know between yeah i think we were pretty right you know one quarter a bit less than one quarter yeah and that's cool so for newcomer hope you will enjoy the experience you will see it's all about interactivity as we do right now question quiz and answer that's right all right thank you everybody so much for answering so here's what i want you to do now leave your mentee window open we'll come back to this later for the swag quiz right um but for now we're gonna go over to some of the content and i will pass this over to mr cedric who's gonna start talking to you about all the fun you ready cedric already ready all right let's do it there you go like like like like okay um so i will play in front of you the demo that you will run in a couple of minutes so we will build the stargate i don't know if you know about the tv show i'm pretty fan so we will have a database that will store the planet with the coordinates in the stargate we'll check one of the planets so here i entered chulac hope you want your here as well the video and then you enter the coordinates so epic so opening the vortex and here we go so this is exactly what we will build what you will be using a real database a rest api and a spring boot application okay we could have used you know the pet store or something to deliver fruits but this one is much much uh fun right okay so hope you are exciting let's get rolling back to you david all right so let's see well i guess with that cedric do you want to go right into the hands-on or do you want to do um do you want to talk to some of the slides uh after the demo uh i think we can start by creating the database all right let's go ahead and do it so let me go ahead and grab the screen back boom and let's also drop the workshop repo that we are in so we'll go ahead and something beats me to it but um repo i'm going to put in caps repo and i'm going to spam it there you go uh yeah i do have it as well so let me yeah you i will copy the repo here i also there you go the homeworks so as usual the homeworks are pretty easy you just redo the steps that we do in front of you if you cannot finish on time do a screenshot and share with this okay well the question i see is what is data stacks we'll talk more about that we're actually going to talk you're going to see this more data we're the company so data stacks is the company behind apache cassandra astrodb and some of the things we're going to use today um so we'll we'll talk more about that as we go all right so hopefully for those of you who are going to join us here's the format right i'm just going to step through the repo with you right um and i'm going to go through the steps now i'm not going to be reading all the text and everything we build these to be totally self-service right so if you did this outside the session today totally cool um but i'm going to tell you what section we're in i'm going to kind of walk you through what you need to do and i'm going to do it along with you all right so the first thing we want to do hopefully you're at the repo is go to step one create astrodb instance now if you notice there's this link right here that's astrodatastax.com now none of the markdown doesn't allow us to use a target blank so it's not going to auto launch into a new tab so make sure when you click the links that you're either right clicking say open link a new tab or control click however you want to do it i'm going to control click to open this into a new tab and you'll find that we're going to do this with all of the links that we're going to use today now if you've never used astra db before this is a cassandra as a service in the cloud it's a serverless platform it's fully managed right so if you're familiar with cassandra at all and you're used to working with cassandra databases um this will just allow you to spin one up in a couple minutes if you've never used astrodb before you're going to want to register registration is completely free you can use your github account your google account or you can just put in your own credentials now i'm already myself registered so i'm just going to sign in and tell that to go away here we go do this all right so now if you're brand new if you're registering for the first time you're going to see a screen a little bit different than this one it's going to ask you though it's going to say there should be a button there it says start for free that's what you want you want to start for free right um and then once once you do that you'll come to a screen that looks something like this right the create a database screen this is where you want to get to and notice in the instructions so if i just start stepping down a little bit right in step 1b here we're going to give you the database name and the key space name we want you to use today so all i'm going to do is i'm going to copy these and i'm going to put them in the fields now you might be asking if you're new to cassandra what's a key space right a key space is just the container of tables right so we're saying i want to create a database called workshops and in it i'm going to create a container of my tables per my domain right so the stargate domain for my stargate app probably and this will contain any of the tables we're going to create for our app if you're coming from the relational world a key space is like a database or a schema very similar now once you have filled out the basic details here again using workshops and stargate from the instructions if i scroll down a little bit it'll and you'll notice that there's these nice animated gifs in here you know so if you want to do this later on or something you can always follow along but the next thing i want to do is i want to select a provider in region notice all three major cloud providers are here now what's cool is you can pick any of them it doesn't matter i'll pick google cloud today just pick a region close to you right i'm in the eastern u.s so i will pick virginia and then create database light up and i'll click that now i just want to be really clear that when you um choose any of the providers you don't need to log into them you don't need to have an account with them you are not billed by them nothing right and this is all in the current free plan if you notice up here um this is com you know so anything that we're going to do today is completely free the reason why we give you the multiple cloud providers is so you have choice right that gives you flexibility and choice of what vendor you want to go with um once you've gotten to this point though and you've created the database you should see something that looks like this it might say initializing or pending once you're here give us a thumbs up let us know that your database is being created so we are creating a cassandra database it's a no sql distributed database with multiple node so multiple servers have to be started this is why it will take between one to five minutes uh but you know do not worry we do have time and this is also the reason why we ask you to create the db in the beginning because we can do a bit of slides and when we come back uh the database is ready exactly so with that while everybody is creating their databases uh cedric did you want to go back over to some of the slides uh okay question we start having stamp up i think we are good just uh as we got the question so a key space is the logical group of tables uh like uh schema in oracle if you wish in the single database you can have multiple key space and the recommended practice is to have one key space per application because at the key space level you will decide the role the profile the permissions and also where the data live because data is replicated on multiple server oh by the way um uh uh sherino the link for astra is here in the repo so if you go to step one a right you'll see the link right there in the repo just go ahead and open that one up into a new tab oh yeah we are doing the exercises with you so no magic we as you copy paste the instruction uh to make that super uh easy to follow exactly oh uh ivan garcia when you create the astra db database you are starting with a three node cluster that's where it starts the serverless piece means that it's elastic and it will scale up and scale down with you automatically right and that's to keep your you know cost of ownership low again we're using the free peer the free tier here so you don't need to worry about that but it is a three node cluster to start okay and here uh the database and key space are in step 1b you'll see them here and step 1b workshops in stargate all right cedric go ahead sorry uh no no no i'm i'm okay uh so question regarding spring boot spring data stargate will come in the presentation no need to get the answer right now uh cloud version of cassandra yes so astra is indeed a cloud distribution for astra and it's serverless that means we build this distribution in a way that as soon as you need more power uh the astra platform will add new notes to your cassandra cluster this is how it work i'm sorry a serverless in the cloud mean really uh scaling as you need more or less all right what do you think should you want me to go on to the next one or you want to go ahead and do some slides and get into some of the content uh okay let's let's do a bit of slide i guess all right and all right i'm showing your screen oh you share my screen yes see the fourth wall here unless you want me to just uh uh you want me to go through them and no no you've seen the demo what we asked you today is uh to find the coordinates of planet chulac in the milky way to self tilt from the ground app office so ask her the platform that we have show you in the cloud is the database and stargate you will see is a data gateway on top of cassandra to expose some api so before stargate to use cassandra you would have to to know the cassandra query language and hopefully we will make things easier using the stargate okay the demo we done that so astra platform at the core of the platform uh astro db is apache sonar okay serverless scale as you need and on top of it a data gateway a proxy if you wish exposing apis so restful apis like you all love graphql as well and document oriented apis because by default astro using some column oriented no sql so tables but some of you like mostly use document json like you would do with safety's document retreat document and stargate or also allow you to do so to run the end zone instead of having you installing java maven uh and do an ide we will use gitpod it's an id freeware cloud-based id in the cloud and we will start and build a spring boot application uh using spring data for the data layer and the software development kit but we will again come back to that later okay so we did the step two uh set up our database okay um and you know what i'm thinking yeah i think you can you can move on and you know uh yeah i think everybody's databases should be good to go by now so yes and i will now that you do have the database we can go back to hands-on mode and uh start creating some tables all righty okay so with that most of you if not all of you should notice your workshop's database is in an active state right so what i'm gonna do we're gonna start at step two create table and insert data so we're just gonna go over some basic cql commands and get some of the schema in place some of our data model in place now if you've done things in a relational database before cql is going to feel just like sql right cql is actually a subset of sql the syntax is going to look very similar here so what i want to do is i want to on my active workshops database i'm just going to click on it and that's going to go to the detail view i'm going to see a set tabs up here at the top and i want to go to cql console right now when i load this this will automatically log me in this is what you're seeing here in step 2a right i'm just going to click on that and i should see a prompt that says token at cqlsh now step 2b to be we're just giving you some initial commands right so this describe key spaces um it's just giving you a way to uh describe and look at view all the key spaces you have you see that we have the stargate key space that we created when we started this so now i want to use it i'm just telling i'm just telling cql hey i want to use that particular key space because now i'm going to go ahead and create a table right so i'm going to move to step 2c and by the way um i will you know i will give everybody a moment to catch up and stuff as i go through some of these so uh if you think i'm talking a little fast i will give you a moment to breathe okay so the first thing i want to do here is i'm going to create our stargate chevrons table right so if you remember during the demo when when cedric was clicking on the various chevrons and everything we actually load all the chevrons from the real show into our database and use them in the app again if you take a look at the syntax here you'll see that you know i have a crate table here's the table name a set of some fields uh what their types are what the primary key is so on and so forth so pretty familiar to something like sql now once i have my chevrons table i want to populate it with some data so by the way i don't know if you're noticing it some browsers will have this nice little copy widget so you can just hover over and click if not you'll just copy the whole thing and i'm literally going to paste that right in and then once you've done that you want to go to step 2e and work out we're going to count i should have 39 of these there we go i've got 39. yeah niraj how to create table and insert data so in the repo if you go to step 2c 2c right here you'll see us creating the table literally copy these commands right into the the the the console if the screen is not visible ensure in youtube that your quality setting is set to at least 720p because we are streaming in hd so it should be perfectly clear okay all right so once you've done this and we're down at step 2e we do our account we should have 39 chevrons um and then this next query we just want to filter now you know in the first query we're not filtering anything we're just saying count all the chevrons um in the second one here what we're doing is we say we're saying okay well i want to grab the chevrons that are from the milky way galaxy right and you should see a list like this make sure uh our knob that after your use command that you do have a semicolon um it sounds like if you're seeing an improper use command there there may be um something incorrect in the command itself um so just make sure you definitely have that uh semicolon all right so let me know if you're here um anushka if you're having a hard time pasting the code for some reason like if a control v isn't working you can always just right click and paste right um that might be the way to do it just too fast david you know i tried to enter all the the the answer on text you know not to make you uh blah blah blah no key space have been specified yes so for shady ram you really need to say use space stargate semicolon in a single line yeah here so people name stargate like this use space stargate semicolon just like that all right so give us a thumbs up if you've gotten to a point where you have the initial data set in place for the chevrons and you you know you've performed the query and you've filtered on the milky way galaxy go ahead give us the thumbs up let us know you're here i'll give everybody a moment yes please you went fast on the first range of queries so in the beginning we created a key space so i saw the question twice so a key space is a logical group of tables it's like your schema in oracle so in a key space multiple tables then you use sql console which is this black screen shown by david and we enter some cassandra language command navigate to the key space use stargate and insert create a table and insert values inside that table so as you can see it's pretty close to cql right as of now it's like oh it's really like my sequel of postgre i don't know i do not see any big difference as of now and as of now yeah that's true uh but you know when you design a table in cassandra it should be designed for your queries and when you create a primary key when you execute some commands the primary key must be in the where clause oh i see a question but from yabir how do i see 2d i'm assuming you're asking once i've inserted these how do i then see them how do i list them back out that's actually what we're doing in 2e let me know if i've kind of read your mind correctly but that's exactly what we're doing here all right i am seeing a bunch of thumbs up i did i saw a couple folks weren't exactly sure like where to go so i did pop the um the instructions for step two and that's great because i feel that we are running fast today we are great on time so that's super cool that so many of you are able to keep up again but you know the principle is let's work together there is no point for us to rush super quick uh it will be less interactive so you know we can pose a bit wait for you and if you're already uh at the same uh stuff as us you can keep moving you know we are only step three there are 13 steps uh so you know it should be self service go at your pace exactly and shoddy if you've got 39 rows you're all good to go you're all good yes so there are uh 39 chevrons in the milky way you know i've totally used the wiki of the the stargate tv show i'm kind of a fan so by the way those are the real chevron as you can see uh on screen and see the pictures um and you know if you fan of the tv show or the movie it all started in by a movie i think it was in 1990 1993 um and you know so to to use the stargate you need first to until the code of the earth and then six um six uh chevron to to deal your destination and overall the full code is seven chevrons yeah and just a couple questions i see uh manish how to maximize the console you currently can't funny enough uh we actually do have a request in to our ask for ui team to make that a reality at some point because you're not the first person to ask for that feature um and then nova hey nova crazy is asking hey if i'm following along am i supposed to take the screenshots to submit you don't need to take screenshots of the whole thing as you go through you can literally give us a screenshot at the end and we will know that you got through everything if the app is running yes we know that you have gone through all the steps right so save yourself some trouble right wait till the end just take a screenshot of the running app just like cedric said we'll know you've gone through the steps in order to get there so yeah save your save yourself the trouble okay i feel like what do you think cedric i feel like we can move on to loading the full data set uh i think um yes okay uh suggest what is cql cql is cassandra query language it is subset of sql right that comes from the relational database world that's been around for decades so it is just the query language that we're using here to issue commands against the database now what's cool though is you're going to see later on we're going to use some other apis right cql is not the only way that you can talk to cassandra you can also do it with a rest api you can do it with graphql you can do with the document api so on and so forth so we'll be exploring some of that all right so i'm going to move on now to step three load data set as a csv so we've loaded this initial chevron data set but we want to put a lot more data into the system right so there is another piece of functionality where you can load smaller data sets within about 40 megabytes into the system and that's what we're going to do here now now notice this big green download data set button um what i want you to do on this is right click and say save link as right so i want to save this now you want to save it as a csv so depending on the operating system that you're on you may need to specify this um in my mac i i do so i'm going to say destinations.csv and i'm going to save that and i'm going to replace the one i had and then once i've it should be too big now once i have this file notice up in the top right hand corner of astra there's this load data link here this button i'm going to click on that and it says say hey all right give me something to load so what i want to do is i'm going to grab my destinations.csv i can just drag and drop it over here or if i click on that it'll give me a little file dialog i can just point to the file i you know downloaded something like that but either way it says okay it's got the upload and you'll see that the next button down here will light up yeah lego um lego yeah if it's showing in windows text just change it to all files and dot csv or if you've already downloaded it as text you can just rename it to dot csv yeah either way yeah sure yeah the cql console resets if you go to yes because when you are logged when you're actually in the cql console tab that is actually logging a session right there you know it's and such when you navigate away from that you're you're losing that so when you when you go back into it it's going to re-log you in if you don't like that one thing you can do is just open that in another tab right you can just open another tab and keep it open if you want okay so once you get this next button you've pulled your file in i want to go ahead and click on that now what this is going to do is going to give you a preview of the data from the csv file so what i want to notice or i want you to notice is notice here i've got a whole set of columns up in the top you know the galaxy the name different chevrons and everything like that um and then like i said it'll give you a preview of the data and this is just to kind of you know while you're setting some of the fields and the options that are here you you can you can actually see the csv that you're working with so i'm going to scroll down here to step 3d i want to define the target table now it's already chosen one for you um so it is already chosen the destinations table which is correct that was defined itself uh you know via the csv so that's that is the table we want we want to create a new table called destinations that's where we want that to go and then you'll see in the bottom here there are some drop downs the first one is our partition key now something to really kind of just explain for a moment in cassandra right um cassandra in cassandra the base unit of access is something called a partition this is by the way how even if you have a cassandra database that is a thousand nodes large how access times can be very very very small because these partitions are literally the physical address of where your data is is going to live right um so what's happening here is when we select and we're going to then the option that we want to select here is galaxy so we're saying we want to partition by galaxy in our data set which means that all of the rows that are stored in the same galaxy in this case milky way they'll actually be stored in a partition called you know milky way so later on when i go to like query from that or something if you notice in the query that we accessed up here this one right like this when i do something like this if i'm partitioning um by uh in this case galaxy and let's say that i then in my where clause i say where galaxy equals milky way i'll actually be able to get directly to the address of where that partition lives very very fast this is just something this is just a mechanism that cassandra uses to kind of handle the distribution of your data around your cluster it's not something you have to actively worry about more what are you partitioning by right um so for this just choose galaxy right that's the only thing we're gonna have here and then clustering columns are a way to either define sorting or uniqueness so we're saying here then i want to go ahead and sort by name right once i've done those two things and again this is the in the instruction itself once i've done these two things i've galaxies my partition key name is my clustering column i have my next button i want to hit next okay all right now this next exception section section there we go i got that word out right um step three e i'm just gonna choose okay so what is the target database well we created our workshop database earlier and then what's the target key space well in this case we've only got one the stargate one these are the if you remember when we created the database in the key space these are the same values we started with right so we're putting our destinations table in the stargate key space right within our workshops database once i've chosen my key space i should have my next button and then i will click that now you'll get a message right you're going to say hey data's being imported now what this does is actually batches it up in the background right it's not going to do it actively here in the front the foreground it's going to batch it up in the background you should get a message like you saw on my screen and an email right it's going to say hey i've got your request we're going to batch up your data and we're going to send it in and then it will let you know once it's done and you know everything that we have done so far you know there is nothing related to spring or java or anything you know um but we like to start by explaining and you know setting the the scene having the database ready to to rock and then we move to code that's right that's right all righty let's see i guess do i want to wait for my email or let's see shouldn't take too long um why why this operation is asynchronous you know all these bug loading operations are put in a queue and uh we have dedicated workers to load the data like that and it's you know in a way way easier than using cassandra language because you just provide the raw data as a csv file and you're good to go that's right all right so i have my email that says that the job has started it shouldn't take too too long for that to come into play um while i'm waiting for that what i'm going to do is i'm going to go back over to the cql console right so if you remember this tab over here i'll click on that and was pointed out before it's going to relog me in and i don't have my data just yet i don't think oh i do actually okay i did i already got it so so my data has been loaded in right here we go let's go there we go right so you can see um that now my stargate.destinations table is populated with a lot more data now we're saying limit 10 we're only showing 10 of them there's a lot more than that in the data set all right let us know once you've gotten here as a matter of fact actually we can create the astro token while we're waiting for this yeah why don't we just move on so if you've gotten to the point where you have loaded your data set in the background fine let it do its thing right i'm gonna move on to step four here where we're gonna create our token now the token is important why because you know astrodb is a cloud-based service and that means that there is an endpoint that is exposed publicly um out so you can access it through your applications and such clearly that needs to be secure right you can't just you don't have your production database just wide open to everybody and that's where the token comes into play so here's what we want to do up on the top left hand corner there is this organization drop down you see a little drop down i'm going to click this and i want to go to organization settings now in this particular case what i want you to do is again either right click and say open link a new tab or i'm gonna you know middle click or whatever i want you to open this into a new tab and here's why we're gonna come back to this you're gonna need this when we are setting up the properties in our application okay so just put it in a new tab i'll then navigate to token management and i want to select the role database administrator once i've chosen a role you'll see generate token lights up i'll click that and look at this boom i have my my credentials now key key thing here you see this download token details button make sure to download your token details you will only be shown this screen once but this is part of by the way why i put this in another tab why i suggested to do that because later on when we're putting stuff in code i'm going to just pull them from here right if you don't want to do it that way totally up to you just make sure you download those details so you do have them to use later but once you've gotten here give us a thumbs up because at this point we're good to move on to some of the content um but we want to make sure that you've gotten here with us okay i see a thumbs up coming in nice awesome all right we're not we're not going onto step five i'm just kind of scrolling up uh database administrator lego yeah that's the role you want for this one now while we're while we're talking about that by the way um we're doing that for ease in your real applications you probably don't want to expose database administrator um maybe something like a read write user or read-only you know depending on what you're doing um you know so so you might want to take a little bit more look at those um in the documentation to kind of see what fits but for now database administrator is totally cool cool i'm seeing lots of thumbs up come in that's great congratulation now by the way i just want to point out right at this point you have a fully baked astrodb database built on apache cassandra three node cluster and you have your token you know your authorization token you actually have everything you need right now to hook up an app and start moving that's what we're gonna do next right um so so you're you're good to go at this point from the database standpoint all right so while those are coming in cedric do you want to move over to the next set of uh content yes i think and uh if people are a bit late they can keep doing the steps and that's right no i will talk a little bit about uh and you know in five ten minutes we will come back to enzo again we like the session to be dynamic and uh with bringing a lot of energy so let's move on yeah and and nur um i do see your comment there if if i'm going too fast yell at me you can totally yell at me um and i will i will slow down but that's why we're trying to give you a moment to kind of like catch up and everything plus you can always go back this is self-service right you can you can always kind of go back and and replay if you need to exactly screen at david in the chat and i will screen at david for yes yes please by all means you can yell at me i'm watching all right yeah okay we're not gonna open git pod just yet we're gonna actually move over to cedric's screen so we can talk a little bit more yeah buddy it's coming it's coming pretty soon don't worry another theory again all right cedric you ready i am i you know tell me when i have my screen share oh you're totally alive you're so live okay i'm so live i'm so lucky i'm happy let's move on okay so uh just a little bit of work regarding uh spring the spring framework which is probably the most known framework in the java community right now spring is everywhere i had the chance to use and to to learn about spring 15 years ago it was not called the spring at that time it was still called interface 21 uh yes i'm pretty old uh but at the at the core of the framework and what make the framework super successful upfront was too paranoid so first it brings some lightweight stuff uh you know challenging the big old application server like ibm web sphere stuff like that you can do the same without any application server and you took control of the full stack okay it was super good i know it might it might sound weird that now spring at that time was considered as lightweight because now any spring boot app you start is like a 50 megabyte but yeah this is how it was so that first the first uh principle second is uh what is called the inversion of control when you code you will define only the interface in a java interface so here on screen is greeting service with a single method called say hello then you implement that uh interface in another class so say hello here is one of the of the the super basic implementation but you call you can and you will have multiple implementation for the same service so you might ask why would you do that well the first use case at that time was to uh was to do some mocking you know i provide you the the interface of the service you will have to use later and i also provide you a mock that will always answer the same response the same data but at least you know what the output look like and you can start working so it it's you know in a sentence it introduced loose coupling between the service definition and the service implementation and really it was key so and starting with that it was found on every single layer the api layer controller i'd lose coupling with the service layer loose coupling with the dao so technical layer to interact with data and so forth and so on so super flexible components working as layers but right now spring is huge i have dozens and dozens of module so you use the module that you need for your needs you can see that you can do micro services this is what we will do uh today reactive so we do have session here on the channel using spring mic flux and all the reactive stack you can do spring cloud web apps serverless even driven batch and even many many more like spring spring cloud data flow and uh on a lot of stuff today we will use the micro service stack leading by spring boot so spring boot really is the run time of your application uh i mean it's it's really providing a working application out of the box you just create a new spring boot application and it just run out of the box okay under the hood is using an application server like tomcat okay there is no magic but all the details are hidden to you what you will start is really a main and because each application each component each micro service does have its own runtime it's super easy to scale just pop up this instance and now you know everybody everything's work on docker so when you need to scale out an application you want to keep popping new docker containers and having everything in a spring boot is pretty easy to deploy on a docker container and quite lightweight you do not pay for the big um av application server stack you are using really the the thin layer like nati or autumn cat the spring application is done in front multiple layers so persistence layer their repository then business layer what we call service or component and presentation layer spring can do everything you can expose presentation just as a rest api or a view controller and create some full stack application with views and the framework to do the view part in spring is really spring mvc alongside with something called time leaf or a free marker but as of today the app is using time leaf but you don't have to code for that we will mostly focus on how to retrieve data from the database and show that on the ui so it's simplify your build configuration and then i think the the key reason of the success of spring boot is what we call the starters you know you you do have your java project using your dependency with maven so your pum.xml or gradle and you know oh i need some monitoring well in your prom in your palm just add a starter to enable monitoring i need some you know gms okay enable the starters you have gms i need to invoke some http endpoint okay use the rest uh the rest template spring web and there are the full galaxy of starters to to do a numerous kind of use cases and guess what at the very end today you will use the spring boot astra starters because hey why not okay um in spring which per stack so we will use the regular stack so uh spring data to access the data spring mvc to expose some rest and a web view i drop the spring security just to have everything free uh and simple for us in the two hours we are using the servlet uh so easy but you should always know that uh there is a reactive stack but if you put a finger in the reactive stack everything should be reactive because so the the controller using webflux the spring data repository spring data reactive because if you introduce some code that is blocking on the contrary of reactive the application won't even start uh spring will tell you hey i've seen that yeah you do have this lock somewhere so i cannot guarantee that your app will run as you expect okay so with that let's look at this spring boot app so now you know we do have cassandra running in astra to integrate with cassandra we everybody use the drivers okay datastax is famous uh to provide the open source drivers for cassandra that also work with astra obviously okay and spring data reuse the drivers of data stacks so that that's quite important to understand that spring data is an abstraction layer providing use providing you always the same interfaces remember in version of control so you will create classes name repository and then automatically or super quickly you will have all the function all the method like find by id find all save by id delete search and you don't have to know the sql code because it's done for you but under the hood spring data is using the drivers and then the dl is injected in the service layer even if i don't think we do have a service layer service layer will be there you will do some aggregation and composition for data coming from multiple sources but in this application we are only using astra so maybe i even skip the service layer and finally the exposition layer you will see two two two end points one is rest it's a good way to see how do you how can you do a restful service with spring boot and the spring mvc so the web view that you have just seen in the demo okay this is the drivers that doing quite a lot for you you do have the slide in the repo i don't like to read slice it's doing a lot okay yeah and i just dropped the slide deck to ruben um in the repo yeah okay all right um but here so the stargate demo that we will start on git pod in a moment is a spring boot app using spring data so remember spring data starter and it will be even spring data cassandra starter and it will create you the bin you need to work with cassandra in spring but again no magic it's reusing the java driver so it's your choice to go to the java driver route or to use spring data uh to ease a little bit uh things um and speed up and we will use gitbot for that and i think i i oh i've i've been speaking for 10 minutes already that's too much for hands-on workshops hands-on go back with david and let's start this application for god's sake alrighty so let's do it popping back over so we should at this point if you are following along be at step five launch gitpod so hopefully at this point you've created the database the key space you've inserted uh you created a table inserted some data you've done you know the the background batch and we're all set from the data standpoint now as cedric just said we want to launch github we want to launch our ide and get going with some of the code so at step five launch gitpod what i want to point out is this big opening gitpod button again i'm going to middle click right click you know open a new tab however you want to do that now here's the key thing for this button to do to work properly you're going to want to be in chrome or firefox it uses this refer link kind of capability that gitpod has and it will automatically start initializing your content if you get an error or something that says i'm trying to refer not found it tells me you're probably in an unsupported browser now you can make that work and all but um uh but there is a there's a special way that you need to do it um you actually have to go and matter of fact i can explain it if we run into that i guess i can explain how to do it real fast for those who maybe have an unsupported browser so if you go to say let me just grab this real fast there we go i went to i went to i hit the wrong key uh there we go okay i'm not even sure that we put from riff here from rivera here yeah we do oh that's right it might work for everybody because we don't need to use that from referral you're right cedric so nobody ignore what i just said nobody needs to worry about it all right so you know i mean i forgot i'm just yeah i'm using i'm using brave as well and cedric is right i forgot we're not using from referrer here it should just open up and you should see something that looks like this yeah no big deal should work for everybody now uh i share the link of the git pod uh here in the chat um you know when we do have issue with brave is when you need to clone that repo first on your copy and then start git pod because now git body is a bit lost it doesn't know if you need to load your copy or the original repo but here there is no clone you will only edit stuff in git pod and no need to fork okay alrighty yeah that's right uh vikram if you're still creating it's step five that's fine gitpod might take a moment to launch because what we're doing with github this is actually really really cool um there's a there's a git pod yaml in here um but it's actually we're going to pre-load a bunch of your libraries and extensions all sorts of fun stuff right um so where you want to get those you see this build success right so you'll see it it actually went through and installed stuff and then it builds that's where we want to get a matter of fact we explain it right here it's already doing a maven clean install and such like that for you and let us know when you've gotten to this point right yeah i can make it bigger yeah i can it just you know it's funny if i make it bigger it it starts to get really funny on my screen um but i can hopefully this is a little easier to read like this but you should see where it's already done the maven clean install and then we can move on to step six oh aj if it's asking to log in it's because in order to use gitpod you do need to log into github right so this is where i mentioned earlier that if you don't need a if you don't have a github account you will need one again the registration is completely free and all that should just take a moment but you will need to log in to use gitpod and uh why do you need some git account this is when you come come back later to gitpod.io you can retrieve your uh your workspace it's probably snapshot and somewhere and you can start again where you left so not only it's a 100 percent valuable free cloud-based id but it can also save your state and you know can you can even share your state of your id with others uh we love gitbo that that sucks you know you should all know that that's right now i do see a question here um i for the life of me i'm trying to figure out how to say this handle it looks like absorbent i'm not sure but it says the question is what exactly was built in the background when we are starting the skip pod so what's really cool here is i mean this is this is a java app that is powered by maven and spring right so if you take a look at the pom if you're familiar with maven if you look at the palm xml you'll see in here all of these dependencies and such like that when we run the maven clean install that's the part and that's being run automatically that's part of what gitpod is doing here for us you can see it's actually going and it's installing all the libraries and everything like that we're going to need for the app so if you're looking for if you want the details and what was actually done that's where you take a look at that git pod yaml you can see exactly what it's doing and everything so if you're again if you're familiar with like maven or something like that that should look pretty familiar to you okay so i did see a couple thumbs up um again let us know if you've got this loaded and then i'm gonna move on to step six here know your git pod um so when you're using git pod if notice notice this url i have right this is generated for me right this is my own unique instance that's up on the cloud but from an application standpoint right this part isn't that useful yet because when i go to run this thing i probably need to access it like port 8080 or something that's pretty standard but since i'm not in my local development i'm not just going to be going to local host right that is where this gp url so this is this is part of the cli and git pod so i'm saying git pods url 8080. so when i put this into my terminal and by the way the first time you try to input a copy command it's going to say hey will you allow this i'm going to say yes and it's going to give you this endpoint right so this is they'll actually generate an endpoint it's going to open a port and generate an endpoint here for you notice that my port is part of the endpoint this is what i'm going to use to access my application later okay so this just something to keep an eye on okay so first thing i want to do is step 6b so now we're going to use maven um to build the project and everything now funny enough i'm pretty sure cedric you already did this in the git pod but i guess we'll do it again just to make sure that we have all the things so again it's going to it's going to use our palm xml and yes i've used something called a pre-built to download stuff to make as fast as possible for you ah proven yes if your test in eight are failing because you're ahead of us you may not have filled out um your application uh props and stuff like that so we'll get there all right so we're just gonna go through okay that should have hopefully been a success right um again at this point we haven't done anything with the database just yet hopefully you see that we'll move on to step seven here now this is an important step you want to get this right now this goes back if you remember when i said when we created our token and i said leave this screen up in another tab this is why i was making this easy um if you downloaded uh your token credentials and stuff in a file this is where you're going to want to pull that up right so what we want to do here is we want to go to our application yaml right so again this is in the repo i'm just going to step through it so if i go to source main resources i'm going to double click an application yellow i pretty much want to scroll almost all the way to the bottom the the properties we're looking for at the very bottom from line 38 on and the aster section notice these credentials notice how i've got i've got these sections here right i need to replace that with the various values so where are these coming from okay so the client id if you remember over here we have our token and look ah i have a client id i'm just going to copy it there's a little copy widget right there i'm going to come over i'm going to replace the whole thing and paste that in now for the client secret same thing i'm going to come over to the secret copy it over and replace you know the less than greater than symbols all of that the whole thing it and it does it looks like just a big long crazy alternative stream because that's what it is and then the last one the token now key thing about the token is yes it does include this aster cs colon that is part of it absolutely right so i want to pull all of those values okay now the next three here for cloud region and database id i should say really cloud region and database id now there's a a set of different ways i can get this data one if i come back to my detail view if remember i was at my cql console before for my workshops database if i go to the connect tab you see that right here next to it i click on connect the default with document api is fine you'll notice it actually gives you the values right here this is one way you can do it so the region i just want to pull that out i'm going to copy it and i'm going to paste that in here now that region by the way that was created when we created the database remember you picked a provider into region right that's where that came from so we're just literally pulling them out and then the the next one here is going to be my database id this is a unique identifier for my database now it's important because we want the application to talk just to that one database now at this point if you've gotten here and you've filled all of these out you're good to move on again yeah proven you can always generate another token that's totally cool right yes yes you can always generate another token and you beer yeah if you want me to do it again i'm happy to do it i'll just do it one more time so again if you notice i went to source main resources that's where my application yaml is i just double click that to open it here and if you scroll down to the bottom of your application yaml steps 38 on or rows 38 on that's the section we want to update you'll see those fields we want to change all right hold on i've got a i've got a dog who is uh seems like yeah you get a guest you have a guest right i haven't i have a guest i have a guest [Laughter] usually he wants in today he apparently wanted out it's live okay yeah there you go okay let's see oh why do we need to provide we need yeah in the props um it's a distributed database and the same database will and can live in multiple region so on in each region you do have some endpoints so to build the url to contact the database you need both the database and the database region that's right yes so github autosave it's enabled by default i think i'll enable that um yeah it's really for documents and anything related to rest of graphical api to connect to cql what you will have to provide is login client id password client secret and a zip file but hey we are using some some magic that do we that do it it's all for you and absorbent database id is the cluster id from the home page yeah they're the same they're the same thing um not just yet lego you can't put in multiple regions just yet just one yeah okay all right and by the way you know and just to clarify i think cedric was just mentioning this a moment ago depending on the api you're using you may need a subset of all of these but because this application is exposing and using multiple apis that's why we're actually filling out you know all of them essentially okay so if you've gotten to the point where you've updated your application yaml and you've got all your settings in place we want to then go to step 8 run some unit tests because this is now going to test that very connectivity right it's going to ensure that this all works so i'm going to go to step 8a we're going to start with the cql session now just whoops well don't do what i did and paste that into your application yellow because that's not gonna work i guess my cursor was in a different spot yes so um i see a is level of questions so can you rewind let's say five minutes can can you um just show in astra uh how you created the token and where did you find the origin please absolutely let's do it okay so going back to ask her for a moment okay and the database id so first yeah okay so on the top left hand side in your astra dashboard you should see this organization tab so if i click on the drop down here say organization settings now my suggestion to you is i'm right clicking and saying open the link a new tab it just makes it easier later on when you want to get the values out from here once i've gone again to organization settings i want to go to token management click on token management you'll see this drop down for the role choose database administrator and say generate token once i do that i'll get my tokens leave this up right leave this up this if you notice that's where the client id client secret and the token are coming from that we used here at lines 41 through 43. and again it's always a good idea to download your token details because once you navigate away from this page you will not be able to see those again that is for security reasons it's the same thing for the major cloud providers and everybody does on this one now i think the second question was where are you getting the database id or the cluster id there's a couple different ways to do it um one if if i were to back in my regular dashboard and i saw this screen right notice right here for my my actual database here's the database id with a little copy widget so that's one way to get it another way i could get it if i go into the the detail view i'll see this cluster id it's the same exact thing i could get it there here you have the crystal id and the regen yes that's right yeah that is one way i could use this screen to get both the region and the cluster id i could totally do that another way to do it if i go to the connect tab up here and then any of these apis they'll give me they'll give me all the values right so i have the database id and the region and stuff so there's a bunch of different ways you can get those hopefully that cleared it up for you now he wants back in that's funny all right so hopefully hopefully um yeah you should not have any compilation error you know yeah yeah if you get an error let us know what the error is because i i have a hunch let me try something i have a hunch if i invalidate one of my keys like uh do i need the application do i need the token for the cql for a cql session or is that just i think it's client id and client secret isn't it yes okay i'll invalidate one of those then yeah that's right because that's for the other api just looking for for yeah i see all your question so get keys and define get name isn't defined so that mean uh lombok did not generate the setters and ghettos and sellers so but you know it should be did they run the maven install the clean install i mean that should have been done but just to make sure it's it's in the instruction but let me uh okay i do want to point something out i invalidated my client secret on purpose right so if like you fat finger something here if this isn't right then look at what happens so ensure that your keys are all correct when you were running the tests because that might be the reason why some of you were getting an error yeah just make sure you've got that full thing in there yes so really really compilation error are weird because we did not change any piece of code uh try a full rebuild and i give you the comments so maven clean package install dash maven test kit true you should not need my advantage keep screw true if you provide the proper tokens but you know we never know and yoshi if you change the key space name when you were creating it in astra you're going to get an invalid key space error because the application if you notice is expecting stargate right that's why we ask you to use the key space value in the very beginning because all the rest of the stuff is based off of that so if you used a different key space you will need to update the configuration and stuff to use that new key space or just go and create a new database with that name okay you change it in the application yeah cedric are there any other is it is it just the application ammo for the key space name are there other areas that may be looking good that's that's really just the application yaml um but you know if you got some computation error yeah try to do a full rebuild i i put you there the commands [Music] seems like vinesh validated that some for somebody the lombok not doing his job okay so now people seems to say yeah so they need i say yeah yeah yeah do some clean builds okay good it looks like the maven clean pack that looks like that did it for a lot cool yep all right good so what's interesting about that is that git pod does run that at the beginning but um i guess i guess it needed extra cleaning it was dirty it felt dirty okay so hopefully i saw a lot of folks saying that they got through step a so then the next thing we want to test is spring data with 8b right so we're going to run the next test for that one all right and so this is really just validating that the values that we put in for the various properties here are correct right and we should hopefully see a bunch of green you rock so on and so forth i don't think snare all right and then hopefully if you saw that worked out free we want to go to this last one under step 8 b all right to just find some coordinates again just doing some initial tests cool chandra thank you yeah thanks for letting us know and step seven is done woohoo good job hey so some folks are step nine already whoa yeah and hershey what's the command not found in gitpod which commander you're running that's interesting okay um command not found yeah that's weird um so the command i've used with maven first clean so clean is meaning completely remove the the previous build in the the folder target then i did a package why package because most of the time the longboard framework the one that will generate get and set is attached to the package uh to the package uh phase in maven and finally install maybe it's uh overkill it's just saving all the the jar the libraries that you have just built in target into your local maven repository and finally the latest piece dash d my event test.skip is to say hey when you build do not try to run the unit test again the unit test should be okay uh as long as you provide the proper uh values in application dot yaml but hey here we were not sure so i i just add do not run the test uh anyway the end of point seven is to run those tests all right so map vendors yeah okay okay so that's okay and matthew phillip the commands that i'm using are here in the repo um so the ones that we just went through were at step eight i'll go ahead and give you that link it'll be it'll be easier than us trying to type them all because they're all right there in the repo for you okay let me do this all right so i saw a bunch of people got with us through the uh through the steps i saw interesting lee uh hershey was saying that the maiden command was saying it wasn't found so i'm curious to see what a maven dash v does uh because if for some reason that's not there i wonder if gitpod just did something interesting because maven should totally be there oh uh gordon moore says where does the getpod project know the connection details for astra that's what we're doing in our application yemo in the java project itself this is where the the connection details are right that's exactly what's going on when we tell it the token when we give it the region the database id and stuff now that's the authentication piece if you're asking well how does it know where to connect i wonder if that's the case um you know cedric where are you are you using any of the secure connect bundle are you just going through the apis uh no no no we are using the cloud secure bundle but download it for you under the yeah yeah so so um uh gordon moore we're what's happening here is that there is the astra sdk right uh that matter of fact cedric wrote the astro sdk is responsible for allowing you to connect through all the various apis and such like that there is and i'll show you i'll just show this to you so that way it's not so abstract so if i go back to astra and in my database i go to connect tab here let's say i'm in java which we are i click on java notice the secure bundle here what is this about so this is something we're doing for you automatically behind the scenes with the astra sdk when you provide the values that we're putting in our application yml but what it's doing it's actually using the backend dev apps api and it's downloading this bundle for you if you were to explode that bundle or untired or whatever in it you would find all of the connection values for the endpoint it's talking to for your database um the ssl tls information stuff like that all your all your keys and everything are there right but instead of and if anyone here has ever done ssl in java it's so fun um instead of having you have to figure all that out it's essentially encapsulated in the secure connect bundle and the sdk automatically downloads that for you so by providing these values the sdk is just getting for you and it's already including it in part of your application so you don't need to worry about it so if you're curious where did how did it know what to connect to that's where it is it's in the connect bundle but we did that for you so you didn't have to um i did see another question that i want to uh okay awesome gordon thank you i did see another question about the the apis yes uh this application along with the sdk are in fact exposing the document rest and graphql apis and these again if you go back to astra in that connect tab notice there's document api graph and rest each one of these actually has an endpoint that you can use um that is being exposed specifically for your instance your database right and that's what you see these are all being exposed in each case i mean this is just a swagger api um but that is part of what astrodb is doing for you this is actually that part that cedric was talking about called stargate stargate adds these apis as a matter of fact if any of you are open source cassandra users you could also use stargate it's completely open source right you can tag it onto your cluster and you can expose these same apis but this is part of what astrodb is is giving you right out of the box um so yes through the app we're exposing all of those and that's what the sdk is telling us here all right i'm just how are we doing a question cedric i'm just trying to see i see a couple of folks um sadesha is looking for the commands for the clean build so one place you can find them some dish in your project if you go to the git pod yellow you'll see it at the root if i open that up notice right here this the command that you need is right there so it is it is there in the git pod yemo or you could just do a maven you can see this maven clean package install right all right so i'm trying to just get a gauge if i want to move on because running the application is part of the fun yeah nitin if you're if your application's not running you try to go to 8080 it's it's just not it's not going to be open and exposed so we'll do that here next all right so hopefully at this point you're able to get through your tests right let's go ahead and move on to run the application so i'm going to go to step 9 run the application first thing here is going to be our this is a spring boot app so you'll see this maven spring boot run um what's going on direct issues uh but yeah some some folks start saying that the demo is cool so i love it uh so okay so looking somebody is stuck at eight eight a so let me eight eight a so many steps in this end zone eight a okay so it's it's okay it's really the first test so maybe you have a compilation error so you know let's try to execute the command i i give before maven clean package instead we'll do the job all right let's see all right so so if you're with me in step nine while cedric is supporting some folks in the chat and everything like that hopefully you've done the maven spring boot run you should see something that looks like this right then what we want to do is we're going to issue us some other commands but we want to leave the application running so we want to open up a new terminal now there's a couple different ways you could do this one though you'll notice this little widget right there right looks like a window right split terminal click that it'll give you a new terminal that's i think the quickest way really to do it you can also go up to the hamburger menu in the top left hand corner and go to terminal new terminal either way right either way it's fine now this command this gpr gpurl8080 what it's saying is gitpod url8080 if you remember before i said that gitpod is generating an endpoint for you to use for your app a specific port well the application's running at 8080 right so we're telling it hey give generate me a url endpoint 8080. you'll see a link like this i'm going to grab this i'm going to put it in a new tab and if everything is working i should see yes i should see my stargate right so i can i've got my started stargate demo application here we go i've got my stargate i'm going to blow this up a little bit like that right now with this i can choose a destination maybe chillock and then click my shop what's the destination right and there we go yeah hopefully that's not too loud yeah i'll repeat it [Music] oh that's really coming through oh i gotta turn that down that's really loud [Music] there we go all right we've gone to chulock okay okay let's run the app yeah that's loud isn't it yeah sorry about that here let's let me turn that off whoa that was loud sorry about that everyone it was a little a little too loud maybe [Laughter] all right all right so hopefully you know the the the front end is just kind of a fun thing on what the back end is really doing but notice i had to click all the chevrons i choose a destination and then you essentially go there right um so let's see yeah exactly uh exactly with the the volume slider or something like that yeah make sure make sure whoops make sure that you just don't click the destination you got to click the chevrons too you got to tell the chevron triangle yes you see them lighting up the wheel so yeah click the triangle and then start rotating right i'm going to click all of them you can light them all up yeah sharing exactly i'm going to watch the stargate series after all this right and then once you do that you will teleport to your destination which is isn't that cool isn't that cool right now the cool thing is in order for this to work though in order for you to get to this point where this is working all of the backend apis and the database configuration and stuff that all has to be correct this means you have a working app and that you are connected and functioning and this section here in um 9 is really just turning on the chevrons and everything all right all right give us a thumbs up if you let us to let us know you're here i will say this though if if you're struggling a little bit with eight nine if you were getting some compile errors you're working through that you may want to come back to it later and follow us in step 10 anyway because you should be able to do this with us because now um now we'll get into um like kind of using some of the api and stuff like you know especially from the rest api yeah i see lots of thumbs up and to the um uh tibia check uh you need the certificate yes so once you finish if you have the working app at the very bottom of the repo there is a homework section just follow the instructions and submit your stuff and and you can get the badge that way okay if you're getting hardship if you're getting uh port 8080 not found right that tells me maybe the app is not running make sure to run that gpl gpurl command after that so you can get your endpoint right that tells me the app that's the magic moment where everybody just seeing the spinning that's the best moment all right so i'm going to move on to step 10 just to make sure i want to make sure we have enough time to get through our swag quiz and everything um so this is really cool this next one is 10a we're going to use swagger here we're going to use it locally um this is another reason why we opened up another terminal here so i'm going to copy this command to oh do the open swagger dot shell that says yes keeping we're skipping a bit of slides on purpose uh so now uh until now we were only using uh the the core cassandra and the drivers and spring data okay so you can navigate the code and you will see some repository and you will see just spring data code now in the end we will switch not using spring but showing you how to use the apis that's right all right so i'm going to go ahead and pop this in to my terminal notice that it launches a swagger api in the simple browser now here's the thing you can do it in here that's fine um but i think it's a better experience if you put this in a new tab so if you notice the little widget the open browser one here on the very very top right of the simple browser just click that and that'll launch this nice swagger interface right into my full tab much much more readable this way and then we're just going to now swagger what this does this is expo this exposes all the rest endpoints now i mentioned before that with astrodb you get stargate.io which essentially um extends cassandra to allow things like a rest api graphql documentdb grpc stuff like that right out of the box right swagger exposes all of those rest endpoints so it's a really nice especially when you're developing and you're trying to figure out well what rest endpoint do i need for this or that or how do i use it that's where swagger comes into play right um so we're just gonna experiment with swagger a little bit so if you can follow me to 10b right now notice a couple things here because there's a lot of endpoints right be like oh how do i find which one he's looking at notice we tell you in block data and what the end point is so now by the way trick if i click on those uh the the the blocks it'll automatically collapse them so ah here's data right and then i'm looking for retrieve all rows and specifically yeah v1 so retrieve all rows this is this top one now in order for me to do anything this will give me like kind of it'll give me the structure of what's needed but in order to do anything i need to click this try it out button and the first thing i need to fill in is that token i need to authenticate so remember before i said hey we're going to need to authenticate right keep this up that's why i'm saying that so i'm going to take my token the one with the astra cs i'm going to put that in this token field and i have to hit the right key for that to work there we go now the rest of the values are given to you see the key space name is stargate so i'm just going to literally cut and paste these in page slides oh yeah those don't worry about uh did the api update a little bit no no there it is yeah i somehow i went blind okay and chevrons there we go i missed table name even though it was right in front of me so notice i've got my key stargate and chevrons once i've done this i'm going to say execute what's cool about this is i'm actually using this endpoint here right i'm using the endpoint here where i'm going to retrieve all rows from a particular key space and a table and ah these should look familiar right here's the 39 chevrons we inserted inserted originally and what's also really cool about the swagger piece is that it shows you all the different types of responses you could have these are not the responses you're seeing these are the responses you have so if you notice i got a code 200 which says i'm okay right they're just telling me i'm okay but if i would have seen like a 400 or 401 right that that'll tell you that they just give you all the codes that you could possibly have all right great so we retrieved all the tables wonderful we can look at another example now that by the way if you notice here that was just using let's see if i scroll up here for you that is just using the base rest api now there's a document api that is in stargate as well and that is also exposed via rest so if i go to the document section again this is going to be step 11. so now i'm going to open up and look at the document api so what's really cool here is i can actually use swagger i can even use rest to create and interact with documents separate from the document api there's multiple ways i could do this right so i'm going to the documents section i'm looking for create a new document notice v2 i want the v2 create a new document so i want to say greet here we go v2 create a new document again i want to say try it out again i'm going to put in my token right i want that handy and the other fields are given to me so the namespace stargate and the collection id sample doc now the body you see this default string make sure we replace the whole thing we're giving you the json so in this case you know if you're not familiar with documents they're json blobs really so this is just json what's really cool about the document api is you can work with native json objects you don't need to marshal on marshall or do anything with them you just work with them natively and you will create that and this is actually when you do this this will automatically be stored in an optimized format in the database for you it allows you to retrieve it the search by it all sorts of things and if you're successful right okay you see a code 201 created here's my 201 and here's my document id so it successfully created that document and and so this is just an example by the way of being able to use the rest api to create a json document a native json document all right cedric how are we doing before i go on to the next thing um how are we doing is there anything pressing we need to answer or whatever uh i do have questions ongoing some some issue i try to resolve this is why i'm quiet but you know so far so good super interesting question uh we had some folks asking how do i create the schema if i already have the java code and say i wasn't showing that spring data allow you to generate a schema based on on your bins on your code uh but you know it's not really recommended with cassandra you really want to start with your schema because tables are really based on the queries you would like to do so to to build a custom application that really hey list all the queries i need based on that create the tables and only then create the object otherwise you will try to use the same object for multiple queries and it will be slow yeah and alan parson uh did i say that right patterson sorry allen allen patterson asked an excellent question why do i need to provide the client id client seeker and application token when the applicant in the application yaml but only the application token when using the rest api that's a really good observation here's here's what's going on in the case that we're using the rest api you're correct all i need here is the token but in our application we provided all of the values because the application through the sdk actually uses all of the apis it's using if you noticed there's rest there's graphql there's cql all of them that's why we needed to provide all of these values where in the case of the rest api all we actually need is the token so it's just because that the application has more capability that's that's all that really means it's just exposed to more than one api okay manu asks what is the exact use of stargate what we're doing do you mean the application itself or the stargate apis because what we're doing right now with the rest api uh json documents things like that that's actually enabled through stargate if you're asking about the stargate app itself this demo app that we're running i mean cedric might have more to say about this but it's it's really an example app that shows you ways to use the different apis that are available to you for cassandra and ask for to be i don't know if there's more you want to say to that cedric uh yeah that's indeed that that's really just to show you what it can do so um i've not shown the slide to go fast but stargate is a proxy on top of cassandra this proxy exposing some apis so it's cool because now you can scale only the compute layer you can as add as many stargate instances as you wish without having to scale the data nodes so that's first point then now it's a rest api so you as a client you can use a stateless component now because previously with the drivers you are stateful you need to have a connection with all the nodes in your database so it's easier uh for java folks um we love drivers but i think the api is you know why not for front-end it's all about the apis that's right yeah yeah and i i can definitely say from a development standpoint um you know if you're doing if you're doing like prototyping a greenfield project or something like that the apis make it extremely easy to just get going right you can even argue i know in the java world we don't really talk about storing documents so much compared to what we might in the front end full stack world with like javascript or something um but the document api requires no schema right you can just talk to it over library and start using json objects so again from a prototype standpoint it's wonderful to just get going um and at some point if you then kind of you know you can't expand past the apis if you want it's all there all right yes um yeah stargate provides the api access to the astrodb piece or cassandra i want to be very clear about that because sand open source cassandra actually any of the flavors of cassandra you can use stargate with to expose these apis rest document graphql grpc i think is happening or coming soon in kafka stuff like that so yeah stargate is that api proxy layer all right so let's go um michelle depends um on the schema if it's v1 or v2 depending on the command he does put them in here no it's probably all v2 because the uh the the first one here is v1 the list all the tables was v1 yeah oh okay okay oh my god we should send that we probably should yeah astra is developed by datastax yes astrodb is all data stacks okay so i want to make sure we get through the rest of the stuff so going to step 12 the walkthrough of the sdk right um so we've kind of hinted that there's this aster sdk that's doing a lot of fun work for you so i'm going to just take a look at this real fast so if we go back to our app and if you look at the palm xml right um in here this is from maven for those of you familiar with that you're going to see though this astra spring boot starter right um so i want to say there it is there it is so you can see this is included so you get a lot of really cool functionality with this if you notice in 12a i'm going to kill my app actually there we go okay um so if i run 12a here i'm gonna go and do a test for the the astra sdk and what's again what's really neat about this i love the fact that it you know it shows you very clearly um all of the main apis that they're enabled that they're working you get the end points right there and everything like that um so if you're you know if you're trying to figure out say how to work with um any of the apis sdk is a really nice way to start because it's doing it all for you right in this particular case the end result should be to list out all the databases that you have and their information so we're actually able to use what's called the devops api and the back end through the sdk that will expose all sorts of cool information as a matter of fact you can use that to create databases you can create key spaces and all sorts of objects and everything right there with it so you can essentially do a lot of this through the back end all right and then another couple examples so you notice in this section how we're using the rest api and then we'll use the document api right so these are just examples so these tests are really good to just take a look at and run um if you want to see examples and how to do these things all right see in this example here this is using rest and you can see in this case now uses the rest api to do this um now the test itself really is obviously isn't going to show you the code but you can just go to one of these tests right so if you go into your main java app into tests you'll see these tests are exactly what we're talking about here's the rest api one so you can start to see okay how might i go about doing this right so they're really nice way to kind of just start uh to figure out how to use the apis and the last one here at 12c is the document api this also validates that your app is working your configuration is there all that kind of deal uh yeah oh you almost done and that's good because we will eat the 10 minute alarm that's right yeah that's right we got to get our swag quiz going so in this last case here again this exposes in this test against the document api and you can see some of the information that is spit out from that again if you want to take a look at the implementation how that's being done what's really neat here by the way i just want to point out you know again i realize that a lot of folks in the java world you know document database stuff is usually in more javascript but look how easy this is right you define a namespace you define your collection and you can just start putting together documents um this is so simple and you know if i really wanted to i could go back over to astra and start taking a look at this i mean i guess i guess i could couldn't i go to the cql console and and take a look now interestingly enough if you view documents like um oh no it's stargate we're using stargate tables there we go here we go right so if i say now admittedly if i look at a document through cql um it may not look all that clean just because this has been essentially kind of like cut up into a format that is useful for documents and storing json blobs it could be anything right it could be nested objects all sorts of things um but that is part of what stargate is doing it's actually automatically handling that for you converting that into something that cassandra understands and it's data modeling and stuff so the point being you don't have to do this right all you need to do is uh interact directly with a document in its subfields and all that kind of deal but you can see that it is in fact creating the stuff in it and it's doing that through all these but yet here all i need to do is you know use my name space or my key space if you will create a collection and start start storing stuff right so again it gives you a nice example of a way that i could do that right out of java yeah yeah tyrone the getpod stuff is fun yeah because it does allow you to kind of pre-load a lot of stuff and then you can use that as kind of like a base all right so with that cedric what do you think do you think we should move over to do our swag quiz or do you want to go do we have some more content we need to go through baby take a deep breath breath okay we can post it when he's going to let people just finish the last all right we'll let them get through i mean uh yeah um so quiz giveaways and goodbye we i think we can make it all in 10 minutes so yeah so hey look at that we wait one minute and we do have some thumb up so i think now we can move to the game all right let's move over to the game all righty let's let's do it all right um yes so during the time uh david is moving to menti so the homework we will explain in the very end but that's really just redo the steps we did today and that's really mostly starting the app do a screenshot upload the screenshot for us to know that you make it and i copy the link of the homework in the chat right now all right and again for those doing the swag quiz with us you should already hopefully be in menti give us a thumbs up let us know you're there use the qr code or the minty code if you need to i'll give everyone a moment to get back in okay let's see how we're doing all right i see a good amount of folks getting in i'll give everybody just another moment and you know something let's let's change this to something fun how about this all right let's play some games now when you're doing the mentee in the quiz speed matters speed and correctness so ensure that you're looking at your phone for the questions because there might be a little video lag and you don't want to be watching the video and then get behind and lose some points all right all right so i'll go to the next screen here this would be the part where you get to put in your name i'll give everybody a moment to do this all right wow we got a good amount of we have almost 200 folks in the game with us that's awesome all right let's do it first question again answer fast to get more points which is not a part of the spring ecosystem boot springfields spring web or spring data which is not a part of the spring ecosystem all right let's see what happens the correct answer here was spring fields that always reminds me of and i hear you laughing be behind your keyboard springfield is not yet uh spring framework yeah but everything else is essentially all right let's talk about spring boots spring web and spring data all right let's see what our leaderboard looks like now by the way this is anybody's game with these um there's a thousand you get a thousand points each potentially so maverick is our top speed in first place ronnie number two tyrone number three let's see what happens with our next question yeah and i'm a bit afraid oh what is the name of the uh tilak planet ebedos atlantis was anyone who was paying attention to this one right i mean it was part of the demo you know it was it wasn't to be all technical um but you know the the version of the drivers to use maybe would be a bit harder all right the correct answer was chalak now if you got this wrong chulane was so close tricky right if you got this wrong don't worry about it just just go on to the next questions because hopefully uh one of the people you're competing with fail yeah yeah yeah all right let's see what happened to our leaderboard oh so andrey takes the lead with the fastest time ronnie is number two and dude is due to save due to sabi i i see some familiar names here right yeah second place okay andrey was the fastest okay hey sabi do to say bye all right maybe tell me how to pronounce that one in the chat all right so let's see question three get some disco right what does sdk mean software development kit serve developer knowledge server direction kubernetes save to queen [Laughter] only a non-native could come up with that right right oh by the way don't put the answer in the chat put them in menti yes the correct answer almost everybody got that great is a software development kit that's awesome it's like a a catch-up question right all right let's see what our leaderboard looks like oh we had two oh what wow the three top people got the exact same time that's amazing i've never seen that happen so um we have dudes abby atul and surresh all right let's see what happens in our next question 407 what is astra another ketchup question right all right it is a local in-memory version of cassandra it is managed cassandra with api and tools it is a cloud-based ide or it's a movie with leonardo dicaprio get some laughs out of that one oh i've got the pronunciation it's duda sabi due to savvy got it all right all right yes it is a managed cassandra with api and toodles it is not just a local in memory version you are when you spun up your astra db you actually got a fully feature database which is based on a cassandra like a three-node cassandra cluster and everything like that um it is not a cloud-based ide that is gitpod so astrodb is an actual full clustered database for you all right let's see what happened to our leaderboard in this case alright so dude sabi is in lead mohammed is in second half j takes the third spot and question five we're almost there we have a couple left oh in the spring data cassandra 3x using the dataset's java driver yes version 3x no yes version 4x or only when there is no other solution this may not be a fair question cedric what do you think it's tricky because you know i i told you about spring data cast on r3 and uh we did not cover a lot of versions of spring that uh java drivers it was a driver slide when i moved fast so if you have time to read um let's see so we got 32 folks got that one right this was a tricky one this was a tricky one yeah yeah it was a tricky one it was you know it's it was kind of a trap yeah yeah this is using the 4x datasex driver driver though which is good because the version 4 driver is the latest one that you need that supports all the latest stuff in cassandra 4 was just released a couple uh three weeks ago a month ago or something like that um so and this this the version 4 driver supports all the cassandra 4 stuff so that's important yes so we had a super easy question and super hard questions right yeah this one goes all over the place it's just like you're like man i'm doing great oh oh and look what happened to our leaderboard all right so we said it was anyone's game we weren't kidding so justly takes the lead yeah that give a chance to when you won really you know yeah the lesson was number two and heartache and number three sorry cedric go ahead okay what were you gonna say i did i cut you off there i'm sorry i just just said no no then the the last question would be is you okay yeah yeah it is a little easier all right going on we got two more two more let's see what happens all right which feature is introduced by the document api in stargate schemeless serverless paper shredding or paymentless that's funny [Music] oh tricky tricky yes it's schemeless serverless is actually introduced by astrodb itself it gives you a fully serverless database where the document api and stargate is what enables the schemas capabilities with json objects all right so let's see what happened to our leaderboard that time okay so lush maintains the lead rakesh in second and radha and third i see some play though down the bottom we have one more question let's see what happens last one all right how many symbols are needed to dial a destination with a stargate this one i studied loud i said it loud yeah you did say multiple times so six chevrons total five chevrons plus the origin six chevrons plus the origin or eighty dollars are you thinking at the question when i say loud e.t dial et phone home god who remembers that movie from their childhood oh yeah it's six chevrons plus the origin origin oh let's see what happened to our leaderboard this one always shreds the leaderboard oh oh so nalesh takes the lead raha keeps second and shrini with those fast times popped it up in the third so nalesh radha shrini congratulations take a screenshot of this on your phone right now because you are going to need that to submit over to jack.fryer davidstax.com we'll show you that as well um to get your swag right so take a screenshot right now so you can get your prizes all right and with that i'll move this over um let's see cedric was there anything else you want to talk to before we uh kind of close out or you want to just go ahead and no i think we are good we're just on time uh now it's not just about uh reminder about the homework uh get a voucher to have the certification and please subscribe to the channel if you enjoy the content that's right so it for the badge for the homework so for those of you who want that badge down at the very bottom a matter of fact if you take a look at the repo you'll see at the very bottom section 13 homeworks really you don't need to make screenshots of the whole thing just do a screenshot at the end save yourself some work um but notice section two notice these links here right uh so there is something to do here uh at step two and then you just click the link to submit your homework and step three okay and that will give you uh what you need for the workshop itself or for the badge then for being here is a thank you you scan that qr code or we'll drop it as well you get yourself a voucher for two free attempts for either cassandra certification or kate sandra certification which is running cassandra and kubernetes and that whole ecosystem to do that that those are 145 bucks a piece right so that isn't small potatoes um definitely take advantage of that and there are multiple learning pads that are all for free by the way all of our learning and training is free in academy.datastacks.com and these learning paths will give you all the information you need to get those certifications as cedric mentioned essentially a second ago we have weekly workshops right go to our youtube channel subscribe ring the bell you'll get notifications um for each of the workshops and you'll see what's coming up and if you haven't already go to our discord channel and join because that's where we can follow on the conversation and again thank you so much with that i think we can say uh see you at the next one uh they need the code oh we haven't given him the code yet oh all right let's no let's go back faster with the qr code all right let me oh let me put it back i'll put it back i'm so sorry here you go no that code yeah the voucher code there we go about to go there you go yes thank you david thank you thank you so um the voucher is great but it has no value if you did not really took the time to do the is it's free okay those courses are free academy it's multiple hours of video you will understand why the partition key and the primary key and why you write where clause wherever you like it's free uh stuff and certified professional get good job in the customer around that's right absolutely yeah these are worth it these are totally worth it all right well hopefully everyone has that code and i saw i saw alex spam in the link like crazy so awesome all righty all righty and with that everyone thank you so much for joining us today yeah and now we're done all right see ya yeah totally uh strong profiles today i hope you enjoyed and you will come back next week and i think next week yeah we are i don't know data modeling next week i'm not sure i'm not sure go to all right thank you everybody see ya and as always don't forget to click that subscribe button and ring that bell to get notifications for all of our future upcoming workshops imagine a being gifted with powers from the goddess of cassandra who grew those powers until she could multiply it will move with limitless speed and unmask hidden knowledge with those powers she was able to fully understand the connectedness of the world what she saw was a world in need of understanding from that day forward she sought to bestow her powers on all who came into contact with her empowering them to achieve wondrous
Info
Channel: DataStax Developers
Views: 4,040
Rating: 4.9423075 out of 5
Keywords:
Id: yIQK6pbmTdo
Channel Id: undefined
Length: 129min 17sec (7757 seconds)
Published: Wed Sep 01 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.