 Hi everybody, welcome back to another technical demo around the Quarkus application. My name is Daniel O. I'm working for Red Hat as a technical marketing major. This video showcase how to implement a blocking GRPC service on Quarkus. Let's get started. So if you're not familiar with GRPC service, so GRPC is a modern open-source high-performance RPC framework that can run any environment such as Java, Python, Go, JavaScript. You can also have efficient connect service across the data center with a probable support for load balancing and tracing and hash checking and authentication that is a required capability when you build a microservices system. You can also have applicable in the last mile of disappearing computing connected devices and mobile application and even web browser to backend application service here. I'm going to walk you through how Quarkus application enables Java developer to consume the blocking RPC service. Okay, here's my Quarkus application. Just include a simple RESTful API, like Hello. First of all, we need to enable the GRPC service on top of Quarkus. In order to do that, we need to add Quarkus GRPC extension. Once you install GRPC extension, we're going to create a proto file because the GRPC service are described in a proto file, which is with a different method. So in this case, we're going to add some message exchange data as well as some service name here. So first, we need to add the syntax type, the proto3, and a couple more options, like a Java multiple files are true, and a package name, whatever you need to define, like me.daniel.grpc.proto. And also you can expose your Java auto class name like Hello World or Hello World Proto. Here we need to define the package name. This is optional. You can define that. And the most important thing, we need to define the GRPC service here, the service name, Griller, and the RPC method here is to say Hello, with the defining exchange data like Hello Request and Hello Reply. In order to define the messaging Hello Request and string name and Hello Reply messaging, also a string messaging. In order to generate the Java classes like a stuff file, a basic implementation, we need to use Maven compile command line. And once you compile it down, you can find that the product above the generated file here under the product above directory. You can also use tree command line to figure out the directory structure. So you can find the product directory, the GRPC Java, and also the other Java messaging stuff and the generated classes here. Let's take a little bit more of the GRPC service Java file here. You can find that the RPC method already defined and generate the specific application logic and also you're messaging the Java classes here, Hello Reply and Hello Request. Alright, so next step, we're going to run this Quarkus application just to make sure this application is totally working. So using Quarkus Def mode and then just try to access to endpoint. We already have a deeper endpoint, Hello as a RESTful API. Okay, so here are the install features. You can see that and there are the GRPC extension already pulled down and try to access 8080 to default pull in the Quarkus and then return Hello. Okay, this application totally working even we after add GRPC annotation. Alright, let's try to create a new service here. So we're going to implement new service. The name is Hello service Java file. And then using Quarkus to implement the GRPC service we need to extend the Generate Service-Based Implementation here, Greedo-imple base and also we need to add a single-tone CDIB rather than application scope because GRPC service implementation cannot be processed. Okay, we're going to override the Say Hello from Greedo Implementation base and the parameter is Hello Request and Street Optuber. We're going to define that in the specified name and message variable here and we're going to add the Hello with the name as the message. And now we're going to implement the method which is defined in the service definition here in a single method and now to try to build and send the message using the Response Optuber and the last step we're going to close this response using Uncomplete method here responseOptuber.uncomplete. Alright, we just create a new service to override the existing GRPC service implementation. Alright, so next step, we're going to create a new consuming the blocking GRPC service here using existing Hello Resource Java file. First of all, we're going to add injection with CDIBs using inject annotation as well as GRPC annotation. In this annotation, we can use the existing stopped GRPC classes that is generated when we did Maven Compile that came from the prototype file. And then we're going to add a new endpoint method and a get method and a pass is a new parameter like a name and the public string Hello and the passPrem is the name. We're going to pass the name and the string variable also name. We're going to define that. And the return is the, we're going to invoke the gridlock blocking stop classes here client Hello and the return code and the parameter is a hello request and we're going to new build after set the name and build the message here. Alright, and the one thing I just missed that we need to add the service name in a GRPC service annotation here. Okay, so we're going to name is Hello here and we're going to use this name in our application properly. So let's try to add a new GRPC property, Quarkus.grpysClient host name. So we just defined Hello and my host is localhost because I'm going to run this GRPC service server on my local machine Quarkus by default expose the GRPC server with 9000 port and also the Quarkus provide the reflection capability when you enable that reflection. So using GRPCurve to have the reflection list and then now you can see the default has some mechanism in the GRPC server and also the new reflection HelloGridder we just created that thing and let's try to nail down the HelloGridder and say Hello with the pass down some parameter like the name is Daniel O. So we will be return my name Hello Daniel O as a return message. Alright, it's pretty cool. So now we just confirm the GRPC reflection is totally working. So now let's try to ask the actual endpoint like with endpoint. So the Hello and Daniel O we got the same result but in this case we're going to use the GRPC service here. Okay, just in order to recap what we learned today we learned how to implement a blocking GRPC service using Quarkus application so typically you just need to add the Quarkus GRPC extension as you just need to define a protocol file to generate the stop and base implementation classes and then you just consume the GRPC service I mean blocking GRPC service on your Quarkus application. That's good really helpful for you and thanks for watching today and please make sure subscribe for the next practical example. Have a good rest of the day.