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.

  1. apiVersion: dapr.io/v1alpha1
  2. kind: Component
  3. metadata:
  4. name: bindings.kitex
  5. spec:
  6. type: bindings.kitex
  7. version: v1
  8. metadata:
  9. - name: hostPorts
  10. value: "127.0.0.1:8888"
  11. - name: destService
  12. value: "echo"
  13. - name: methodName
  14. value: "echo"
  15. - name: version
  16. 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
FieldRequiredBinding supportDetailsExample
hostPortsYOutputIP address and port information of the Kitex server (Thrift)“127.0.0.1:8888”
destServiceYOutputService name of the Kitex server (Thrift)“echo”
methodNameYOutputMethod name under a specific service name of the Kitex server (Thrift)“echo”
versionYOutputKitex 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

  1. {
  2. "operation": "get",
  3. "metadata": {
  4. "hostPorts": "127.0.0.1:8888",
  5. "destService": "echo",
  6. "methodName": "echo",
  7. "version":"0.5.0"
  8. },
  9. "data": reqdata
  10. }

Last modified March 21, 2024: Merge pull request #4082 from newbe36524/v1.13 (f4b0938)