amqp

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package amqp implements the message broker interface for AMQP compliant brokers (ie RabbitMQ).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AMQP added in v0.2.2

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

AMQP implements a connection to a broker and a channel for reuse.

func New

func New(uri string) (*AMQP, error)

New instantiates a new amqp broker.

func (*AMQP) Close added in v0.2.2

func (r *AMQP) Close() error

Close terminages gracefully the connection to the AMQP message broker. It will close also all channel consumers ending the go routines of GetReqs and GetEvents.

func (*AMQP) GetEvents added in v0.2.2

func (r *AMQP) GetEvents(net string, mut *sync.Mutex) (<-chan types.Trans, <-chan error, error)

GetEvents consumes requests from the "ee" exchange pushing them to the returned channel. The Mutex pointer is provided to ensure the consumed message has been fully dealt with by the management function, so the message consumed is only acknowledged when the mutex is unlocked.

func (*AMQP) GetReqs added in v0.2.2

func (r *AMQP) GetReqs(net string, mut *sync.Mutex) (<-chan msg.WalletReq, <-chan error, error)

GetReqs consumes requests from the "wr" exchange for the specified network pushing them to the returned channel. The Mutex pointer is provided to ensure the consumed message has been fully dealt with by the management function, so the message consumed is only acknowledged when the mutex is unlocked.

func (*AMQP) SendRequest added in v0.2.2

func (r *AMQP) SendRequest(net string, wr msg.WalletReq) error

SendRequest publishes a new wallet request to the "wr" exchange.

func (*AMQP) SendTrans added in v0.2.2

func (r *AMQP) SendTrans(net string, txs []types.Trans) error

SendTrans publishes transaction events to the "ee" exchange.

func (*AMQP) Setup added in v0.2.2

func (r *AMQP) Setup(x interface{}) error

Setup obtains an amqp channel and declares the message broker exchanges:

- wr ("wallet requests"): the wallet service publishes requests to this exchange

- ee ("explorer events"): the explorer service publishes events to this exchange.

Jump to

Keyboard shortcuts

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