nats

package
v0.0.0-...-be2e216 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const KeyResponseTopic = "responseTopic"

KeyResponseTopic 响应主题metadataKey

View Source
const Type = types.EndpointTypePrefix + "nats"

Type 组件类型

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// NATS服务器地址
	Server string
	// NATS用户名
	Username string
	// NATS密码
	Password string
}

type Endpoint

type Endpoint = Nats

Endpoint 别名

type Nats

type Nats struct {
	impl.BaseEndpoint
	base.SharedNode[*nats.Conn]
	RuleConfig types.Config
	//Config 配置
	Config Config
	// contains filtered or unexported fields
}

Nats NATS接收端端点

func (*Nats) AddRouter

func (x *Nats) AddRouter(router endpointApi.Router, params ...interface{}) (string, error)

func (*Nats) Close

func (x *Nats) Close() error

func (*Nats) Destroy

func (x *Nats) Destroy()

Destroy 销毁

func (*Nats) Id

func (x *Nats) Id() string

func (*Nats) Init

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

Init 初始化

func (*Nats) New

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

func (*Nats) Printf

func (x *Nats) Printf(format string, v ...interface{})

func (*Nats) RemoveRouter

func (x *Nats) RemoveRouter(routerId string, params ...interface{}) error

func (*Nats) Start

func (x *Nats) Start() error

func (*Nats) Type

func (x *Nats) Type() string

Type 组件类型

type RequestMessage

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

RequestMessage 请求消息

func (*RequestMessage) Body

func (r *RequestMessage) Body() []byte

func (*RequestMessage) From

func (r *RequestMessage) From() string

func (*RequestMessage) GetError

func (r *RequestMessage) GetError() error

func (*RequestMessage) GetMsg

func (r *RequestMessage) GetMsg() *types.RuleMsg

func (*RequestMessage) GetParam

func (r *RequestMessage) GetParam(key string) string

func (*RequestMessage) Headers

func (r *RequestMessage) Headers() textproto.MIMEHeader

func (*RequestMessage) SetBody

func (r *RequestMessage) SetBody(body []byte)

func (*RequestMessage) SetError

func (r *RequestMessage) SetError(err error)

func (*RequestMessage) SetMsg

func (r *RequestMessage) SetMsg(msg *types.RuleMsg)

func (*RequestMessage) SetStatusCode

func (r *RequestMessage) SetStatusCode(statusCode int)

type ResponseMessage

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

ResponseMessage 响应消息

func (*ResponseMessage) Body

func (r *ResponseMessage) Body() []byte

func (*ResponseMessage) From

func (r *ResponseMessage) From() string

func (*ResponseMessage) GetError

func (r *ResponseMessage) GetError() error

func (*ResponseMessage) GetMsg

func (r *ResponseMessage) GetMsg() *types.RuleMsg

func (*ResponseMessage) GetParam

func (r *ResponseMessage) GetParam(key string) string

func (*ResponseMessage) Headers

func (r *ResponseMessage) Headers() textproto.MIMEHeader

func (*ResponseMessage) SetBody

func (r *ResponseMessage) SetBody(body []byte)

func (*ResponseMessage) SetError

func (r *ResponseMessage) SetError(err error)

func (*ResponseMessage) SetMsg

func (r *ResponseMessage) SetMsg(msg *types.RuleMsg)

func (*ResponseMessage) SetStatusCode

func (r *ResponseMessage) SetStatusCode(statusCode int)

Jump to

Keyboard shortcuts

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