server

package
v0.0.0-...-73ad61d Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2021 License: BSD-2-Clause Imports: 10 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, conn wabbit.Conn) (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 BindingsMap

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

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) Cancel

func (ch *Channel) Cancel(consumer string, noWait bool) error

Cancel closes deliveries for all consumers

func (*Channel) Close

func (ch *Channel) Close() error

func (*Channel) Confirm

func (ch *Channel) Confirm(noWait bool) 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) NotifyClose

func (ch *Channel) NotifyClose(c chan wabbit.Error) chan wabbit.Error

NotifyClose publishs notifications about errors in the given channel

func (*Channel) NotifyPublish

func (ch *Channel) NotifyPublish(confirm chan wabbit.Confirmation) chan wabbit.Confirmation

func (*Channel) Publish

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

func (*Channel) QueueInspect

func (ch *Channel) QueueInspect(name string) (wabbit.Queue, error)

func (*Channel) Reject

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

type Confirmation

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

func (Confirmation) Ack

func (c Confirmation) Ack() bool

func (Confirmation) DeliveryTag

func (c Confirmation) DeliveryTag() uint64

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, messageId string, hdrs wabbit.Option, contentType string) *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) ContentType

func (d *Delivery) ContentType() string

func (*Delivery) DeliveryTag

func (d *Delivery) DeliveryTag() uint64

func (*Delivery) Headers

func (d *Delivery) Headers() wabbit.Option

func (*Delivery) MessageId

func (d *Delivery) MessageId() string

func (*Delivery) Nack

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

func (*Delivery) Reject

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

func (*Delivery) Timestamp

func (d *Delivery) Timestamp() time.Time

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 HeadersExchange

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

func NewHeadersExchange

func NewHeadersExchange(name string) *HeadersExchange

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) ExchangeDeclarePassive

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

func (*VHost) Publish

func (v *VHost) Publish(exc, route string, d *Delivery, options 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, options wabbit.Option) error

func (*VHost) QueueDeclare

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

func (*VHost) QueueDeclarePassive

func (v *VHost) QueueDeclarePassive(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, options wabbit.Option) error

Jump to

Keyboard shortcuts

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