amqpadapter

package
v0.0.0-...-07b9e35 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2021 License: OSL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

API is an instance of a message bus. This should to instantiated via the Initialize function.

func Initialize

func Initialize(ctx context.Context, queueName string, direction Direction) (*API, error)

Initialize establishes a connection with the underlaying message bus. Once a connection is established, the function then verifies or creates a queue with the specified name. If the supplied direction is DirectionReceiveOnly then the API will immediately begin receiving messages from the queue.

func (*API) Inspect

func (a *API) Inspect() (*messagebustypes.QueueInfo, error)

Inspect returns information about the number of messages and consumers associated with the queue.

func (*API) Receive

func (a *API) Receive() (*messagebustypes.Message, error)

Receive retrieves a message from the message bus. This method does not block. If no message is available the method will return nil. This method will panic if the message bus was initialized as send-only.

func (*API) Send

func (a *API) Send(msg []byte) error

Send transmits a message to the message bus. This method will panic if the message bus was initialized as receive-only.

type Acknowledger

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

Acknowledger provides capabilities for ack, nack, or reject a message that has been received.

func NewAcknowledger

func NewAcknowledger(channel *amqp.Channel, tag uint64) *Acknowledger

NewAcknowledger returns an instance of an acknowledger associated with a specific message channel and message tag.

func (*Acknowledger) Ack

func (a *Acknowledger) Ack() error

Ack acknowledges that a message has been received.

func (*Acknowledger) Nack

func (a *Acknowledger) Nack(requeue bool) error

Nack negatively acknowledges that a message has been received.

type Direction

type Direction int

Direction denotes if the message queue allows sending and/or receiving.

const (
	// DirectionReceiveOnly callers will only receive messages from this queue.
	DirectionReceiveOnly Direction = 1

	// DirectionSendOnly callers will only send messages to this queue.
	DirectionSendOnly Direction = 2
)

Jump to

Keyboard shortcuts

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