mq

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

description: sync_eth

@author: xwc1125 @date: 2020/10/05

description: sync_eth

@author: xwc1125 @date: 2020/10/05

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultApply

func DefaultApply(exchange, queue, routingKey string, ch *amqp.Channel) (err error)

Types

type ApplyTopology

type ApplyTopology func(exchange, queue, routingKey string, ch *amqp.Channel) error

ApplyTopology to apply resource from MQ server eg. QueueDeclare, ExchangeDeclare

type Config

type Config struct {
	Host     string `json:"host" mapstructure:"host"`
	Port     int64  `json:"port" mapstructure:"port"`
	Username string `json:"username" mapstructure:"username"`
	Password string `json:"password" mapstructure:"password"`
	IsUse    bool   `json:"isUse" mapstructure:"isUse"`
}

func (*Config) GetConnUtl

func (c *Config) GetConnUtl() string

type ConsumeHandler

type ConsumeHandler func(d amqp.Delivery) error

ConsumeHandler .

type Wrapper

type Wrapper struct {
	Addr   string
	Config amqp.Config
	// contains filtered or unexported fields
}

Wrapper .

func New

func New(addr string, cfg amqp.Config, exchange, queue, routingKey string, f ApplyTopology) *Wrapper

func NewDefaultMq

func NewDefaultMq(config *Config, ex, queue, routingKey string) *Wrapper

func (*Wrapper) Channel

func (w *Wrapper) Channel(timeout time.Duration) (*amqp.Channel, error)

Channel . it will blocked

func (*Wrapper) Close

func (w *Wrapper) Close() error

Close .

func (*Wrapper) Consume

func (w *Wrapper) Consume(consumer string, autoAck, exclusive, noLocal, noWait bool,
	args amqp.Table, handler ConsumeHandler)

func (*Wrapper) Produce

func (w *Wrapper) Produce(mandatory, immediate bool, dat []byte) error

Jump to

Keyboard shortcuts

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