The documentation you are viewing is for Dapr v1.12 which is an older version of Dapr. For up-to-date documentation, see the latest version.

Kitex

Detailed documentation on the Kitex binding component

Overview

The binding for Kitex mainly utilizes the generic-call feature in Kitex. Learn more from the official documentation around Kitex generic-call. Currently, Kitex only supports Thrift generic calls. The implementation integrated into components-contrib adopts binary generic calls.

Component format

To setup an Kitex binding, create a component of type bindings.kitex. See the How-to: Use output bindings to interface with external resources guide on creating and applying a binding configuration.

apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
  name: bindings.kitex
spec:
  type: bindings.kitex
  version: v1
  metadata: 
  - name: hostPorts
    value: "127.0.0.1:8888"
  - name: destService
    value: "echo"
  - name: methodName
    value: "echo"
  - name: version
    value: "0.5.0"

Spec metadata fields

The InvokeRequest.Metadata for bindings.kitex requires the client to fill in four required items when making a call:

  • hostPorts
  • destService
  • methodName
  • version
Field Required Binding support Details Example
hostPorts Y Output IP address and port information of the Kitex server (Thrift) "127.0.0.1:8888"
destService Y Output Service name of the Kitex server (Thrift) "echo"
methodName Y Output Method name under a specific service name of the Kitex server (Thrift) "echo"
version Y Output Kitex version "0.5.0"

Binding support

This component supports output binding with the following operations:

  • get

Example

When using Kitex binding:

  • The client needs to pass in the correct Thrift-encoded binary
  • The server needs to be a Thrift Server.

The kitex_output_test can be used as a reference. For example, the variable reqData needs to be encoded by the Thrift protocol before sending, and the returned data needs to be decoded by the Thrift protocol.

Request

{
  "operation": "get",
  "metadata": {
    "hostPorts": "127.0.0.1:8888",
    "destService": "echo",
    "methodName": "echo",
    "version":"0.5.0"
  },
  "data": reqdata
}