grpc

package
v0.28.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const SeparatorHeader = ":"

SeparatorHeader header key:value 分隔符

View Source
const SeparatorService = "/"

SeparatorService grpc service和method 分隔符

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

type ClientConfig

type ClientConfig struct {
	// Server 服务器地址,格式:host:port
	Server string
	// Service gRPC 服务名称,允许使用 ${} 占位符变量
	Service string
	// Method gRPC 方法名称,允许使用 ${} 占位符变量
	Method string
	// 请求参数 如果空,则使用当前消息负荷。参数使用JSON编码,必须和service/method要求一致。允许使用 ${} 占位符变量
	Request string
	//Headers 请求头,可以使用 ${metadata.key} 读取元数据中的变量或者使用 ${msg.key} 读取消息负荷中的变量进行替换
	Headers map[string]string
}

ClientConfig 定义 gRPC 客户端配置

type ClientNode

type ClientNode struct {
	base.SharedNode[*Client]
	Config ClientConfig
	// contains filtered or unexported fields
}

ClientNode gRPC 查询节点

func (*ClientNode) Destroy

func (x *ClientNode) Destroy()

Destroy 清理资源

func (*ClientNode) Init

func (x *ClientNode) Init(ruleConfig types.Config, configuration types.Configuration) error

Init 初始化 gRPC 客户端

func (*ClientNode) New

func (x *ClientNode) New() types.Node

New 实现 Node 接口,创建新实例

func (*ClientNode) OnMsg

func (x *ClientNode) OnMsg(ctx types.RuleContext, msg types.RuleMsg)

OnMsg 实现 Node 接口,处理消息

func (*ClientNode) Type

func (x *ClientNode) Type() string

Type 实现 Node 接口,返回组件类型

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL