rabbitmq

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2022 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpenConnection

func OpenConnection(addr string) (*amqp.Connection, error)

OpenConnection connect to rabbitmq

Types

type Channel

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

Channel data channel

func NewChannel

func NewChannel(conn *amqp.Connection) Channel

NewChannel instance a channel

func (Channel) Create

func (c Channel) Create() (*amqp.Channel, error)

Create create a channel

type Consumer

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

Consumer define consumer for rabbitmq

func NewConsumer

func NewConsumer(addr, exchange, queueName string, autoDelete bool, handler func(body []byte) error) *Consumer

NewConsumer instance a consumer

func (*Consumer) Handle

func (c *Consumer) Handle(delivery <-chan amqp.Delivery)

Handle handle data

func (*Consumer) ReConnect

func (c *Consumer) ReConnect()

ReConnect .

func (*Consumer) Run

func (c *Consumer) Run() error

Run .

func (*Consumer) Start

func (c *Consumer) Start() error

Start start a service

func (*Consumer) Stop

func (c *Consumer) Stop()

Stop a consumer

type Producer

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

Producer define struct for rabbitmq

func NewProducer

func NewProducer(addr, exchange string) *Producer

NewProducer create a producer

func (*Producer) Publish

func (p *Producer) Publish(routingKey, message string) error

Publish push data to queue

func (*Producer) ReConnect

func (p *Producer) ReConnect()

ReConnect .

func (*Producer) Run

func (p *Producer) Run() error

Run .

func (*Producer) Start

func (p *Producer) Start() error

Start start a producer

func (*Producer) Stop

func (p *Producer) Stop()

Stop .

type Queue

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

Queue .

func NewQueue

func NewQueue(channel *amqp.Channel, name string) Queue

NewQueue .

func (Queue) Create

func (q Queue) Create() (amqp.Queue, error)

Create .

Jump to

Keyboard shortcuts

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