rabbitmq

package module
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2021 License: BSD-2-Clause Imports: 7 Imported by: 0

README

rabbitmq-client

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FailOnError added in v0.0.2

func FailOnError(err error, msg string)

FailOnError failed if any error

func StartConsumer added in v0.0.2

func StartConsumer(destination *MqDestination, receiver OnReceive, connSetting *Settings)

StartConsumer start process.

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 MqDestination

type MqDestination struct {
	Queue        string
	Topic        string
	ExchangeType string
	AutoAck      bool
	Exclusive    bool
	Prefetch     int
	DeclareAll   bool
}

MqDestination Rabbitmq destination

func (*MqDestination) Consume

func (mq *MqDestination) Consume(conn *rabbitmq.Connection, consumerTag string) (<-chan amqp.Delivery, *rabbitmq.Channel, error)

Consume start consumer

func (*MqDestination) DeclareDestination

func (mq *MqDestination) DeclareDestination(cnn *rabbitmq.Connection, createTempQueue bool) error

DeclareDestination declare Topic, queues....

func (*MqDestination) Produce

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

Produce publish message

func (*MqDestination) RPC added in v0.0.4

func (mq *MqDestination) RPC(ctx context.Context, conn *rabbitmq.Connection, message amqp.Publishing) (*amqp.Delivery, error)

RPC RPC over rabbitmq message. timeout setting should be ctx

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
}

Settings Settings, should include url & options

func (Settings) Close added in v0.0.7

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

Close close connection

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 (r Settings) Factory() (interface{}, error)

Factory factory for connection pool

func (Settings) Ping added in v0.0.7

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

Ping test connection status.

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