natsclient

package
v0.0.0-...-864a747 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PubSubAwaitingTrxs string = "awaiting_trxs_for_addresses"
)

Variables

View Source
var ErrEmptyAddressProvided = errors.New("nats server address is empty")

Functions

This section is empty.

Types

type Config

type Config struct {
	Address string `yaml:"server_address"`
	Name    string `yaml:"client_name"`
	Token   string `yaml:"token"`
}

Config contains all arguments required to connect to the nats service

type Publisher

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

Publisher provides functionality to push messages to the pub/sub queue

func PublisherConnect

func PublisherConnect(cfg Config) (*Publisher, error)

PublisherConnect connects publisher to the pub/sub queue using provided config

func (Publisher) Disconnect

func (s Publisher) Disconnect() error

Disconnect drains the message queue and disconnects from the pub/sub. Nats Drain will put a connection into a drain state. All subscriptions will immediately be put into a drain state. Upon completion, the publishers will be drained and can not publish any additional messages.

func (*Publisher) PublishAddressesAwaitingTrxs

func (p *Publisher) PublishAddressesAwaitingTrxs(addresses []string, notaryNodeURL string) error

PublishAddressesAwaitingTrxs publishes addresses of the clients that have awaiting transactions.

type Subscriber

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

Subscriber provides functionality to pull messages from the pub/sub queue.

func SubscriberConnect

func SubscriberConnect(cfg Config) (*Subscriber, error)

SubscriberConnect connects publisher to the pub/sub queue using provided config

func (Subscriber) Disconnect

func (s Subscriber) Disconnect() error

Disconnect drains the message queue and disconnects from the pub/sub. Nats Drain will put a connection into a drain state. All subscriptions will immediately be put into a drain state. Upon completion, the publishers will be drained and can not publish any additional messages.

func (*Subscriber) SubscribeNewTransactionsForAddresses

func (s *Subscriber) SubscribeNewTransactionsForAddresses(call transaction.TrxAddressesSubscriberCallback, log logger.Logger) error

SubscribeNewTransactionsForAddresses subscribes to pub/sub queue for a addresses awaitng transactions.

Jump to

Keyboard shortcuts

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