rabbitmq

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2019 License: Apache-2.0 Imports: 3 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dial

func Dial(username, password, host, port string) (*amqp.Connection, *amqp.Channel, error)

Dial returns a new Connection over TCP using PlainAuth

Types

type AMQPChannel

type AMQPChannel struct {
	*amqp.Channel
}

AMQPChannel wraps a amqp.Channel

func (*AMQPChannel) Receive

func (channel *AMQPChannel) Receive(name string) (<-chan amqp.Delivery, error)

Receive immediately starts delivering queued messages.

func (*AMQPChannel) ReceiveOnExchange

func (c *AMQPChannel) ReceiveOnExchange(name string, excType string) (<-chan amqp.Delivery, error)

ReceiveOnExchange immediately starts delivering queued messages.

func (*AMQPChannel) Send

func (channel *AMQPChannel) Send(name string, body []byte) error

Send sends body to an exchange on the server.

func (*AMQPChannel) SendToExchange

func (c *AMQPChannel) SendToExchange(name string, excType string, body []byte) error

SendToExchange sends body to an exchange.

type Channel

type Channel interface {
	// Send sends body to a message queue.
	Send(name string, body []byte) error
	// Receive immediately starts delivering queued messages.
	Receive(name string) (<-chan amqp.Delivery, error)
	// SendToExchange sends body to an exchange.
	SendToExchange(name string, excType string, body []byte) error
	// Receive immediately starts delivering queued messages.
	ReceiveOnExchange(name string, excType string) (<-chan amqp.Delivery, error)
}

Channel sends and receives the messages from the queus

type MockAMQPChannel

type MockAMQPChannel struct{}

MockAMQPChannel is a mock from amqp.Channel

func (*MockAMQPChannel) Receive

func (channel *MockAMQPChannel) Receive(name string) (<-chan amqp.Delivery, error)

Receive mocks Receive method

func (*MockAMQPChannel) ReceiveOnExchange

func (channel *MockAMQPChannel) ReceiveOnExchange(name string, excType string) (<-chan amqp.Delivery, error)

ReceiveOnExchange immediately starts delivering queued messages.

func (*MockAMQPChannel) Send

func (channel *MockAMQPChannel) Send(name string, body []byte) error

Send mocks Send method

func (*MockAMQPChannel) SendToExchange

func (channel *MockAMQPChannel) SendToExchange(name string, excType string, body []byte) error

SendToExchange mocks sending body to an exchange.

Jump to

Keyboard shortcuts

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