FAQ

Kitex Frequently Asked Questions and corresponding Answers.

Kitex Framework

Q1: Does Kitex support Windows?

  • Yes. Kitex has already supported to compile and run in Windows since v0.4.0 version. And code generation tool support the Windows environment since v0.5.2.

Q2: Does Kitex support HTTP?

  • Kitex does not specifically provide HTTP request support. For API gateway scenario, Kitex provides a HTTP mapping generic call regarding Thrift and sends the Thrift encoding of the HTTP request to the server.
  • For related support, please refer to another CloudWeGo HTTP framework Hertz.

Q3: How to configure multiplexing?

  • If you are using Thrift or Kitex Protobuf, to configure multiplexing:
    1. Configure WithMuxTransport() on your server.
    2. Configure WithMuxConnection(1) on your client
  • If you are using gRPC, multiplexing is configured by default.

Q4: In the scenario of direct local call, why does the configuration of connection pool not take effect?

  • The ip of your local test needs to be 127.0.0.1. For example, “client.WithHostPorts(“127.0.0.1:8888”)”.

Q5: What are the differences between “Kitex Protobuf” and “gRPC” protocol?

  • Kitex Protobuf is a Protobuf Message Protocol defined by Kitex framework, with similar structure to Thrift.
  • gRPC provides support to gRPC message protocol and enables Kitex to interact with gRPC framework.

Q6: Issues regarding Thrift interface compiling, such as “not enough arguments in call to iprot.ReadStructBegin”

  • Based on Thrift v0.13, Kitex cannot be upgraded directly, as there is a breaking change in the interface of Apache Thrift v0.14. The reason for such problems could be that a new version of Thrift is pulled during upgrades. The use of -u parameters is not recommended during upgrades, you can run the following command to fix the version: “go mod edit -replace github.com/apache/thrift=github.com/apache/thrift@v0.13.0

Kitex Code Generation Tool

Q1:‘not enough arguments’ problem when installing the code generation tool

  • Please try: “go mod:GO111MODULE=on go get github.com/cloudwego/kitex/tool/cmd/kitex@latest”

Q2: Why ‘set’ in IDL becomes slice in generated codes?

Q3: Why is there an underscore after some field names?

  • The official implementation of Thrift restricts identifiers ending in “Result” and “Args” to avoid naming conflicts. The official Thrift conflict avoidance strategy: when the type name, service name and method name in the Thrift file start with New or end with Result or with Args, Thrift will automatically add an underscore at the end of the name. Referring to https://jira.apache.org/jira/browse/THRIFT-4410, Kitex uses Thriftgo for code generation. Thriftgo adopts a similar strategy in order to be as consistent as possible with the official implementation.

Q4: Would code generated by new interface overwrite handler.go

  • Generated code under kitex_gen/ will be overwritten. But handler.go of server will not be overwritten, only new methods will be added correspondingly.

Q5: Do the templates of the code generator support customization?

  • We have no plan to support template customization at present, because it will make the design for parameter passing much more complex. And the plugin mechanism can achieve almost any functionality equivalent to a customized template.

Q6: Is it possible for the ‘-type’ argument of the code generator to be determined automatically by IDL filename extension?

  • Kitex already supports automatic file suffix determination in v0.4.0, there’s no need to add the -type parameter.