rabbitmq

package
v0.0.0-...-5abcb53 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AMQPClient

type AMQPClient interface {
	Listen(ctx context.Context, exchange string, routingKey string, queueName string, options ...AMQPListenOptions) (<-chan amqp.Delivery, error)
	PublishWithContext(ctx context.Context, exchange, key string, mandatory, immediate bool, msg amqp.Publishing) error
	ExchangeDeclare(name, kind string, durable, autoDelete, internal, noWait bool, args amqp.Table) error
	Close() error
}

func DialAMQP

func DialAMQP(uri string, options ...DialOption) (AMQPClient, error)

type AMQPListenOptions

type AMQPListenOptions = func(opts ListenOptions) ListenOptions

func WithAutoAck

func WithAutoAck(autoAck bool) AMQPListenOptions

func WithAutoDelete

func WithAutoDelete(autoDelete bool) AMQPListenOptions

func WithDurable

func WithDurable(durable bool) AMQPListenOptions

func WithExclusive

func WithExclusive(exclusive bool) AMQPListenOptions

func WithInternal

func WithInternal(internal bool) AMQPListenOptions

func WithWait

func WithWait(wait bool) AMQPListenOptions

type Client

type Client interface {
	SubscribeToLndInvoices(context.Context, IncomingInvoiceHandler) error
	StartPublishInvoices(context.Context, SubscribeToInvoicesFunc, EncodeOutgoingInvoiceFunc) error
	FinalizeInitializedPayments(context.Context, LndHubService) error
	// Close will close all connections to rabbitmq
	Close() error
}

func NewClient

func NewClient(amqpClient AMQPClient, options ...ClientOption) (Client, error)

Dial sets up a connection to rabbitmq with two channels that are ready to produce and consume

type ClientConfig

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

type ClientOption

type ClientOption = func(client *DefaultClient)

func WithLndHubInvoiceExchange

func WithLndHubInvoiceExchange(exchange string) ClientOption

func WithLndInvoiceConsumerQueueName

func WithLndInvoiceConsumerQueueName(name string) ClientOption

func WithLndInvoiceExchange

func WithLndInvoiceExchange(exchange string) ClientOption

func WithLndPaymentConsumerQueueName

func WithLndPaymentConsumerQueueName(name string) ClientOption

func WithLndPaymentExchange

func WithLndPaymentExchange(exchange string) ClientOption

func WithLogger

func WithLogger(logger *lecho.Logger) ClientOption

type DefaultClient

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

func (*DefaultClient) Close

func (client *DefaultClient) Close() error

func (*DefaultClient) FinalizeInitializedPayments

func (client *DefaultClient) FinalizeInitializedPayments(ctx context.Context, svc LndHubService) error

func (*DefaultClient) PublishToLndhubExchange

func (client *DefaultClient) PublishToLndhubExchange(ctx context.Context, invoice models.Invoice, payloadFunc EncodeOutgoingInvoiceFunc) error

func (*DefaultClient) StartPublishInvoices

func (client *DefaultClient) StartPublishInvoices(ctx context.Context, invoicesSubscribeFunc SubscribeToInvoicesFunc, payloadFunc EncodeOutgoingInvoiceFunc) error

func (*DefaultClient) SubscribeToLndInvoices

func (client *DefaultClient) SubscribeToLndInvoices(ctx context.Context, handler IncomingInvoiceHandler) error

type DialOption

type DialOption = func(*defaultAMQPCLient)

func WithAmqpLogger

func WithAmqpLogger(logger *lecho.Logger) DialOption

type EncodeOutgoingInvoiceFunc

type EncodeOutgoingInvoiceFunc = func(ctx context.Context, w io.Writer, invoice models.Invoice) error

type IncomingInvoiceHandler

type IncomingInvoiceHandler = func(ctx context.Context, invoice *lnrpc.Invoice) error

type ListenOptions

type ListenOptions struct {
	Durable    bool
	AutoDelete bool
	Internal   bool
	Wait       bool
	Exclusive  bool
	AutoAck    bool
}

type LndHubService

type LndHubService interface {
	HandleFailedPayment(context.Context, *models.Invoice, models.TransactionEntry, error) error
	HandleSuccessfulPayment(context.Context, *models.Invoice, models.TransactionEntry) error
	GetAllPendingPayments(context.Context) ([]models.Invoice, error)
	GetTransactionEntryByInvoiceId(context.Context, int64) (models.TransactionEntry, error)
}

type SubscribeToInvoicesFunc

type SubscribeToInvoicesFunc = func() (in chan models.Invoice, out chan models.Invoice, err error)

Directories

Path Synopsis
Package mock_rabbitmq is a generated GoMock package.
Package mock_rabbitmq is a generated GoMock package.

Jump to

Keyboard shortcuts

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