server

package
v0.0.0-...-b5f2101 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2016 License: BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxChannels int = 2 << 10
)
View Source
const (
	QueueMaxLen = 2 << 8
)

Variables

This section is empty.

Functions

func Close

func Close(amqpuri string, connID string) error

Types

type AMQPServer

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

AMQPServer is a fake AMQP server. It handle the fake TCP connection

func Connect

func Connect(amqpuri string, connID string, errBroadcast *utils.ErrBroadcast) (*AMQPServer, error)

func NewServer

func NewServer(amqpuri string) *AMQPServer

NewServer starts a new fake server

func (*AMQPServer) CreateChannel

func (s *AMQPServer) CreateChannel(connid string) (wabbit.Channel, error)

CreateChannel returns a new fresh channel

func (*AMQPServer) Start

func (s *AMQPServer) Start() error

Start a new AMQP server fake-listening on host:port

func (*AMQPServer) Stop

func (s *AMQPServer) Stop() error

Stop the fake server

type Channel

type Channel struct {
	*VHost
	// contains filtered or unexported fields
}

func NewChannel

func NewChannel(vhost *VHost) *Channel

func (*Channel) Ack

func (ch *Channel) Ack(tag uint64, multiple bool) error

func (*Channel) Close

func (ch *Channel) Close() error

func (*Channel) Consume

func (ch *Channel) Consume(queue, consumerName string, _ wabbit.Option) (<-chan wabbit.Delivery, error)

Consume starts a fake consumer of queue

func (*Channel) Nack

func (ch *Channel) Nack(tag uint64, multiple bool, requeue bool) error

func (*Channel) Publish

func (ch *Channel) Publish(exc, route string, msg []byte, _ wabbit.Option) error

func (*Channel) Reject

func (ch *Channel) Reject(tag uint64, requeue bool) error

type Delivery

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

Delivery is an interface to delivered messages

func NewDelivery

func NewDelivery(ch *Channel, data []byte, tag uint64) *Delivery

func (*Delivery) Ack

func (d *Delivery) Ack(multiple bool) error

func (*Delivery) Body

func (d *Delivery) Body() []byte

func (*Delivery) ConsumerTag

func (d *Delivery) ConsumerTag() string

func (*Delivery) DeliveryTag

func (d *Delivery) DeliveryTag() uint64

func (*Delivery) Nack

func (d *Delivery) Nack(multiple, requeue bool) error

func (*Delivery) Reject

func (d *Delivery) Reject(requeue bool) error

type DirectExchange

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

func NewDirectExchange

func NewDirectExchange(name string) *DirectExchange

type Exchange

type Exchange interface {
	// contains filtered or unexported methods
}

type Queue

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

func NewQueue

func NewQueue(name string) *Queue

func (*Queue) Consumers

func (q *Queue) Consumers() int

func (*Queue) Messages

func (q *Queue) Messages() int

func (*Queue) Name

func (q *Queue) Name() string

type TopicExchange

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

func NewTopicExchange

func NewTopicExchange(name string) *TopicExchange

type VHost

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

VHost is a fake AMQP virtual host

func NewVHost

func NewVHost(name string) *VHost

NewVHost create a new fake AMQP Virtual Host

func (*VHost) Cancel

func (v *VHost) Cancel(consumer string, noWait bool) error

func (*VHost) ExchangeDeclare

func (v *VHost) ExchangeDeclare(name, kind string, opt wabbit.Option) error

func (*VHost) Publish

func (v *VHost) Publish(exc, route string, d *Delivery, _ wabbit.Option) error

Publish push a new message to queue data channel. The queue data channel is a buffered channel of length `QueueMaxLen`. If the queue is full, this method will block until some messages are consumed.

func (*VHost) Qos

func (v *VHost) Qos(prefetchCount, prefetchSize int, global bool) error

Qos isn't implemented in the fake server

func (*VHost) QueueBind

func (v *VHost) QueueBind(name, key, exchange string, _ wabbit.Option) error

func (*VHost) QueueDeclare

func (v *VHost) QueueDeclare(name string, args wabbit.Option) (wabbit.Queue, error)

func (*VHost) QueueDelete

func (v *VHost) QueueDelete(name string, args wabbit.Option) (int, error)

func (*VHost) QueueUnbind

func (v *VHost) QueueUnbind(name, key, exchange string, _ wabbit.Option) error

Jump to

Keyboard shortcuts

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