agent

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Address        string `json:"address" required:"true"`
	Version        string `json:"version"` // e.g 2.1.0
	MQCert         string `json:"mq_cert"`
	OTEL           bool   `json:"otel"` // Whether otel tracing is enabled
	Username       string `json:"user_name"`
	Password       string `json:"password"`
	Algorithm      string `json:"algorithm"`
	SkipCertVerify bool   `json:"skip_cert_verify"`
}

func (*Config) Validate

func (cfg *Config) Validate() error

type Handler

type Handler func([]byte, map[string]string) error

Handler

type MQAgent

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

func NewMQAgent added in v1.0.1

func NewMQAgent(cfg *Config, log mq.Logger, redis Redis, queueName string, removeCert bool) (*MQAgent, error)

func (*MQAgent) Exit

func (agent *MQAgent) Exit()

func (*MQAgent) Publish

func (agent *MQAgent) Publish(topic string, header map[string]string, msg []byte, opts ...mq.PublishOption) error

func (*MQAgent) Subscribe

func (agent *MQAgent) Subscribe(group string, h Handler, topics []string) error

func (*MQAgent) SubscribeWithStrategyOfRetry

func (agent *MQAgent) SubscribeWithStrategyOfRetry(group string, h Handler, topics []string, retryNum int) error

func (*MQAgent) SubscribeWithStrategyOfSendBack

func (agent *MQAgent) SubscribeWithStrategyOfSendBack(group string, h Handler, topics []string) error

type Redis

type Redis interface {
	RPush(string, interface{}) error
	LPop(string, interface{}) error
	IsKeyNotExists(error) bool
}

Jump to

Keyboard shortcuts

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