rabbitmq

package module
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: May 7, 2022 License: BSD-2-Clause Imports: 9 Imported by: 0

README

rabbitmq-client

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SharedConnection = true

SharedConnection should shared connection? default YES

Functions

func DefaultLogger added in v0.3.0

func DefaultLogger() *zap.Logger

func WrapRepo added in v0.0.2

func WrapRepo(msg amqp.Delivery, body []byte, headers amqp.Table) *amqp.Publishing

WrapRepo wrap up for repo to rabbitmq

Types

type Destination added in v0.1.1

type Destination struct {
	Queue        string
	Topic        string
	ExchangeType string
	AutoAck      bool
	Exclusive    bool
	Prefetch     int
	DeclareAll   bool
	Logger       *zap.Logger
}

Destination Rabbitmq destination

func (*Destination) Consume added in v0.1.1

func (mq *Destination) Consume(ch *rabbitmq.Channel, consumerTag string) (<-chan amqp.Delivery, *rabbitmq.Channel, error)

Consume start consumer

func (*Destination) DeclareDestination added in v0.1.1

func (mq *Destination) DeclareDestination(channel *rabbitmq.Channel, createTempQueue bool) error

DeclareDestination declare Topic, queues....

func (*Destination) Produce added in v0.1.1

func (mq *Destination) Produce(channel *rabbitmq.Channel, message amqp.Publishing) error

Produce publish message

func (*Destination) RPC added in v0.1.1

func (mq *Destination) RPC(ctx context.Context, ch *rabbitmq.Channel, message amqp.Publishing) (*amqp.Delivery, error)

RPC RPC over rabbitmq message. timeout setting should be ctx

func (*Destination) SetDefaults added in v0.3.0

func (r *Destination) SetDefaults()

func (*Destination) StartConsumer added in v0.3.0

func (destination *Destination) StartConsumer(receiver OnReceive, ch *rabbitmq.Channel, consumerTag string)

StartConsumer start process.

type OnReceive added in v0.0.2

type OnReceive interface {
	OnReceiveMessage(msg amqp.Delivery) (string, *amqp.Publishing, error)
}

OnReceive interface for Receiver

type Settings

type Settings struct {
	Host     string `default:"localhost"`
	Port     uint   `default:"5672"`
	User     string `default:"guest"`
	Password string `default:"guest"`
	Vhost    string `default:"/"`
	Prop     amqp.Table

	Logger *zap.Logger
	// contains filtered or unexported fields
}

Settings Settings, should include url & options

func (Settings) Close added in v0.0.7

func (c Settings) Close(v interface{}) error

func (*Settings) ConnURL

func (r *Settings) ConnURL() string

ConnURL return connection URL for Dial

func (*Settings) Connect

func (r *Settings) Connect() (*rabbitmq.Connection, error)

Connect make connection to Rabbitmq

func (Settings) Factory added in v0.0.7

func (c Settings) Factory() (interface{}, error)

func (Settings) Ping added in v0.0.7

func (c Settings) Ping(v interface{}) error

func (*Settings) SetDefaults added in v0.3.0

func (r *Settings) SetDefaults()

func (*Settings) String

func (r *Settings) String() string

String for log connection URL.

Jump to

Keyboard shortcuts

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