Version: 2.2.0
grpc-transcode
Name#
HTTP(s) -> APISIX -> gRPC server
Proto#
Attributes#
content:.protofile's content.
Add a proto#
Here's an example, adding a proto which id is 1:
Attribute List#
| Name | Type | Requirement | Default | Valid | Description |
|---|---|---|---|---|---|
| proto_id | string/integer | required | .proto content id. | ||
| service | string | required | the grpc service name. | ||
| method | string | required | the method name of grpc service. | ||
| deadline | number | optional | 0 | deadline for grpc, ms | |
| pb_option | array[string(pb_option_def)] | optional | protobuf options |
How To Enable#
Here's an example, to enable the grpc-transcode plugin to specified route:
- attention: the
schemein the route's upstream must begrpc - the grpc server example:grpc_server_example
Test Plugin#
The above configuration proxy:
response:
This means that the proxying is working.
Use pb_option option of grpc-transcode plugin#
option list#
enum as result
- enum_as_name
- enum_as_value
int64 as result
- int64_as_number
- int64_as_string
- int64_as_hexstring
default values option
- auto_default_values
- no_default_values
- use_default_values
- use_default_metatable
hooks option
- enable_hooks
- disable_hooks
Test pb_option#
Visit configured route:
"workflowKey":"#2251799813685260" suggests pb_option configuration success.
Disable Plugin#
Remove the corresponding json configuration in the plugin configuration to disable grpc-transcode.
APISIX plugins are hot-reloaded, therefore no need to restart APISIX.