Documentation ¶
Index ¶
Constants ¶
const (
PubSubAwaitingTrxs string = "awaiting_trxs_for_addresses"
)
Variables ¶
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 ¶
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.
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.