rabbitmq

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Type               = types.EndpointTypePrefix + "rabbitmq"
	KeyRequestTopic    = "topic"
	KeyRequestKey      = "key"
	KeyRequestExchange = "exchange"

	// KeyResponseExchange 响应交换机metadataKey
	KeyResponseExchange = "responseExchange"
	// KeyResponseTopic 响应主题metadataKey
	KeyResponseTopic = "responseTopic"
	// KeyResponseKey 响应主题metadataKey
	KeyResponseKey = "responseKey"

	JsonContextType = "application/json"
)
View Source
const (
	ContentTypeJson = "application/json"
	ContentTypeText = "text/plain"

	KeyContentType = "Content-Type"
	KeyUTF8        = "utf-8"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Server string
	// 交换机名称
	Exchange string
	// 交换机类型 如果交换机不存在,则会使用该类型创建,默认为direct
	ExchangeType string
	//表示交换器是否持久化。如果设置为 true,即使消息服务器重启,交换器也会被保留。
	Durable bool
	//表示交换器是否自动删除。如果设置为 true,则当没有绑定的队列时,交换器会被自动删除。
	AutoDelete bool
}

type Endpoint

type Endpoint = RabbitMQ

type RabbitMQ

type RabbitMQ struct {
	impl.BaseEndpoint
	base.SharedNode[*amqp.Connection]
	// GracefulShutdown provides graceful shutdown capabilities
	// GracefulShutdown 提供优雅停机功能
	base.GracefulShutdown
	RuleConfig types.Config
	Config     Config
	// contains filtered or unexported fields
}

func (*RabbitMQ) AddRouter

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

func (*RabbitMQ) Close

func (x *RabbitMQ) Close() error

func (*RabbitMQ) Destroy

func (x *RabbitMQ) Destroy()

func (*RabbitMQ) GracefulStop added in v0.32.0

func (x *RabbitMQ) GracefulStop()

GracefulStop provides graceful shutdown for the RabbitMQ endpoint GracefulStop 为 RabbitMQ 端点提供优雅停机

func (*RabbitMQ) Id

func (x *RabbitMQ) Id() string

func (*RabbitMQ) Init

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

func (*RabbitMQ) New

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

func (*RabbitMQ) Printf

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

func (*RabbitMQ) RemoveRouter

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

func (*RabbitMQ) Start

func (x *RabbitMQ) Start() error

func (*RabbitMQ) Type

func (x *RabbitMQ) Type() string

type RequestMessage

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

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
}

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