Configuring gRPC connectors

gRPC is a robust open-source high performance Remote Procedure Call (RPC) framework used to develop scalable and fast APIs. The core concept in grpc is streaming where several things happen in a single request. Protocol buffers are used instead of JSON to handle request/response multiplexing.

In gRPC you have to define a service interface and specify the method which can be called remotely with their parameters and return types. There are four kinds of service methods: Unary RPCs,Server streaming RPCs ,Client streaming RPCs and Bidirectional streaming RPCs.

Think of a scenario where a live Q&A session is held for continuous communcation with your viewers to promote your brand for marketing purposes.

DronaHQ Studio supports a unary service method where the client sends a single request to the server and gets a single response back. Studio helps you with the set-up of client requests. In APIs we use JSON files but in gRPCs we use protoc complier.

Note: There is no API in gRPC. DronaHQ acts as a middleware between client request and the server response.

Configuring gRPC connector

To add a gRPC connector, under Studio > Connectors, click (+) Connector and select the gRPC connector.

You need to first configure the connector. Enter the Connector name which would be used when you need the connector in your apps and while adding queries.

Prerequisite

DronaHQ provides you all the required information for authentication.

The most important part of the process is to provide the host, the port and proto type file details. These fields are required to establish connection.Enter the connection parameters required namely host, port and the prototype file. Meta Data are key-value pairs that you can add in case you want to pass it in headers for each api call.

Once these configurations are added, click Test connection. If the authentication is successful you would get the response accordingly. Click to Save your configuration.

Query Builder for the gRPC connector

Now that you have configured the connector you will find it under the gRPC connectors list.

In order to undertake any action click the Add query option available once your connection is ready.
Here you can add your queries which in turn would be based on the variables and arguments depending on the API.

Studio provides the Query Builder that enables you to define the queries reading the protofile. DronaHQ automatically detects Services and Methods available and pre-populates the dropdown.

Let us take an example to translate any text into Hindi.

Click +Add Query

Enter your Query Name. Enter the respective parameters like Service, Method and Data.
Click Test Query and check the Response and Save.

Adding Variables to the Query

If you want to add dynamic variables, you need to provide the variable in double curly brackets within the Query. When you test the query in the Query Builder you can provide the input parameter value. Save the Query.

You can now view the queries that you saved for use in your apps later under your specific connector.

querylist2

Using gRPC connector

Let us take an example where a live session is held for marketing a particular brand. The audience present are from different countries. For the Indian audience we want to display a Welcome message in Hindi.

In this case you simply need to Add your Sheet in table grid control. Apply a filter to select an Indian country.

So now when you take a preview of the respective form you would be able to see the data accordingly.

tablegridnew

Go to Bind Data> Connectors for query configuration.

Now run the query and see the result.