amqp

package
v0.9.1-0...-94679d8 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package amqp provides a simple wrapper around 3rd party amqp client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	PublishConn    *amqp.Connection
	PublishChannel *amqp.Channel
	ConsumeConn    *amqp.Connection
	ConsumeChannel *amqp.Channel
	// contains filtered or unexported fields
}

Client is a wrapper around the amqp client

func NewClient

func NewClient(opts Options) (*Client, error)

NewClient creates a new amqp client

func (*Client) Consume

func (c *Client) Consume(queue string, numberOfMessages int) ([]string, error)

Consume reads a message from the queue

func (*Client) DeclareQueue

func (c *Client) DeclareQueue(name string, ch *amqp.Channel) error

DeclareQueue creates a queue with the given name

func (*Client) DeleteQueues

func (c *Client) DeleteQueues() error

DeleteQueues deletes all queues from the server

func (*Client) Publish

func (c *Client) Publish(queue, body string) error

Publish sends a message to the queue

func (*Client) Terminate

func (c *Client) Terminate()

Terminate closes all connections and channels

type Options

type Options struct {
	ServerAddress string
	Username      string
	Password      string
	Dialer        *net.Dialer

	// WithTLS indicates whether the connection should be made using TLS
	WithTLS bool
}

Options is a struct to hold the options for the amqp client

type Queue

type Queue struct {
	Name string
}

Queue represents an amqp queue

Jump to

Keyboard shortcuts

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