Integrating ScyllaDB with Quarkus

João Martins20 minutes

Quarkus and ScyllaDB are a perfect combination for cloud native applications. The main idea of the session is to show the way to integrate both technologies. The session will be presented with slides, but there is code as well, where will be possible to develop the application from the beginning until local test.

Share this

Video Slides

Video Transcript

Today we’ll talk about integration integrating cldb with kwakus. My name is João Martins and I am a software engineer at iFood. I work in another company called Allure where I record videos about Java Courtney. I have eight years experience with Java language and three years experience with Cosmic language.

I like to to write in my personal blog in a platform College dead dot two so I recommend the the lecture of my my post because I I write about everything in about technology okay so our schedule I will show you the situation that I need to to solve yeah and what is because uh is that the technology that I I use uh why still a DB and I will show you a code with both Technologies integrated okay so situation uh I need assisting that receives many Kafka message and need to save their own database yeah so my requirements the application needs to be fast the application needs of good integration with Kafka in database because I need to focus in my business rule is not in my Integrations in codes with a facilityb or post or anyway I I my focus is in my business role and the application needs to be right already for cloud okay so with these requirements I decided to use and what is box it’s important to say that all the next informations about kwakus I got in my own website so if you have interest in know more about the technology I recommend so what happens is a Super Sonic and Super Atomic Java and I can use this for the form with many animated Java Java libraries okay the disease are kubernetes Tech fields for open Decay hotspot and grow VM crafted from the best of great Java libraries instant okay so if you know Java if you know kotlin you can use um

is fast so that there is in my screen ah a print of the two applications with just a endpoint rest and uh endpoint endpoint race Plus credit when where we can see that just rest uh we have uh with grow VM I started less than one second in milliseconds it’s so fast yeah and when I use uh open jdk or if uh jit compiled it I have a startup and uh response time less than one second another traditional cloud in HV Stacks we have four seconds or more so it’s a big difference yeah and with has blood squared we have uh two seconds when we work with jit compiler and another traditional Cloud native Stacks we have almost 10 seconds big difference a huge difference yeah [Music]

ready for cloud so it’s about as a new platform and is prepared to to the cloud you can use in on-premes environments but it’s it’s better to use for cloud yeah because there are many libraries that you can use in your application that is a good integration with kubernetes for instance okay okay and now why clcb so DB is architected for data intensive application yeah and we have high performance and low latings yeah and I consider both Technologies the perfect match to our economy okay so now I will show you the codes that we integrate both techno I will show you some dependence that we need to use to solve our problem okay so to to send message to the uh to the top key and receive message from the topic we need to put uh isma all right reactive message Kafka okay is a a dependence of the Quakers we can see in Rook ID that help us to to work with Kafka so we’ll see that is is easy to choose these the beans okay the the both dependencies and quants art and quarks J units five is the full of all applications of our quads applications so for Earth in that moment is not uh interesting we not used in our uh example okay but here we have another uh the pin is that we need to use for solve our requirements okay so I need to save uh data on ScyllaDBs so I need to put a silo driving on our phone XML okay and here if you see I I I’m using the optimized ScyllaDB driving car ScyllaDB that is the the the better way to work with Java applications and sealer okay I need to put another uh seal the pin is that is ScyllaDB head writing driver mapping yeah to transform my uh sealer object to my application object okay that you will see that is mutant dominion and mutant objects it’s it’s nice and here we need more both dependencies that is rest easy and quarkus rice is Jason B because we have a end point that we can call and see the payload in the in postma bosma or browser so okay now we need to to configure our application to to know uh the topic that will send the message the talk that will receive the message configure contract point of seal and so on so in my application profit I have some configurations okay and I have two first configurations that is from Kafka okay so I need to declare uh my thought key yeah because I I my application will send message to the topic and we receive to the talk so I need to configure that and here you will see that I have two top Keys two configurations with the the same topic and the difference is uh when I use incoming in outside going and mutants in mutants out okay mutants in mutants out is my channel is where IO send my message or receive my message and we share the the same topic and it’s more clear when I show it show you the steps that work with G with both configurations okay but now uh you’ll imagine that I have two channels that one receive message and another sent message and both share the the same the same talk okay and incoming antibody is just a connector that we will see in the next class uh mutant sets okay I need to to declare a Kafka bootstrap service servers and when I I uh I want to use my local Kafka in my machine okay because if I don’t put this configuration Kafka offer for us adapt Services future for classical okay where automatically

and configure the application to USB so if I don’t have Kafka in my local machine a kafka’s offer me uh akaska nice yeah so I don’t need to install in my local machine but I have and I use okay and here I I have two um configurations that is the contract Point local voice yeah ScyllaDB is on my local machine and cluster name okay here in mutant cells is where the magic key happens okay because I have two methods one method if you see have Auto going annotation yeah the connector and the name of the channel mutants out okay and another method that has uh income annotation that has mutants in Channel as parameter so what is meaning when I will start my application uh this method will send a message to the topic and how I know about that because I configure how to going in my application profits okay that is the the configuration that means that the message will send to the topic so because of that I need two channels because I have uh I have a method that sent message to to our talk and I have another method that receive a message for the top and save on 7db okay so here I have a method that each second will send this message so uh of each each second I will send the message and I need to wrap this message in a haircut object okay and because Kafka don’t know about mutant so I wrap in a record and send to the castle when uh Kafka received the the message and I will I will receive in my uh sales method okay because of income uh annotation and I will save uh on co-db so the transformation of uh Kafka message to the mutant object is is done for uh by Jackson’s arise okay and here uh as I said is where the magic happens so it’s second we send the message and we receive the message and save on sale ADB okay we have the mutant repository where the where the the OE configure everything about cldb okay so queries uh the coffee configuration of the of cluster so here I have a Constructor that receives a seal across the config that is the class that has uh the the build of the closed off closet okay so here I I inject the config property that I put it on my application profit so ScyllaDB contract points included because the name if I need to change this property I just need to to change on application profits okay and here and in our cluster config is just inject this this property okay so I build my cluster and in mutant repository when they they call mutant expository I I got closer and connect to my mutants and key space okay and here I have a session where where I can interact with slsb so when I need to save a mutant yeah I have a prepared statement uh where I will reset a mutant with values that I received from my Costco broken yeah and I just execute these these query and I will show you the the data on seriesb okay now uh we can see the application working for that I will open my internet terminal okay and I I use maybe compile quartz Dev comment okay when I I start the the application [Music] will up all the the resource that you uh we need and we will see the data is saving in on the the on ScyllaDB okay so we’ll prepare uh resources okay

and if I I change to my CL DB I have uh as a mutant named yeah my my table is Inked and now when uh the application finished to restart uh we will see the data is same okay

is a good option because when you work in developing mode if I change something in my code I just call uh again my application and Quackles have compiled the application and I don’t I I don’t need to to down and up again the application so because of that is a good option to use the okay

so here my application is up okay

okay now uh they they are send message to my my database so if I I do and select close is grow up mutant okay and we’ll see that is fast so everything that I I do a new select Clause uh there are many many rows okay so is that is the for me is the perfect match to to work with uh with this type this type of environment uh with this type of business so uh what’s that that I I want to show you okay and I appreciate for your attention and thank you for the the moment okay bye bye [Applause] foreign

Read More