rabbit

package
v0.0.0-...-a6d198d Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(user, pass, host string, port int) error

func Publish

func Publish(routingKey string, msg *Message) error

func Subscribe

func Subscribe(bindingKey string, h Handler) error

Types

type Broker

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

func New

func New(user, pass, host string, port int) *Broker

func (*Broker) Call

func (b *Broker) Call(ctx context.Context, routingKey string, msg *Message) ([]*Message, error)

Call 期待响应

func (*Broker) Close

func (b *Broker) Close() error

func (*Broker) Connect

func (b *Broker) Connect() error

func (*Broker) Publish

func (b *Broker) Publish(routingKey string, msg *Message) error

Publish 不需要响应, 推完就拉到

func (*Broker) Subscribe

func (b *Broker) Subscribe(bindingKey string, h Handler) error

type Handler

type Handler func(*Message) (*Message, error)

type Message

type Message struct {
	Headers map[string]interface{}
	Body    []byte
}

func Call

func Call(ctx context.Context, routingKey string, msg *Message) ([]*Message, error)

Jump to

Keyboard shortcuts

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