xqueue

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnnamedQueue = errors.New("queue needs to be named")
)

Functions

func CloseChannel

func CloseChannel(chann *amqp.Channel) error

func CloseConnection

func CloseConnection(conn *amqp.Connection) error

func DeclareNewQueue

func DeclareNewQueue(channel *amqp.Channel, options *QueueOptions) error

func GetNewQueue

func GetNewQueue(channel *amqp.Channel, options *QueueOptions) (amqp.Queue, error)

func NewChannel

func NewChannel(conn *amqp.Connection) (*amqp.Channel, error)

func NewConnection

func NewConnection(url string) (*amqp.Connection, error)

Types

type Listener

type Listener struct {
	QueueName      string
	Consumer       string
	DisableAutoAck bool
	Exclusive      bool
	NoLocal        bool
	NoWait         bool
	Arguments      amqp.Table
}

type Message

type Message struct {
	QueueName string
	Exchange  string
	Key       string
	Mandatory bool
	Immediate bool

	// Application or exchange specific fields,
	// the headers exchange will inspect this field.
	Headers amqp.Table

	// Properties
	ContentType     string    // MIME content type
	ContentEncoding string    // MIME content encoding
	DeliveryMode    uint8     // Transient (0 or 1) or Persistent (2)
	Priority        uint8     // 0 to 9
	CorrelationId   string    // correlation identifier
	ReplyTo         string    // address to to reply to (ex: RPC)
	Expiration      string    // message expiration spec
	MessageId       string    // message identifier
	Timestamp       time.Time // message timestamp
	Type            string    // message type name
	UserId          string    // creating user id - ex: "guest"
	AppId           string    // creating application id

	// The application specific payload of the message
	Body interface{}
}

type QueueOptions

type QueueOptions struct {
	Name             string
	Durable          bool
	AutoDeleteUnused bool
	Exclusive        bool
	NoWait           bool
	Arguments        amqp.Table
}

type RabbitMQ

type RabbitMQ struct {
	Connection     *amqp.Connection
	DefaultChannel *amqp.Channel
}

func NewClient

func NewClient(url string) (*RabbitMQ, error)

func (*RabbitMQ) CloseConnection

func (q *RabbitMQ) CloseConnection()

func (*RabbitMQ) CloseDefaultChannel

func (q *RabbitMQ) CloseDefaultChannel()

func (*RabbitMQ) NewConsumer

func (q *RabbitMQ) NewConsumer(listener *Listener) (<-chan amqp.Delivery, error)

func (*RabbitMQ) NewQueue

func (q *RabbitMQ) NewQueue(options *QueueOptions) error

func (*RabbitMQ) Produce

func (q *RabbitMQ) Produce(message Message) error

Jump to

Keyboard shortcuts

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