rabbitmq

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AMQP

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

func NewAMQP

func NewAMQP(ctx context.Context, cfg Config) *AMQP

func (*AMQP) Running

func (a *AMQP) Running()

func (*AMQP) StartConsumer

func (a *AMQP) StartConsumer()

type Config

type Config struct {
	Host           string        `json:"host"`
	Port           string        `json:"port"`
	User           string        `json:"user"`
	Password       string        `json:"password"`
	Vhost          string        `json:"vhost"`
	MaxDialTimeout time.Duration `json:"maxDialTimeout"`
}

type ConnType

type ConnType uint8
const (
	Direct ConnType = 16 << iota
	FanOut
	Topic
	Headers
)

type Consumer

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

func NewConsumer

func NewConsumer(ap *AMQP, cfg ConsumerConfig) *Consumer

func (*Consumer) SetName

func (c *Consumer) SetName(name string) *Consumer

func (*Consumer) Start

func (c *Consumer) Start() *Consumer

type ConsumerConfig

type ConsumerConfig struct {
	Exchange   Exchange
	RoutingKey RoutingKey
	Queue      Queue
	ResStruct  any
	AutoAck    bool
	Handel     ConsumerHandel
}

type ConsumerHandel

type ConsumerHandel func(ctx context.Context, message *ReceiveMsgPackage)

type Exchange

type Exchange string

type Producer

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

func NewProducer

func NewProducer(ap *AMQP, c ProducerConfig) *Producer

func (*Producer) Push

func (p *Producer) Push(ctx context.Context, message any)

func (*Producer) Start

func (p *Producer) Start() *Producer

type ProducerConfig

type ProducerConfig struct {
	Exchange   Exchange
	RoutingKey RoutingKey
	Type       ConnType
}

type Queue

type Queue string

type ReceiveMsgPackage

type ReceiveMsgPackage struct {
	RequestId string
	MsgId     string
	SendTime  time.Time
	// contains filtered or unexported fields
}

func (*ReceiveMsgPackage) Content

func (res *ReceiveMsgPackage) Content(ptr interface{}) error

type RoutingKey

type RoutingKey string

Jump to

Keyboard shortcuts

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