Documentation
¶
Overview ¶
Package rpctool 把 RPC 接口暴露为能力。
RPC 框架各异(kitex 泛化调用、gRPC 反射、thrift 等),本包不绑定任何 一种,只定义 Invoker 契约:接入方实现"service/method + JSON 请求 → JSON 响应"的泛化调用,用 source.Static 打包成源即可进目录:
caps := []capability.Capability{
rpctool.New("order", rpctool.Method{...}, myKitexInvoker),
}
catalog.AddSource(ctx, source.Static("order-rpc", caps...), true, 0)
kitex:genericclient + generic.JSONThriftGeneric 天然满足该契约; gRPC:reflection + protojson 即可实现。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(namespace string, m Method, inv Invoker) capability.Capability
New 把一个 RPC 方法包装成能力,namespace 为所属 source 名。
Types ¶
Click to show internal directories.
Click to hide internal directories.