Capgemini Java Interview | Core Java, Spring Boot and Microservices — Transcript
Full transcript
- 0:03Hello. How are you?
- 0:05>> Hello. I'm fine, thank you. How are you?
- 0:08>> I'm good, thank you. So, can you tell me
- 0:11a little about your role and
- 0:13responsibilities in your project and
- 0:15your tech stack on which you are working
- 0:17on?
- 0:18>> Uh, yes. So I have around uh four years
- 0:21of experience working in IT industry and
- 0:23I've worked across various domains uh
- 0:26starting from banking, insurance uh then
- 0:28uh telecom, healthcare. So in this four
- 0:31years uh I've learned a lot about um
- 0:34Java, Spring Boot, microservices and uh
- 0:37my current roles and responsibilities uh
- 0:39is to add new use cases to the
- 0:42application. Uh try to resolve bugs if
- 0:45any and try to improve the performance
- 0:47of the application and uh our
- 0:50application text tag consists of uh
- 0:52Java. We are using Java 17 uh then
- 0:55spring boot. uh we are designing our
- 0:57applications in uh springboard and we
- 0:59are using microservices architecture and
- 1:02finally to deploy the application we are
- 1:04using um AWS uh specifically EC2 then
- 1:08for object-oriented storage S3 and the
- 1:10database that we are using is MySQL so
- 1:14that is a brief introduction about uh
- 1:16the project text stack
- 1:19>> okay so do you have hands-on experience
- 1:21on Java features or Java 8 features
- 1:25>> uh yes yes I have hands-on experience on
- 1:28these features.
- 1:29>> Okay.
- 1:30Okay. So, do you know what is
- 1:33immutability in Java?
- 1:36>> Uh yes, I know about uh immutability.
- 1:38So, uh immutability is where once you
- 1:41create the object, you cannot change
- 1:43that object. Uh the state of the object
- 1:45cannot be changed. So, that is uh
- 1:47immutable object and string is an
- 1:49example of immutable object. But uh we
- 1:51can also write our custom uh immutable
- 1:54classes.
- 1:58>> Okay. Now can you write some code which
- 2:01can demonstrate
- 2:02this use case? Let us consider I have to
- 2:05create a class uh which will be
- 2:07immutable. So you can create a class and
- 2:09tell me how can I make it immutable.
- 2:12>> Uh great. Okay. So there are a few cases
- 2:15uh there are few rules for creating
- 2:17immutable classes. So let's try to
- 2:19understand that the first thing is I'm
- 2:22going to uh create a class and the class
- 2:24name is going to be a uh student. Okay.
- 2:27So this is my class. I want to make this
- 2:29object of this class immutable. The
- 2:32first thing is I'll make this final. So
- 2:34this will prevent the subclassing. So I
- 2:37cannot uh I cannot subass this. I cannot
- 2:39create the child classes. So that is the
- 2:42first rule. The second rule is um I'm
- 2:44going to mark all the fields as private
- 2:47and final. So let's uh try to create
- 2:50private string uh name. So first thing
- 2:54is name. So private and final, right? Uh
- 2:58the second thing is I'm going to do
- 3:00private final again uh integer role
- 3:04number. Okay. And uh these are the two
- 3:07two fields uh private final string. And
- 3:10the third thing is I'm going to do is uh
- 3:13I'm going to add one subject list. So
- 3:16let's try to do private final uh list of
- 3:21string and I'm going to give the name as
- 3:25subjects. So private final is done. The
- 3:28third is uh I want I'm going to uh do
- 3:31the initialization only through the
- 3:33constructor. So let's try to create a
- 3:36constructor out of this. uh right click
- 3:39uh
- 3:40right click generate constructor I'm
- 3:43going to create all the fields right so
- 3:46this is how I'm going to initialize
- 3:48these uh fields so initialization is
- 3:51only possible through uh constructor I'm
- 3:55going to provide the getters for this
- 3:57but I'm not going to provide the setters
- 3:59so once the object is created I'm not
- 4:02going to change the value through
- 4:03setters so whatever fields whatever
- 4:06values you have to provide you have to
- 4:07provide only through uh the constructor.
- 4:10So let's provide the getters but not
- 4:11setters. Okay. So right click uh
- 4:15generate
- 4:17generate and I want to provide only
- 4:19getters. Okay. So I'm going to provide
- 4:21getters for all of this.
- 4:23Okay. Uh right. But uh I provided
- 4:27getters. I did not provide setter. But
- 4:29uh for uh for fields like list okay we
- 4:34are not going to directly pro send back
- 4:36the list itself. What we are going to do
- 4:38we are going to do the uh defensive copy
- 4:41of this and then send it back. So let's
- 4:43try to send it
- 4:45uh collections. Uh there is something
- 4:47called as unmodifiable list and to this
- 4:50unmodifiable list I'm going to pass our
- 4:53uh subject list. Okay. So
- 4:58subjects.
- 5:00Okay. So this is how I am going to
- 5:02return the unmodifiable list and not the
- 5:04actual list. So this subject cannot be
- 5:07changed by the uh client. So just to
- 5:09summarize uh the what are the rules. So
- 5:11the first rule is mark the classes final
- 5:13which we have already marked. Then to
- 5:16mark the fields as private and final
- 5:19which we have marked. Uh we are
- 5:20providing only getters. So no one can
- 5:23set the value. And we are uh
- 5:25initializing the values only using the
- 5:27constructor. Uh so we have done that.
- 5:29And uh the final thing is whenever there
- 5:32there is uh a list date so these kind of
- 5:35object copy of those object should be
- 5:37made and then returned back to the
- 5:39client. So this is how I'm going to
- 5:41create an immutable class in uh Java.
- 5:46>> Okay. Great. Now uh do one thing. take a
- 5:49list of numbers and try to find out the
- 5:52second largest number from that list.
- 5:54You have to use stream APIs from J.
- 5:58>> Okay. So I have to take a a list of
- 6:00number and uh then try to find the
- 6:03second highest from that uh list. Okay.
- 6:06>> Correct.
- 6:06>> So let me create a class uh second
- 6:11highest number and specifically I have
- 6:14to use the uh stream API, right?
- 6:18Yes, correct.
- 6:19>> Yeah. So, uh let's try to create a list
- 6:22of uh integer. Okay. I'm going to call
- 6:25this as numbers. Uh let me import the
- 6:29list. Importing is very important.
- 6:31Numbers equal to new sorry I'm going to
- 6:34uh initialize in one line only. So
- 6:36arrays dot um as list and uh I'm going
- 6:40to provide uh the values 10 20 uh 35
- 6:46then 35 then 50 then 40 some values.
- 6:50Okay, this is my list and the goal is to
- 6:53find the uh second highest uh number
- 6:55from this using stream API. So let's try
- 6:57to find this. So the first thing is uh
- 7:00numbers dot stream. Okay, once I get the
- 7:04stream, uh the first thing I'm going to
- 7:06do is uh there are repeated numbers 35
- 7:08and 35. So let's try to remove the uh
- 7:12repeated numbers
- 7:15dot distinct. The distinct will remove
- 7:17the uh duplicate numbers. Then as I have
- 7:20to find the second highest then I'm
- 7:23going to sort this in the descending
- 7:25order. So let's try to use sorted. uh
- 7:28and how do we want to sort this from uh
- 7:32from the largest number to the smallest
- 7:35number. So we are going to use
- 7:37comparator
- 7:39uh dot reverse order. Okay. So this will
- 7:43sort uh my list into descending order.
- 7:46And once I sort the list into the
- 7:48descending order, I'm going to skip the
- 7:50first element because I want to find the
- 7:52second highest number. So let's uh skip
- 7:55the first element. Okay, skip one and
- 8:00after skipping the uh first element,
- 8:03whatever is remaining from that list, I
- 8:06want to find the first element. So, how
- 8:07to how to find the first element? Find
- 8:11first. Okay. And if there is uh nothing
- 8:14in the list, then we are going to uh
- 8:17return null. Okay. So, let me try to
- 8:20explain the logic. First, we extracted
- 8:22the stream. Then, we uh did the distinct
- 8:25on it. So we remove the duplicate once.
- 8:28Then we sorted the list in the reverse
- 8:31order. That means our list will be
- 8:32sorted from highest element to the
- 8:35lowest element. Okay. And after sorting,
- 8:38we are skipping the first element
- 8:41because we want to find the second
- 8:42highest number. Okay. And then whatever
- 8:45is remaining from that list, we are
- 8:47trying to find the first element. Okay.
- 8:50Using find first. So let's try to take
- 8:53this into integer.
- 8:55uh second highest
- 8:59number
- 9:00equal to this right and I'm going to do
- 9:04uh system dot out dot print uh ln okay
- 9:13and the number itself the second highest
- 9:15uh number uh let me try to run this if
- 9:18I'm able to run this
- 9:24okay it's building
- 9:32H. So the second hash number is 40. If
- 9:35you see 10, 20, 30, 35, uh, 50 and 40.
- 9:39So 40 is the second highest. So this is
- 9:41how I'm going to find the second hash
- 9:43number.
- 9:45>> No. Okay, great. Uh, can you tell me
- 9:48what is functional interace in Java?
- 9:52>> Uh, yeah. So functional interface uh is
- 9:54an interface where we have only one
- 9:57method defined one abstract method
- 9:59defined and we annotate uh this uh
- 10:02interface with addit functional
- 10:03interface annotation. So if we have more
- 10:06than one abstract method then that is
- 10:09not a functional interface. So
- 10:11functional interface has only one and
- 10:12one abstract method uh which class can
- 10:14implement.
- 10:17>> Okay. Can you create one function
- 10:18interface and show me how to create a
- 10:21function interface? Yeah. So let me try
- 10:24to create a functional interface. I'm
- 10:26going to uh name this as um I print
- 10:32tableable. Okay. And uh
- 10:36uh public void print. Uh it's not
- 10:40necessary to add public but uh still I'm
- 10:43going to do public void print and I can
- 10:46annotate this with functional interface.
- 10:49Okay. So this is a functional interface.
- 10:50Now let's try to do one more thing.
- 10:52Let's try to I'll try to add one more
- 10:55method
- 10:57I printable and uh is printable.
- 11:03Okay, you see uh it's giving me an error
- 11:05because I can have only one abstract
- 11:07method. So if I remove this that error
- 11:10will be gone. So this is how I'm going
- 11:11to create a functional interface.
- 11:15>> Okay. So can I write static and default
- 11:18methods inside this interface? Uh yeah
- 11:21so writing default method and static
- 11:23method is possible in uh functional
- 11:25interfaces. The default methods are when
- 11:28um there are multiple classes
- 11:29implementing this interface and you want
- 11:31to introduce a method but you don't want
- 11:33to break the existing implementation of
- 11:36the classes. So that is where you write
- 11:38default methods and you can have a
- 11:41method bodies for default method and
- 11:43static method in the interface.
- 11:49Okay, great. Uh, how about Spring Boot?
- 11:53How much you are comfortable? If I ask
- 11:54you to rate ourself out of five, what
- 11:56would be your rating?
- 11:57>> Uh, yeah. So, I can give uh around four
- 12:00for spring boot.
- 12:02>> Okay. So, let us consider I have to
- 12:06create application employee management
- 12:08system where I have to perform four
- 12:11operations basically create, read,
- 12:13update and delete CL operations. Okay.
- 12:15So you have to tell me all the steps
- 12:17which will be required to perform these
- 12:19operations. You have to explain all the
- 12:21packages, all the layers, how you are
- 12:23going to connect with the database, what
- 12:25are the dependencies which will be
- 12:26required, how you are going to create
- 12:28the project, all the things which will
- 12:29be required to perform these four
- 12:31operations. Instead of four operations,
- 12:32you can take one operation but I need uh
- 12:34end to end flow. Can you explain me?
- 12:37>> Uh yeah. So uh I'm going to explain you.
- 12:40Uh the first thing is I'm going to
- 12:43create I'm going to go to spring.io. IO
- 12:45and uh try to create a spring boot
- 12:47project. Okay. And um uh I I'm going to
- 12:51download that and import it to my uh
- 12:53Eclipse or any ID IntelliJ Eclipse or
- 12:56any ID you want. So after that uh import
- 13:00I'm going to write the first layer that
- 13:02we have is a controller layer. So
- 13:04controller layer is essential for REST
- 13:07API and I'm going to annotate that uh
- 13:10controller layer with at the rest
- 13:12controller annotation. So this is where
- 13:14I can write methods which client can
- 13:16call from outside as a rest API. So I'm
- 13:19going to write four methods. One for um
- 13:22get, one for post, one for uh update and
- 13:25one for delete. So for get I'm going to
- 13:28use get mapping. For uh adding a new
- 13:31thing or for creating an entity I'm
- 13:32going to use post mapping. For updating
- 13:35an entity I'm going to use put mapping.
- 13:37And for deleting I'm going to use delete
- 13:39mapping. So this is my controller layer.
- 13:42And from this controller layer we
- 13:44generally call a service layer. So this
- 13:46service layer has all the business logic
- 13:49which we want to execute on that
- 13:51request. So service layer will uh
- 13:53include all the business logic or the
- 13:56business rules that we want to
- 13:57implement. And this service layer is uh
- 13:59annotated with additate uh service
- 14:02annotation. Okay. And from once you
- 14:05write all the business logic and uh you
- 14:07want to save something into the database
- 14:09then from service layer you call the
- 14:12repository layer. Okay. And this
- 14:13repository layer we specifically use JPA
- 14:16repository. Okay. So this JPA repository
- 14:19we call it from the service layer and it
- 14:21has all the operation for saving for
- 14:24updating and fetching the entity. Okay.
- 14:27And this JPA represent uh repository
- 14:29works on underlying entity. So what is
- 14:32the entity? For every table in your uh
- 14:35uh database in your database there is
- 14:38corresponding entity and we create a
- 14:41class with the fields for example
- 14:43student entity. So we have role number
- 14:45we have name we have uh class and we
- 14:49annotate this uh student entity with
- 14:52adderate entity annotation. Once we do
- 14:56all this, we also create a table in the
- 14:58database or we set a flag uh hbm to DDL
- 15:04or update. So what what that will do
- 15:07when you run the application uh that
- 15:09will create the table automatically if
- 15:11it does not exist in your uh database.
- 15:13So that is about the flow. But there is
- 15:15one more important thing uh in the if
- 15:18you want to connect to the database then
- 15:19you want to include u the JPA uh starter
- 15:25uh uh the J the JPA starter um
- 15:29what do we say starter uh package in
- 15:33your pom.xml. So that will bring all the
- 15:36uh required entities or all the required
- 15:38jars in your application and then we
- 15:40have to include the driver. So whatever
- 15:42database we are connecting to, we are
- 15:44connecting to MySQL database. So we need
- 15:46MySQL driver in your um application and
- 15:50after that we have to create
- 15:51application.properties
- 15:52and we have to give the location or the
- 15:54URL of the database, the username by
- 15:57which we are going to connect and the
- 15:59password. Okay. So this is how uh the
- 16:02flow is designed for CR application.
- 16:06>> Okay. Can you tell me the annotations
- 16:09which will be required for
- 16:11implementation of this uh student
- 16:14management system or employee management
- 16:16system?
- 16:17>> Okay. So annotations you want
- 16:19annotations.
- 16:21>> Uh yes annotations basic annotations
- 16:24which will be required for implementing
- 16:25this flow.
- 16:26>> Okay. So the first annotation is uh add
- 16:28the rate uh rest controller for writing
- 16:31my controllers. Okay. Then I need add
- 16:34the rate uh service add the rate
- 16:36repository for writing my repositories.
- 16:38Add the rate spring boot application for
- 16:41my main uh main class. Add the rate
- 16:43entity for my uh entities. Add the
- 16:46generated value for my uh primary keys.
- 16:50Okay. And if I'm creating some custom
- 16:52beans then add the red bean uh for that
- 16:55or at the method level. And uh if I'm
- 16:57creating a generic component then add
- 16:59the red uh component. Okay. So this and
- 17:02then a few more annotations um enable
- 17:05discovery client if I'm creating uh
- 17:08discovery server and so on and so forth.
- 17:10So these are a few annotations that I've
- 17:12used.
- 17:13>> Okay. Do you know add direct auto direct
- 17:17request body annotation?
- 17:18>> Yeah. So I know about add autoire. So at
- 17:22the rate autowire tries to find a bean
- 17:25uh in your application context and then
- 17:27it finds the object of that bean and
- 17:29assigns that object uh to the field
- 17:32which is autodired. Uh I don't have much
- 17:35idea about uh the response body request
- 17:38body.
- 17:41Okay. Okay. Fine. Not an issue.
- 17:45Uh let's move to the next question. So
- 17:47uh now we are done with the floor right
- 17:51now where do you deploy this
- 17:52application?
- 17:54>> Yeah. So to deploy this application uh
- 17:56we are using EC2 machines on AWS. So AWS
- 18:00is Amazon web services. We have set of
- 18:02dedicated machines for this uh and we
- 18:05deploy our application to that EC2
- 18:07instance.
- 18:11>> Okay. Can you tell me the steps which
- 18:13will be uh required for the deployment
- 18:15process? Yeah. So there are few steps
- 18:18which we want. Uh so the first step is
- 18:21we want to uh dockerize the application.
- 18:24Okay. So let's let's try to understand
- 18:25how to dockerize the application. So the
- 18:27first thing we want is we want Maven. So
- 18:30uh MBN clean install or MBN package
- 18:34whatever command you want to use. Uh
- 18:35this will create a jar out of it. Okay.
- 18:38But uh we want to dockerize the
- 18:40application first. So there is a concept
- 18:42of docker file. We create a docker file
- 18:44in the application. uh which which can
- 18:46be used to create the image out of your
- 18:49application. So how do we create the
- 18:50image? We use uh docker build and then
- 18:54uh docker build dot. So this is how we
- 18:56create the image out of our application.
- 18:59Once the image is created then we take
- 19:01this image and uh push the image to the
- 19:04docker repository using docker push.
- 19:07Okay. So that this image becomes
- 19:09available to everyone uh once it is in
- 19:12the into the docker repository. And
- 19:14whenever you want to uh use that image
- 19:16uh we docker pull and uh then we uh do
- 19:20docker run. So whenever we do docker run
- 19:22on an image a docker docker container is
- 19:25spin spin up. So you can say uh the
- 19:27container is started from the image.
- 19:29Okay. Uh so this is how we uh do it. But
- 19:32how how we do uh into the EC2
- 19:35environment, we upload the jar into the
- 19:38EC2 environment which is uh where we
- 19:40have docker installed and uh we run the
- 19:43uh docker run command there and it it
- 19:46spins up the docker container on that
- 19:48EC2 machine and then our application is
- 19:50uh deployed to the uh EC2 and we use
- 19:54CI/CD for building the application and
- 19:56transferring the jar to the EC2 machine.
- 19:59So this is how we uh do the deployment.
- 20:03No. Okay. So you must be having a
- 20:06different environments like t stage prod
- 20:10right?
- 20:11>> Uh yeah we have different environments
- 20:12in the applications. Yes.
- 20:16>> So do you know the profiles in spring
- 20:18boot?
- 20:19>> Yeah. So profile is uh uh an important
- 20:23concept in spring boot. And uh if you
- 20:25want to create uh uh different set of
- 20:28beans for different sets of environment
- 20:30then we can use uh profiles. Okay. So uh
- 20:34how it works? Okay. In the development
- 20:35environment sometimes we use H2 database
- 20:38and in the testing environment we want
- 20:40mocking and in the production
- 20:41environment we want the actual actual
- 20:44run and connecting to the database. So
- 20:45how we handle this? We handle this with
- 20:48the uh use of profiles. Okay. So we
- 20:51create different classes and we annotate
- 20:54them with different profiles. For
- 20:55example, dev
- 20:57uh QA
- 20:59and production. Okay. And how do we say
- 21:02which profile is active? There are
- 21:04various ways to say which profile is
- 21:06active. We can say through um uh
- 21:09application.properties uh spring
- 21:12profile.active equal to dev. So a dev
- 21:15profile will be activated and all the
- 21:17beans which are corresponding to dev
- 21:19profile will be uh initialized during
- 21:22startup. If uh we want to give uh uh
- 21:25this active profile through a different
- 21:29um way uh so we can also give through
- 21:31the environment variable or uh we can uh
- 21:35give through command line parameters. So
- 21:36we can activate the profile using these
- 21:39three methods. So this is how we use
- 21:41profiles in the spring boot application.
- 21:48Now okay great uh now you mentioned you
- 21:53are using microservices based
- 21:54architecture so what are the components
- 21:56you have used from microservices
- 21:58architecture
- 22:00>> yeah so we have used uh various
- 22:02components uh one of them is API gateway
- 22:05uh then we have used uh service
- 22:07discovery uh then uh after service or
- 22:10database per service uh we have used uh
- 22:14then uh we have also used uh CQRS in our
- 22:18application. Okay. So these are a few
- 22:20things which we have used in the
- 22:22application.
- 22:25>> Okay. What is the purpose of uh API
- 22:28gateway or how do you configure or which
- 22:30API gateway you are using in your
- 22:32application?
- 22:33>> Yeah. So our application so generally
- 22:36what happens in microservices
- 22:37environment there are various components
- 22:39uh various microservices we can say
- 22:41there are consider we have three
- 22:42microservices microservices A and C okay
- 22:47so uh if if we give address of these
- 22:50microservices to the client then there
- 22:52there is a problem because tomorrow if
- 22:54we want to uh increase the number of uh
- 22:57instances of these microservices or add
- 22:59new microservices then we have to give
- 23:01those addresses to the client
- 23:03But um with the introduction of API
- 23:06gateway this problem is resolved. What
- 23:07we do? All the microservices will be
- 23:10behind this API gateway. So any
- 23:12communication from outside to the
- 23:14microservices will go through the API
- 23:16gateway. So API gateway is an entry
- 23:19point uh to the application. Okay. So if
- 23:21client wants to make any request, it
- 23:24will make a request to the API gateway
- 23:26and API gateway will in turn call the
- 23:29microservices depending upon uh the uh
- 23:32URL. Okay. So this is a single entry
- 23:34point and uh there are few common things
- 23:36which we can do in API gateway. For
- 23:39example, we can uh do rate limiting, we
- 23:42can do authentication and uh
- 23:44authorization and we can do logging. uh
- 23:47we can try to do some kind of uh
- 23:49analysis how many requests are coming.
- 23:52So all this common logic uh we put in
- 23:54API gateway and we use Netflix zuul.
- 23:58This is old but we use Netflix. There
- 24:00are uh new versions or new things which
- 24:03we can use. We can use Kong, we can use
- 24:06uh APG or uh we can use some other
- 24:10frameworks. So but we are using Netflix
- 24:12tool for the application.
- 24:15No. Okay.
- 24:18And what about service discovery?
- 24:21Do you know what is meant by service
- 24:23discovery?
- 24:24>> Yeah. So service discovery um as we have
- 24:27many microservices and each microser can
- 24:30have several instances. Okay. And
- 24:32consider one microser wants to call or
- 24:35communicate with other microser. In that
- 24:37case what will happen? We need address
- 24:39of that microser. Okay. And finding the
- 24:41address is very difficult uh if we keep
- 24:43on hard coding it. So that is the reason
- 24:46service discovery comes into picture.
- 24:48How it works?
- 24:50We have microservices and whenever uh we
- 24:53uh start a microser. So during startup
- 24:56that microser registers itself to the
- 25:00service discovery and service discovery
- 25:03knows where that microser is running on
- 25:06which host it is running and on which
- 25:08port it is running. Okay. So service
- 25:10discovery is like a index where it has
- 25:13all the details about all the running
- 25:15microservices and about their instances.
- 25:17Okay. So uh consider this scenario. Now
- 25:21microser A wants to call microser B.
- 25:24Then what will microser A do? Microser A
- 25:27will go to service discovery and ask uh
- 25:31give me the instance or give me the
- 25:32address of microser B. Then service
- 25:35discovery will return back the address
- 25:37of microser B. And then this address
- 25:40will be used to communicate uh to
- 25:42establish the communication between
- 25:44microser A and microser B. Okay. So uh
- 25:47there are few um there are few libraries
- 25:51which we can use. Uh we can use either
- 25:54ureka or we can use console. These are
- 25:58two things which we can use. Uh so we
- 26:01are using ureka. Okay. And then uh there
- 26:04are a few annotations uh at the rate um
- 26:06enable discovery client if you want to
- 26:09enable discovery server if you want to
- 26:11disco enable the server side of the uh
- 26:14we want to say that this is the server
- 26:15and this is the uh client. So this is
- 26:18how uh service discovery works.
- 26:26No. Okay. Okay. Fine. and how services
- 26:29communicates with each other.
- 26:32>> Uh so services communicate with each
- 26:34other. Uh there are two types of
- 26:36communication. One is synchronous
- 26:38communication and one is a asynchronous
- 26:39communication. So synchronous
- 26:41communication is either through rest
- 26:43template or through fine client and
- 26:46asynchronous communication is either
- 26:48through Kafka or message MQ rabbit MQ.
- 26:52So through one of the message broker or
- 26:54event broker. So uh let's try to
- 26:56understand about synchronous
- 26:58communication. So uh we can do
- 27:00synchronous communication through rest
- 27:02template rest template exchange method
- 27:05and we can uh specify the uh type of
- 27:08method we want to call either post, get,
- 27:11put or delete. Okay. But there is one
- 27:13better way of doing it through fine
- 27:15client. So find client is where we
- 27:17create an interface uh and uh we
- 27:20annotate that interface and we say about
- 27:23the service name that we are referring
- 27:24to and we give one method and this
- 27:27method will contain all the parameters
- 27:29that we want to pass to the uh rest API
- 27:32and the return type. Okay. So once we
- 27:36write the interface now if you want to
- 27:38call the interface we directly call uh
- 27:39the method of that interface and that
- 27:41underlying service call is automatically
- 27:44made. So that is how we do uh call uh
- 27:48the service through fine client. And if
- 27:50you want to do a a synchronous
- 27:52communication then we use either Kafka
- 27:54or uh rabbit MQ and uh uh then the uh
- 27:58service we are calling to subscribe to
- 28:01the uh Kafka topic and fetch the
- 28:05messages or fetch the events uh from the
- 28:09Kafka. So that is how the communication
- 28:11happens.
- 28:13>> No. Okay. Good. So, I'm done from my
- 28:16side. Do you have any questions for me?
- 28:18>> Uh, no. Thank you. Thanks for your time.
- 28:22>> Yeah. Thank you. Thanks. Bye-bye.
- 28:23>> Thanks. Bye-bye.
About this transcript
This page contains the full transcript of Capgemini Java Interview | Core Java, Spring Boot and Microservices by CloudTech, generated from the public captions YouTube serves with the video. The transcript has 4,479 words across 652 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.