rabbitmq

package
v0.0.0-...-3262849 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2019 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Connect() error
	Init(initializer TopologyInitializer) error
	Cast(ctx context.Context, request Delivery) error
	Call(ctx context.Context, request Delivery) (Response, error)
	Listen(ctx context.Context, queue string, autoAck, exclusive, noLocal, noWait bool, args amqp.Table, handler MessageHandler) chan error
	Stop() error
}

type Delivery

type Delivery struct {
	Headers    amqp.Table
	Body       []byte
	Exchange   string
	RoutingKey string
}

type MessageHandler

type MessageHandler func(ctx context.Context, delivery Delivery, reply ReplyFunc) error

type RabbitClient

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

func NewClient

func NewClient(url string, logger log.FieldLogger, timeout int) (*RabbitClient, error)

Create a new RabbitMQ Client with the given AMQP URL (e.g. amqp://localhost:5672/), logger instance and timeout (in seconds)

func (*RabbitClient) Call

func (client *RabbitClient) Call(ctx context.Context, request Delivery) (Response, error)

Perform a Direct ReplyTo call, automatically listening for a response

func (*RabbitClient) Cast

func (client *RabbitClient) Cast(ctx context.Context, request Delivery) error

Perform an async publishing

func (*RabbitClient) Connect

func (client *RabbitClient) Connect() error

func (*RabbitClient) Init

func (client *RabbitClient) Init(initializer TopologyInitializer) error

func (*RabbitClient) Listen

func (client *RabbitClient) Listen(ctx context.Context, queue string, autoAck, exclusive, noLocal, noWait bool, args amqp.Table, handler MessageHandler) chan error

func (*RabbitClient) Stop

func (client *RabbitClient) Stop() error

type ReplyFunc

type ReplyFunc func(ctx context.Context, response Response) error

func CreateReplyFunc

func CreateReplyFunc(client *RabbitClient) ReplyFunc

type Response

type Response struct {
	Headers amqp.Table
	Body    []byte
}

type TopologyInitializer

type TopologyInitializer func(builder topology.Builder) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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